summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiletest/runtest.rs4
-rw-r--r--src/libcollections/btree/map.rs13
-rw-r--r--src/libcollectionstest/btree/map.rs36
-rw-r--r--src/libcollectionstest/lib.rs1
-rw-r--r--src/libstd/collections/hash/map.rs49
-rw-r--r--src/libstd/net/ip.rs48
-rw-r--r--src/libsyntax_ext/deriving/cmp/ord.rs8
-rw-r--r--src/libsyntax_ext/deriving/cmp/partial_ord.rs8
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs70
-rw-r--r--src/test/compile-fail/asm-out-assign-imm.rs1
-rw-r--r--src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs17
-rw-r--r--src/test/compile-fail/borrowck/borrowck-let-suggestion.rs1
-rw-r--r--src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs3
-rw-r--r--src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs4
-rw-r--r--src/test/compile-fail/cast-as-bool.rs1
-rw-r--r--src/test/compile-fail/cast-rfc0401.rs8
-rw-r--r--src/test/compile-fail/fat-ptr-cast.rs1
-rw-r--r--src/test/compile-fail/feature-gate-negate-unsigned.rs1
-rw-r--r--src/test/compile-fail/issue-11714.rs1
-rw-r--r--src/test/compile-fail/issue-13058.rs1
-rw-r--r--src/test/compile-fail/issue-13428.rs2
-rw-r--r--src/test/compile-fail/issue-15260.rs1
-rw-r--r--src/test/compile-fail/issue-16747.rs1
-rw-r--r--src/test/compile-fail/issue-17263.rs2
-rw-r--r--src/test/compile-fail/issue-19707.rs2
-rw-r--r--src/test/compile-fail/issue-21221-1.rs7
-rw-r--r--src/test/compile-fail/issue-21221-2.rs1
-rw-r--r--src/test/compile-fail/issue-21221-3.rs1
-rw-r--r--src/test/compile-fail/issue-21221-4.rs1
-rw-r--r--src/test/compile-fail/issue-21600.rs3
-rw-r--r--src/test/compile-fail/issue-24036.rs5
-rw-r--r--src/test/compile-fail/issue-25385.rs1
-rw-r--r--src/test/compile-fail/issue-25386.rs2
-rw-r--r--src/test/compile-fail/issue-25793.rs1
-rw-r--r--src/test/compile-fail/issue-26638.rs5
-rw-r--r--src/test/compile-fail/issue-30302.rs2
-rw-r--r--src/test/compile-fail/issue-6702.rs1
-rw-r--r--src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs6
-rw-r--r--src/test/compile-fail/lint-group-style.rs1
-rw-r--r--src/test/compile-fail/lint-no-drop-on-repr-extern.rs2
-rw-r--r--src/test/compile-fail/lint-unconditional-recursion.rs14
-rw-r--r--src/test/compile-fail/liveness-return-last-stmt-semi.rs4
-rw-r--r--src/test/compile-fail/macro-backtrace-nested.rs2
-rw-r--r--src/test/compile-fail/macro-backtrace-println.rs3
-rw-r--r--src/test/compile-fail/method-suggestion-no-duplication.rs2
-rw-r--r--src/test/compile-fail/object-safety-generics.rs1
-rw-r--r--src/test/compile-fail/on-unimplemented.rs2
-rw-r--r--src/test/compile-fail/recursion_limit.rs11
-rw-r--r--src/test/compile-fail/ref-suggestion.rs3
-rw-r--r--src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs8
-rw-r--r--src/test/compile-fail/suggest-private-fields.rs1
-rw-r--r--src/test/compile-fail/trait-object-reference-without-parens-suggestion.rs2
-rw-r--r--src/test/compile-fail/use-mod.rs1
-rw-r--r--src/test/compile-fail/variance-unused-type-param.rs3
-rw-r--r--src/test/run-pass/issue-32292.rs18
55 files changed, 330 insertions, 68 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 943d7d4d9bd..e3ced9eff3e 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -1029,8 +1029,8 @@ fn check_expected_errors(revision: Option<&str>,
expected_errors.iter()
.fold((false, false),
|(acc_help, acc_note), ee|
- (acc_help || ee.kind == "help:", acc_note ||
- ee.kind == "note:"));
+ (acc_help || ee.kind == "help:" || ee.kind == "help",
+ acc_note || ee.kind == "note:" || ee.kind == "note"));
// Scan and extract our error/warning messages,
// which look like:
diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs
index 1967f83ab27..7819c7ef796 100644
--- a/src/libcollections/btree/map.rs
+++ b/src/libcollections/btree/map.rs
@@ -1465,6 +1465,13 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
}
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
+ /// Gets a reference to the key that would be used when inserting a value
+ /// through the VacantEntry.
+ #[unstable(feature = "map_entry_keys", issue = "32281")]
+ pub fn key(&self) -> &K {
+ &self.key
+ }
+
/// Sets the value of the entry with the VacantEntry's key,
/// and returns a mutable reference to it.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1509,6 +1516,12 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
}
impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
+ /// Gets a reference to the key in the entry.
+ #[unstable(feature = "map_entry_keys", issue = "32281")]
+ pub fn key(&self) -> &K {
+ self.handle.reborrow().into_kv().0
+ }
+
/// Gets a reference to the value in the entry.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self) -> &V {
diff --git a/src/libcollectionstest/btree/map.rs b/src/libcollectionstest/btree/map.rs
index 7f368f0205b..a27c2847a98 100644
--- a/src/libcollectionstest/btree/map.rs
+++ b/src/libcollectionstest/btree/map.rs
@@ -395,6 +395,42 @@ fn test_variance() {
fn vals<'a, 'new>(v: Values<'a, (), &'static str>) -> Values<'a, (), &'new str> { v }
}
+#[test]
+fn test_occupied_entry_key() {
+ let mut a = BTreeMap::new();
+ let key = "hello there";
+ let value = "value goes here";
+ assert!(a.is_empty());
+ a.insert(key.clone(), value.clone());
+ assert_eq!(a.len(), 1);
+ assert_eq!(a[key], value);
+
+ match a.entry(key.clone()) {
+ Vacant(_) => panic!(),
+ Occupied(e) => assert_eq!(key, *e.key()),
+ }
+ assert_eq!(a.len(), 1);
+ assert_eq!(a[key], value);
+}
+
+#[test]
+fn test_vacant_entry_key() {
+ let mut a = BTreeMap::new();
+ let key = "hello there";
+ let value = "value goes here";
+
+ assert!(a.is_empty());
+ match a.entry(key.clone()) {
+ Occupied(_) => panic!(),
+ Vacant(e) => {
+ assert_eq!(key, *e.key());
+ e.insert(value.clone());
+ },
+ }
+ assert_eq!(a.len(), 1);
+ assert_eq!(a[key], value);
+}
+
mod bench {
use std::collections::BTreeMap;
use std::__rand::{Rng, thread_rng};
diff --git a/src/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs
index 3596b8306a8..62fefaa10f6 100644
--- a/src/libcollectionstest/lib.rs
+++ b/src/libcollectionstest/lib.rs
@@ -21,6 +21,7 @@
#![feature(fn_traits)]
#![feature(enumset)]
#![feature(iter_arith)]
+#![feature(map_entry_keys)]
#![feature(pattern)]
#![feature(rand)]
#![feature(set_recovery)]
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index ec5629038a4..56d95401a9a 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -1554,6 +1554,12 @@ impl<'a, K, V> Entry<'a, K, V> {
}
impl<'a, K, V> OccupiedEntry<'a, K, V> {
+ /// Gets a reference to the key in the entry.
+ #[unstable(feature = "map_entry_keys", issue = "32281")]
+ pub fn key(&self) -> &K {
+ self.elem.read().0
+ }
+
/// Gets a reference to the value in the entry.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self) -> &V {
@@ -1589,6 +1595,13 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
}
impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
+ /// Gets a reference to the key that would be used when inserting a value
+ /// through the VacantEntry.
+ #[unstable(feature = "map_entry_keys", issue = "32281")]
+ pub fn key(&self) -> &K {
+ &self.key
+ }
+
/// Sets the value of the entry with the VacantEntry's key,
/// and returns a mutable reference to it
#[stable(feature = "rust1", since = "1.0.0")]
@@ -2434,4 +2447,40 @@ mod test_map {
a.insert(item, 0);
assert!(a.capacity() > a.len());
}
+
+ #[test]
+ fn test_occupied_entry_key() {
+ let mut a = HashMap::new();
+ let key = "hello there";
+ let value = "value goes here";
+ assert!(a.is_empty());
+ a.insert(key.clone(), value.clone());
+ assert_eq!(a.len(), 1);
+ assert_eq!(a[key], value);
+
+ match a.entry(key.clone()) {
+ Vacant(_) => panic!(),
+ Occupied(e) => assert_eq!(key, *e.key()),
+ }
+ assert_eq!(a.len(), 1);
+ assert_eq!(a[key], value);
+ }
+
+ #[test]
+ fn test_vacant_entry_key() {
+ let mut a = HashMap::new();
+ let key = "hello there";
+ let value = "value goes here";
+
+ assert!(a.is_empty());
+ match a.entry(key.clone()) {
+ Occupied(_) => panic!(),
+ Vacant(e) => {
+ assert_eq!(key, *e.key());
+ e.insert(value.clone());
+ },
+ }
+ assert_eq!(a.len(), 1);
+ assert_eq!(a[key], value);
+ }
}
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index bb688ab484a..678b581a904 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -363,6 +363,12 @@ impl Ipv6Addr {
(self.segments()[0] & 0xffc0) == 0xfec0
}
+ /// Returns true if this is an address reserved for documentation
+ /// This is defined to be 2001:db8::/32 in RFC RFC 3849
+ pub fn is_documentation(&self) -> bool {
+ (self.segments()[0] == 0x2001) && (self.segments()[1] == 0xdb8)
+ }
+
/// Returns true if the address is a globally routable unicast address.
///
/// The following return false:
@@ -372,11 +378,12 @@ impl Ipv6Addr {
/// - the (deprecated) site-local addresses
/// - unique local addresses
/// - the unspecified address
+ /// - the address range reserved for documentation
pub fn is_unicast_global(&self) -> bool {
!self.is_multicast()
&& !self.is_loopback() && !self.is_unicast_link_local()
&& !self.is_unicast_site_local() && !self.is_unique_local()
- && !self.is_unspecified()
+ && !self.is_unspecified() && !self.is_documentation()
}
/// Returns the address's multicast scope if the address is multicast.
@@ -752,7 +759,7 @@ mod tests {
fn ipv6_properties() {
fn check(str_addr: &str, unspec: bool, loopback: bool,
unique_local: bool, global: bool,
- u_link_local: bool, u_site_local: bool, u_global: bool,
+ u_link_local: bool, u_site_local: bool, u_global: bool, u_doc: bool,
m_scope: Option<Ipv6MulticastScope>) {
let ip: Ipv6Addr = str_addr.parse().unwrap();
assert_eq!(str_addr, ip.to_string());
@@ -764,43 +771,46 @@ mod tests {
assert_eq!(ip.is_unicast_link_local(), u_link_local);
assert_eq!(ip.is_unicast_site_local(), u_site_local);
assert_eq!(ip.is_unicast_global(), u_global);
+ assert_eq!(ip.is_documentation(), u_doc);
assert_eq!(ip.multicast_scope(), m_scope);
assert_eq!(ip.is_multicast(), m_scope.is_some());
}
- // unspec loopbk uniqlo global unill unisl uniglo mscope
+ // unspec loopbk uniqlo global unill unisl uniglo doc mscope
check("::",
- true, false, false, false, false, false, false, None);
+ true, false, false, false, false, false, false, false, None);
check("::1",
- false, true, false, false, false, false, false, None);
+ false, true, false, false, false, false, false, false, None);
check("::0.0.0.2",
- false, false, false, true, false, false, true, None);
+ false, false, false, true, false, false, true, false, None);
check("1::",
- false, false, false, true, false, false, true, None);
+ false, false, false, true, false, false, true, false, None);
check("fc00::",
- false, false, true, false, false, false, false, None);
+ false, false, true, false, false, false, false, false, None);
check("fdff:ffff::",
- false, false, true, false, false, false, false, None);
+ false, false, true, false, false, false, false, false, None);
check("fe80:ffff::",
- false, false, false, false, true, false, false, None);
+ false, false, false, false, true, false, false, false, None);
check("febf:ffff::",
- false, false, false, false, true, false, false, None);
+ false, false, false, false, true, false, false, false, None);
check("fec0::",
- false, false, false, false, false, true, false, None);
+ false, false, false, false, false, true, false, false, None);
check("ff01::",
- false, false, false, false, false, false, false, Some(InterfaceLocal));
+ false, false, false, false, false, false, false, false, Some(InterfaceLocal));
check("ff02::",
- false, false, false, false, false, false, false, Some(LinkLocal));
+ false, false, false, false, false, false, false, false, Some(LinkLocal));
check("ff03::",
- false, false, false, false, false, false, false, Some(RealmLocal));
+ false, false, false, false, false, false, false, false, Some(RealmLocal));
check("ff04::",
- false, false, false, false, false, false, false, Some(AdminLocal));
+ false, false, false, false, false, false, false, false, Some(AdminLocal));
check("ff05::",
- false, false, false, false, false, false, false, Some(SiteLocal));
+ false, false, false, false, false, false, false, false, Some(SiteLocal));
check("ff08::",
- false, false, false, false, false, false, false, Some(OrganizationLocal));
+ false, false, false, false, false, false, false, false, Some(OrganizationLocal));
check("ff0e::",
- false, false, false, true, false, false, false, Some(Global));
+ false, false, false, true, false, false, false, false, Some(Global));
+ check("2001:db8:85a3::8a2e:370:7334",
+ false, false, false, false, false, false, false, true, None);
}
#[test]
diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs
index a7e156c5f68..74706c47087 100644
--- a/src/libsyntax_ext/deriving/cmp/ord.rs
+++ b/src/libsyntax_ext/deriving/cmp/ord.rs
@@ -64,7 +64,7 @@ pub fn ordering_collapsed(cx: &mut ExtCtxt,
pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
substr: &Substructure) -> P<Expr> {
- let test_id = cx.ident_of("cmp");
+ let test_id = cx.ident_of("__cmp");
let equals_path = cx.path_global(span,
cx.std_path(&["cmp", "Ordering", "Equal"]));
@@ -79,9 +79,9 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
::std::cmp::Ordering::Equal => {
...
}
- cmp => cmp
+ __cmp => __cmp
},
- cmp => cmp
+ __cmp => __cmp
}
*/
cs_fold(
@@ -91,7 +91,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
|cx, span, old, self_f, other_fs| {
// match new {
// ::std::cmp::Ordering::Equal => old,
- // cmp => cmp
+ // __cmp => __cmp
// }
let new = {
diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs
index b3864a6c2e7..c864ce0db51 100644
--- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs
+++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs
@@ -107,7 +107,7 @@ pub fn some_ordering_collapsed(cx: &mut ExtCtxt,
pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
substr: &Substructure) -> P<Expr> {
- let test_id = cx.ident_of("cmp");
+ let test_id = cx.ident_of("__cmp");
let ordering = cx.path_global(span,
cx.std_path(&["cmp", "Ordering", "Equal"]));
let ordering_expr = cx.expr_path(ordering.clone());
@@ -124,9 +124,9 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
::std::option::Option::Some(::std::cmp::Ordering::Equal) => {
...
}
- cmp => cmp
+ __cmp => __cmp
},
- cmp => cmp
+ __cmp => __cmp
}
*/
cs_fold(
@@ -136,7 +136,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
|cx, span, old, self_f, other_fs| {
// match new {
// Some(::std::cmp::Ordering::Equal) => old,
- // cmp => cmp
+ // __cmp => __cmp
// }
let new = {
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index 58c84e68795..ef7f455632c 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -156,14 +156,14 @@
//!
//! ```{.text}
//! EnumNonMatchingCollapsed(
-//! vec![<ident of self>, <ident of arg_1>],
+//! vec![<ident of self>, <ident of __arg_1>],
//! &[<ast::Variant for C0>, <ast::Variant for C1>],
-//! &[<ident for self index value>, <ident of arg_1 index value>])
+//! &[<ident for self index value>, <ident of __arg_1 index value>])
//! ```
//!
//! It is the same for when the arguments are flipped to `C1 {x}` and
//! `C0(a)`; the only difference is what the values of the identifiers
-//! <ident for self index value> and <ident of arg_1 index value> will
+//! <ident for self index value> and <ident of __arg_1 index value> will
//! be in the generated code.
//!
//! `EnumNonMatchingCollapsed` deliberately provides far less information
@@ -843,7 +843,7 @@ impl<'a> MethodDef<'a> {
for (i, ty) in self.args.iter().enumerate() {
let ast_ty = ty.to_ty(cx, trait_.span, type_ident, generics);
- let ident = cx.ident_of(&format!("arg_{}", i));
+ let ident = cx.ident_of(&format!("__arg_{}", i));
arg_tys.push((ident, ast_ty));
let arg_expr = cx.expr_ident(trait_.span, ident);
@@ -929,12 +929,12 @@ impl<'a> MethodDef<'a> {
///
/// // equivalent to:
/// impl PartialEq for A {
- /// fn eq(&self, arg_1: &A) -> bool {
+ /// fn eq(&self, __arg_1: &A) -> bool {
/// match *self {
- /// A {x: ref self_0_0, y: ref self_0_1} => {
- /// match *arg_1 {
- /// A {x: ref self_1_0, y: ref self_1_1} => {
- /// self_0_0.eq(self_1_0) && self_0_1.eq(self_1_1)
+ /// A {x: ref __self_0_0, y: ref __self_0_1} => {
+ /// match *__arg_1 {
+ /// A {x: ref __self_1_0, y: ref __self_1_1} => {
+ /// __self_0_0.eq(__self_1_0) && __self_0_1.eq(__self_1_1)
/// }
/// }
/// }
@@ -960,7 +960,7 @@ impl<'a> MethodDef<'a> {
trait_.create_struct_pattern(cx,
struct_path,
struct_def,
- &format!("self_{}",
+ &format!("__self_{}",
i),
ast::Mutability::Immutable);
patterns.push(pat);
@@ -1038,14 +1038,14 @@ impl<'a> MethodDef<'a> {
/// // is equivalent to
///
/// impl PartialEq for A {
- /// fn eq(&self, arg_1: &A) -> ::bool {
- /// match (&*self, &*arg_1) {
+ /// fn eq(&self, __arg_1: &A) -> ::bool {
+ /// match (&*self, &*__arg_1) {
/// (&A1, &A1) => true,
/// (&A2(ref self_0),
- /// &A2(ref arg_1_0)) => (*self_0).eq(&(*arg_1_0)),
+ /// &A2(ref __arg_1_0)) => (*self_0).eq(&(*__arg_1_0)),
/// _ => {
- /// let self_vi = match *self { A1(..) => 0, A2(..) => 1 };
- /// let arg_1_vi = match *arg_1 { A1(..) => 0, A2(..) => 1 };
+ /// let __self_vi = match *self { A1(..) => 0, A2(..) => 1 };
+ /// let __arg_1_vi = match *__arg_1 { A1(..) => 0, A2(..) => 1 };
/// false
/// }
/// }
@@ -1053,10 +1053,10 @@ impl<'a> MethodDef<'a> {
/// }
/// ```
///
- /// (Of course `self_vi` and `arg_1_vi` are unused for
+ /// (Of course `__self_vi` and `__arg_1_vi` are unused for
/// `PartialEq`, and those subcomputations will hopefully be removed
- /// as their results are unused. The point of `self_vi` and
- /// `arg_1_vi` is for `PartialOrd`; see #15503.)
+ /// as their results are unused. The point of `__self_vi` and
+ /// `__arg_1_vi` is for `PartialOrd`; see #15503.)
fn expand_enum_method_body<'b>(&self,
cx: &mut ExtCtxt,
trait_: &TraitDef<'b>,
@@ -1087,14 +1087,14 @@ impl<'a> MethodDef<'a> {
/// for each of the self-args, carried in precomputed variables.
/// ```{.text}
- /// let self0_vi = unsafe {
+ /// let __self0_vi = unsafe {
/// std::intrinsics::discriminant_value(&self) } as i32;
- /// let self1_vi = unsafe {
+ /// let __self1_vi = unsafe {
/// std::intrinsics::discriminant_value(&arg1) } as i32;
- /// let self2_vi = unsafe {
+ /// let __self2_vi = unsafe {
/// std::intrinsics::discriminant_value(&arg2) } as i32;
///
- /// if self0_vi == self1_vi && self0_vi == self2_vi && ... {
+ /// if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... {
/// match (...) {
/// (Variant1, Variant1, ...) => Body1
/// (Variant2, Variant2, ...) => Body2,
@@ -1122,9 +1122,9 @@ impl<'a> MethodDef<'a> {
let self_arg_names = self_args.iter().enumerate()
.map(|(arg_count, _self_arg)| {
if arg_count == 0 {
- "self".to_string()
+ "__self".to_string()
} else {
- format!("arg_{}", arg_count)
+ format!("__arg_{}", arg_count)
}
})
.collect::<Vec<String>>();
@@ -1261,17 +1261,17 @@ impl<'a> MethodDef<'a> {
// with three Self args, builds three statements:
//
// ```
- // let self0_vi = unsafe {
+ // let __self0_vi = unsafe {
// std::intrinsics::discriminant_value(&self) } as i32;
- // let self1_vi = unsafe {
+ // let __self1_vi = unsafe {
// std::intrinsics::discriminant_value(&arg1) } as i32;
- // let self2_vi = unsafe {
+ // let __self2_vi = unsafe {
// std::intrinsics::discriminant_value(&arg2) } as i32;
// ```
let mut index_let_stmts: Vec<ast::Stmt> = Vec::new();
//We also build an expression which checks whether all discriminants are equal
- // discriminant_test = self0_vi == self1_vi && self0_vi == self2_vi && ...
+ // discriminant_test = __self0_vi == __self1_vi && __self0_vi == __self2_vi && ...
let mut discriminant_test = cx.expr_bool(sp, true);
let target_type_name =
@@ -1321,7 +1321,7 @@ impl<'a> MethodDef<'a> {
// down to desired l-values, but we cannot actually deref
// them when they are fed as r-values into a tuple
// expression; here add a layer of borrowing, turning
- // `(*self, *arg_0, ...)` into `(&*self, &*arg_0, ...)`.
+ // `(*self, *__arg_0, ...)` into `(&*self, &*__arg_0, ...)`.
let borrowed_self_args = self_args.move_map(|self_arg| cx.expr_addr_of(sp, self_arg));
let match_arg = cx.expr(sp, ast::ExprKind::Tup(borrowed_self_args));
@@ -1335,7 +1335,7 @@ impl<'a> MethodDef<'a> {
// }
// }
// else {
- // <delegated expression referring to self0_vi, et al.>
+ // <delegated expression referring to __self0_vi, et al.>
// }
let all_match = cx.expr_match(sp, match_arg, match_arms);
let arm_expr = cx.expr_if(sp, discriminant_test, all_match, Some(arm_expr));
@@ -1359,8 +1359,8 @@ impl<'a> MethodDef<'a> {
// error-prone, since the catch-all as defined above would
// generate code like this:
//
- // _ => { let self0 = match *self { };
- // let self1 = match *arg_0 { };
+ // _ => { let __self0 = match *self { };
+ // let __self1 = match *__arg_0 { };
// <catch-all-expr> }
//
// Which is yields bindings for variables which type
@@ -1399,7 +1399,7 @@ impl<'a> MethodDef<'a> {
// down to desired l-values, but we cannot actually deref
// them when they are fed as r-values into a tuple
// expression; here add a layer of borrowing, turning
- // `(*self, *arg_0, ...)` into `(&*self, &*arg_0, ...)`.
+ // `(*self, *__arg_0, ...)` into `(&*self, &*__arg_0, ...)`.
let borrowed_self_args = self_args.move_map(|self_arg| cx.expr_addr_of(sp, self_arg));
let match_arg = cx.expr(sp, ast::ExprKind::Tup(borrowed_self_args));
cx.expr_match(sp, match_arg, match_arms)
@@ -1613,8 +1613,8 @@ pub fn cs_fold<F>(use_foldl: bool,
/// process the collected results. i.e.
///
/// ```ignore
-/// f(cx, span, vec![self_1.method(arg_1_1, arg_2_1),
-/// self_2.method(arg_1_2, arg_2_2)])
+/// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1),
+/// self_2.method(__arg_1_2, __arg_2_2)])
/// ```
#[inline]
pub fn cs_same_method<F>(f: F,
diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/compile-fail/asm-out-assign-imm.rs
index 8c8451623d5..c1c72a5519b 100644
--- a/src/test/compile-fail/asm-out-assign-imm.rs
+++ b/src/test/compile-fail/asm-out-assign-imm.rs
@@ -23,6 +23,7 @@ pub fn main() {
unsafe {
asm!("mov $1, $0" : "=r"(x) : "r"(5));
//~^ ERROR re-assignment of immutable variable `x`
+ //~| NOTE in this expansion of asm!
}
foo(x);
}
diff --git a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
index c980e77df6f..7c3d632078f 100644
--- a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
+++ b/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
@@ -54,80 +54,97 @@ fn borrow_after_move() {
fn move_after_borrow() {
let a: Box<_> = box B { x: box 0, y: box 1 };
let _x = &a.x;
+ //~^ NOTE borrow of `a.x` occurs here
let _y = a.y; //~ ERROR cannot move
}
fn copy_after_mut_borrow() {
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &mut a.x;
+ //~^ NOTE borrow of `a.x` occurs here
let _y = a.y; //~ ERROR cannot use
}
fn move_after_mut_borrow() {
let mut a: Box<_> = box B { x: box 0, y: box 1 };
let _x = &mut a.x;
+ //~^ NOTE borrow of `a.x` occurs here
let _y = a.y; //~ ERROR cannot move
}
fn borrow_after_mut_borrow() {
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &mut a.x;
+ //~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`);
let _y = &a.y; //~ ERROR cannot borrow
}
+//~^ NOTE previous borrow ends here
fn mut_borrow_after_borrow() {
let mut a: Box<_> = box A { x: box 0, y: 1 };
let _x = &a.x;
+ //~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`)
let _y = &mut a.y; //~ ERROR cannot borrow
}
+//~^ NOTE previous borrow ends here
fn copy_after_move_nested() {
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = a.x.x;
+ //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
let _y = a.y; //~ ERROR use of collaterally moved
}
fn move_after_move_nested() {
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = a.x.x;
+ //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
let _y = a.y; //~ ERROR use of collaterally moved
}
fn borrow_after_move_nested() {
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = a.x.x;
+ //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
let _y = &a.y; //~ ERROR use of collaterally moved
}
fn move_after_borrow_nested() {
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = &a.x.x;
+ //~^ NOTE borrow of `a.x.x` occurs here
let _y = a.y; //~ ERROR cannot move
}
fn copy_after_mut_borrow_nested() {
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &mut a.x.x;
+ //~^ NOTE borrow of `a.x.x` occurs here
let _y = a.y; //~ ERROR cannot use
}
fn move_after_mut_borrow_nested() {
let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
let _x = &mut a.x.x;
+ //~^ NOTE borrow of `a.x.x` occurs here
let _y = a.y; //~ ERROR cannot move
}
fn borrow_after_mut_borrow_nested() {
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &mut a.x.x;
+ //~^ NOTE previous borrow of `a.x.x` occurs here; the mutable borrow prevents
let _y = &a.y; //~ ERROR cannot borrow
}
+//~^ NOTE previous borrow ends here
fn mut_borrow_after_borrow_nested() {
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
let _x = &a.x.x;
+ //~^ NOTE previous borrow of `a.x.x` occurs here; the immutable borrow prevents
let _y = &mut a.y; //~ ERROR cannot borrow
}
+//~^ NOTE previous borrow ends here
fn main() {
copy_after_move();
diff --git a/src/test/compile-fail/borrowck/borrowck-let-suggestion.rs b/src/test/compile-fail/borrowck/borrowck-let-suggestion.rs
index d760f3db0c2..7e9d448275d 100644
--- a/src/test/compile-fail/borrowck/borrowck-let-suggestion.rs
+++ b/src/test/compile-fail/borrowck/borrowck-let-suggestion.rs
@@ -12,6 +12,7 @@ fn f() {
let x = [1].iter(); //~ ERROR borrowed value does not live long enough
//~^ NOTE reference must be valid for the block suffix following statement
//~^^ HELP consider using a `let` binding to increase its lifetime
+ //~^^^ NOTE ...but borrowed value is only valid for the statement at 12:4
}
fn main() {
diff --git a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs b/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs
index 61bf2c11a1f..2b1ff47ee3d 100644
--- a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs
+++ b/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs
@@ -13,6 +13,7 @@ fn main() {
// Original borrow ends at end of function
let mut x = 1;
let y = &mut x;
+ //~^ previous borrow of `x` occurs here; the mutable borrow prevents
let z = &x; //~ ERROR cannot borrow
}
//~^ NOTE previous borrow ends here
@@ -23,6 +24,7 @@ fn foo() {
// Original borrow ends at end of match arm
let mut x = 1;
let y = &x;
+ //~^ previous borrow of `x` occurs here; the immutable borrow prevents
let z = &mut x; //~ ERROR cannot borrow
}
//~^ NOTE previous borrow ends here
@@ -35,6 +37,7 @@ fn bar() {
|| {
let mut x = 1;
let y = &mut x;
+ //~^ previous borrow of `x` occurs here; the mutable borrow prevents
let z = &mut x; //~ ERROR cannot borrow
};
//~^ NOTE previous borrow ends here
diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs
index a69ce0cb365..1a21b03a457 100644
--- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs
+++ b/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs
@@ -17,6 +17,7 @@ fn a() {
let mut vec = [box 1, box 2, box 3];
match vec {
[box ref _a, _, _] => {
+ //~^ borrow of `vec[..]` occurs here
vec[0] = box 4; //~ ERROR cannot assign
}
}
@@ -27,6 +28,7 @@ fn b() {
let vec: &mut [Box<isize>] = &mut vec;
match vec {
[_b..] => {
+ //~^ borrow of `vec[..]` occurs here
vec[0] = box 4; //~ ERROR cannot assign
}
}
@@ -48,6 +50,7 @@ fn c() {
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
+ //~^ NOTE attempting to move value to here
}
fn d() {
@@ -59,6 +62,7 @@ fn d() {
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
+ //~^ NOTE attempting to move value to here
}
fn e() {
diff --git a/src/test/compile-fail/cast-as-bool.rs b/src/test/compile-fail/cast-as-bool.rs
index 52a4950022d..4764ae380ff 100644
--- a/src/test/compile-fail/cast-as-bool.rs
+++ b/src/test/compile-fail/cast-as-bool.rs
@@ -12,4 +12,5 @@ fn main() {
let u = 5 as bool;
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero instead
+ //~^^^ HELP run `rustc --explain E0054` to see a detailed explanation
}
diff --git a/src/test/compile-fail/cast-rfc0401.rs b/src/test/compile-fail/cast-rfc0401.rs
index 8e129722722..b458334006a 100644
--- a/src/test/compile-fail/cast-rfc0401.rs
+++ b/src/test/compile-fail/cast-rfc0401.rs
@@ -61,9 +61,11 @@ fn main()
let _ = 3 as bool;
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero
+ //~^^^ HELP run `rustc --explain E0054` to see a detailed explanation
let _ = E::A as bool;
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero
+ //~^^^ HELP run `rustc --explain E0054` to see a detailed explanation
let _ = 0x61u32 as char; //~ ERROR only `u8` can be cast
let _ = false as f32;
@@ -90,6 +92,9 @@ fn main()
let _ = v as *const [u8]; //~ ERROR cannot cast
let _ = fat_v as *const Foo;
//~^ ERROR `core::marker::Sized` is not implemented for the type `[u8]`
+ //~^^ HELP run `rustc --explain E0277` to see a detailed explanation
+ //~^^^ NOTE `[u8]` does not have a constant size known at compile-time
+ //~^^^^ NOTE required for the cast to the object type `Foo`
let _ = foo as *const str; //~ ERROR casting
let _ = foo as *mut str; //~ ERROR casting
let _ = main as *mut str; //~ ERROR casting
@@ -102,6 +107,9 @@ fn main()
let a : *const str = "hello";
let _ = a as *const Foo;
//~^ ERROR `core::marker::Sized` is not implemented for the type `str`
+ //~^^ HELP run `rustc --explain E0277` to see a detailed explanation
+ //~^^^ NOTE `str` does not have a constant size known at compile-time
+ //~^^^^ NOTE required for the cast to the object type `Foo`
// check no error cascade
let _ = main.f as *const u32; //~ ERROR attempted access of field
diff --git a/src/test/compile-fail/fat-ptr-cast.rs b/src/test/compile-fail/fat-ptr-cast.rs
index c920b6c171e..b2fd11d4b39 100644
--- a/src/test/compile-fail/fat-ptr-cast.rs
+++ b/src/test/compile-fail/fat-ptr-cast.rs
@@ -18,6 +18,7 @@ fn main() {
let q = a.as_ptr();
a as usize; //~ ERROR casting
+ //~^ HELP cast through a raw pointer first
b as usize; //~ ERROR non-scalar cast
p as usize;
//~^ ERROR casting
diff --git a/src/test/compile-fail/feature-gate-negate-unsigned.rs b/src/test/compile-fail/feature-gate-negate-unsigned.rs
index 546fc5e3c60..4330a4cbeab 100644
--- a/src/test/compile-fail/feature-gate-negate-unsigned.rs
+++ b/src/test/compile-fail/feature-gate-negate-unsigned.rs
@@ -23,5 +23,6 @@ const _MAX: usize = -1;
fn main() {
let x = 5u8;
let _y = -x; //~ ERROR unary negation of unsigned integer
+ //~^ HELP use a cast or the `!` operator
-S; // should not trigger the gate; issue 26840
}
diff --git a/src/test/compile-fail/issue-11714.rs b/src/test/compile-fail/issue-11714.rs
index 998576097a0..6dde59d4a2e 100644
--- a/src/test/compile-fail/issue-11714.rs
+++ b/src/test/compile-fail/issue-11714.rs
@@ -9,6 +9,7 @@
// except according to those terms.
fn blah() -> i32 { //~ ERROR not all control paths return a value
+ //~^ HELP run `rustc --explain E0269` to see a detailed explanation
1
; //~ HELP consider removing this semicolon:
diff --git a/src/test/compile-fail/issue-13058.rs b/src/test/compile-fail/issue-13058.rs
index 8886dd80be5..503ccbd1cab 100644
--- a/src/test/compile-fail/issue-13058.rs
+++ b/src/test/compile-fail/issue-13058.rs
@@ -40,4 +40,5 @@ fn main() {
//~| found `(_, _)`
//~| expected &-ptr
//~| found tuple
+//~| HELP run `rustc --explain E0308` to see a detailed explanation
}
diff --git a/src/test/compile-fail/issue-13428.rs b/src/test/compile-fail/issue-13428.rs
index c771970650d..5b8ab08aefc 100644
--- a/src/test/compile-fail/issue-13428.rs
+++ b/src/test/compile-fail/issue-13428.rs
@@ -11,6 +11,7 @@
// Regression test for #13428
fn foo() -> String { //~ ERROR not all control paths return a value
+ //~^ HELP run `rustc --explain E0269` to see a detailed explanation
format!("Hello {}",
"world")
// Put the trailing semicolon on its own line to test that the
@@ -19,6 +20,7 @@ fn foo() -> String { //~ ERROR not all control paths return a value
}
fn bar() -> String { //~ ERROR not all control paths return a value
+ //~^ HELP run `rustc --explain E0269` to see a detailed explanation
"foobar".to_string()
; //~ HELP consider removing this semicolon
}
diff --git a/src/test/compile-fail/issue-15260.rs b/src/test/compile-fail/issue-15260.rs
index 2228b6d3779..5ec82326d6c 100644
--- a/src/test/compile-fail/issue-15260.rs
+++ b/src/test/compile-fail/issue-15260.rs
@@ -25,6 +25,7 @@ fn main() {
let Foo {
a, //~ NOTE field `a` previously bound here
+ //~^ NOTE field `a` previously bound here
a: _, //~ ERROR field `a` bound multiple times in the pattern
a: x //~ ERROR field `a` bound multiple times in the pattern
} = Foo { a: 29 };
diff --git a/src/test/compile-fail/issue-16747.rs b/src/test/compile-fail/issue-16747.rs
index dd7e8a869ec..0fdb5f74e82 100644
--- a/src/test/compile-fail/issue-16747.rs
+++ b/src/test/compile-fail/issue-16747.rs
@@ -19,6 +19,7 @@ struct List<'a, T: ListItem<'a>> {
//~^ ERROR the parameter type `T` may not live long enough
//~| HELP consider adding an explicit lifetime bound
//~| NOTE ...so that the reference type `&'a [T]` does not outlive the data it points at
+//~| HELP run `rustc --explain E0309` to see a detailed explanation
}
impl<'a, T: ListItem<'a>> Collection for List<'a, T> {
fn len(&self) -> usize {
diff --git a/src/test/compile-fail/issue-17263.rs b/src/test/compile-fail/issue-17263.rs
index f40d51f1d2f..2320bc02baf 100644
--- a/src/test/compile-fail/issue-17263.rs
+++ b/src/test/compile-fail/issue-17263.rs
@@ -23,3 +23,5 @@ fn main() {
//~^ ERROR cannot borrow `foo` (here through borrowing `foo.b`) as immutable
//~^^ NOTE previous borrow of `foo` occurs here (through borrowing `foo.a`)
}
+//~^ NOTE previous borrow ends here
+//~^^ NOTE previous borrow ends here
diff --git a/src/test/compile-fail/issue-19707.rs b/src/test/compile-fail/issue-19707.rs
index 9affb44b744..814c1a4131d 100644
--- a/src/test/compile-fail/issue-19707.rs
+++ b/src/test/compile-fail/issue-19707.rs
@@ -13,8 +13,10 @@
type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2
+//~^^ HELP run `rustc --explain E0106` to see a detailed explanation
fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} //~ ERROR missing lifetime specifier
//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2
+//~^^ HELP run `rustc --explain E0106` to see a detailed explanation
fn main() {}
diff --git a/src/test/compile-fail/issue-21221-1.rs b/src/test/compile-fail/issue-21221-1.rs
index 03dd7b6754a..c53d5a0922e 100644
--- a/src/test/compile-fail/issue-21221-1.rs
+++ b/src/test/compile-fail/issue-21221-1.rs
@@ -55,6 +55,8 @@ impl Mul for Foo {
//~| HELP `mul1::Mul`
//~| HELP `mul2::Mul`
//~| HELP `std::ops::Mul`
+//~| HELP run `rustc --explain E0405` to see a detailed explanation
+//~| HELP you can import several candidates into scope (`use ...;`):
}
// BEFORE, we got:
@@ -75,17 +77,22 @@ fn getMul() -> Mul {
//~| HELP `mul3::Mul`
//~| HELP `mul4::Mul`
//~| HELP and 2 other candidates
+//~| HELP run `rustc --explain E0412` to see a detailed explanation
+//~| HELP you can import several candidates into scope (`use ...;`):
}
// Let's also test what happens if the trait doesn't exist:
impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo {
//~^ ERROR trait `ThisTraitReallyDoesntExistInAnyModuleReally` is not in scope
+//~^^ HELP run `rustc --explain E0405` to see a detailed explanation
+//~^^^ HELP no candidates by the name of `ThisTraitReallyDoesntExistInAnyModuleReally` found
}
// Let's also test what happens if there's just one alternative:
impl Div for Foo {
//~^ ERROR trait `Div` is not in scope
//~| HELP `use std::ops::Div;`
+//~| HELP run `rustc --explain E0405` to see a detailed explanation
}
fn main() {
diff --git a/src/test/compile-fail/issue-21221-2.rs b/src/test/compile-fail/issue-21221-2.rs
index 8c2c27694d9..f031b62214d 100644
--- a/src/test/compile-fail/issue-21221-2.rs
+++ b/src/test/compile-fail/issue-21221-2.rs
@@ -28,3 +28,4 @@ struct Foo;
impl T for Foo { }
//~^ ERROR trait `T` is not in scope
//~| HELP you can to import it into scope: `use foo::bar::T;`.
+//~| HELP run `rustc --explain E0405` to see a detailed explanation
diff --git a/src/test/compile-fail/issue-21221-3.rs b/src/test/compile-fail/issue-21221-3.rs
index ba66496b930..eee2c016451 100644
--- a/src/test/compile-fail/issue-21221-3.rs
+++ b/src/test/compile-fail/issue-21221-3.rs
@@ -25,6 +25,7 @@ struct Foo;
impl OuterTrait for Foo {}
//~^ ERROR trait `OuterTrait` is not in scope
//~| HELP you can to import it into scope: `use issue_21221_3::outer::OuterTrait;`.
+//~| HELP run `rustc --explain E0405` to see a detailed explanation
fn main() {
println!("Hello, world!");
}
diff --git a/src/test/compile-fail/issue-21221-4.rs b/src/test/compile-fail/issue-21221-4.rs
index 8d09510ae09..6a76264dff7 100644
--- a/src/test/compile-fail/issue-21221-4.rs
+++ b/src/test/compile-fail/issue-21221-4.rs
@@ -20,6 +20,7 @@ struct Foo;
impl T for Foo {}
//~^ ERROR trait `T` is not in scope
//~| HELP you can to import it into scope: `use issue_21221_4::T;`.
+//~| HELP run `rustc --explain E0405` to see a detailed explanation
fn main() {
println!("Hello, world!");
diff --git a/src/test/compile-fail/issue-21600.rs b/src/test/compile-fail/issue-21600.rs
index f9a79dbb9c3..d9dcebfda6a 100644
--- a/src/test/compile-fail/issue-21600.rs
+++ b/src/test/compile-fail/issue-21600.rs
@@ -23,5 +23,8 @@ fn main() {
call_it(|| x.gen());
call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer
//~^ ERROR cannot borrow data mutably in a captured outer
+ //~^^ HELP run `rustc --explain E0387` to see a detailed explanation
+ //~^^^ HELP run `rustc --explain E0387` to see a detailed explanation
+ //~^^^^ HELP consider changing this closure to take self by mutable reference
});
}
diff --git a/src/test/compile-fail/issue-24036.rs b/src/test/compile-fail/issue-24036.rs
index 3c8a64eaf7d..28eebea749c 100644
--- a/src/test/compile-fail/issue-24036.rs
+++ b/src/test/compile-fail/issue-24036.rs
@@ -14,17 +14,20 @@ fn closure_to_loc() {
//~^ ERROR mismatched types
//~| NOTE no two closures, even if identical, have the same type
//~| HELP consider boxing your closure and/or using it as a trait object
+ //~| HELP run `rustc --explain E0308` to see a detailed explanation
}
fn closure_from_match() {
let x = match 1usize {
1 => |c| c + 1,
2 => |c| c - 1,
+ //~^ NOTE match arm with an incompatible type
_ => |c| c - 1
};
- //~^^^^^ ERROR match arms have incompatible types
+ //~^^^^^^ ERROR match arms have incompatible types
//~| NOTE no two closures, even if identical, have the same type
//~| HELP consider boxing your closure and/or using it as a trait object
+ //~| HELP run `rustc --explain E0308` to see a detailed explanation
}
fn main() { }
diff --git a/src/test/compile-fail/issue-25385.rs b/src/test/compile-fail/issue-25385.rs
index 4aacb6840e9..51d7baaf3e9 100644
--- a/src/test/compile-fail/issue-25385.rs
+++ b/src/test/compile-fail/issue-25385.rs
@@ -21,4 +21,5 @@ fn main() {
foo!(1i32.foo());
//~^ ERROR no method named `foo` found for type `i32` in the current scope
+ //~^^ NOTE in this expansion of foo!
}
diff --git a/src/test/compile-fail/issue-25386.rs b/src/test/compile-fail/issue-25386.rs
index 297d3aacfd5..b2775db5e75 100644
--- a/src/test/compile-fail/issue-25386.rs
+++ b/src/test/compile-fail/issue-25386.rs
@@ -35,6 +35,4 @@ macro_rules! check_ptr_exist {
fn main() {
let item = stuff::Item::new();
println!("{}", check_ptr_exist!(item, name));
- //~^ NOTE in this expansion of check_ptr_exist!
- //~^^ NOTE in this expansion of check_ptr_exist!
}
diff --git a/src/test/compile-fail/issue-25793.rs b/src/test/compile-fail/issue-25793.rs
index fd3e3186bc5..44b3ada97fe 100644
--- a/src/test/compile-fail/issue-25793.rs
+++ b/src/test/compile-fail/issue-25793.rs
@@ -27,6 +27,7 @@ impl HasInfo {
fn get_other(&mut self) -> usize {
self.get_size(width!(self))
//~^ NOTE in this expansion of width!
+ //~| NOTE borrow of `*self` occurs here
}
}
diff --git a/src/test/compile-fail/issue-26638.rs b/src/test/compile-fail/issue-26638.rs
index 010803bf25b..9cbb64c2311 100644
--- a/src/test/compile-fail/issue-26638.rs
+++ b/src/test/compile-fail/issue-26638.rs
@@ -11,13 +11,18 @@
fn parse_type(iter: Box<Iterator<Item=&str>+'static>) -> &str { iter.next() }
//~^ ERROR missing lifetime specifier [E0106]
//~^^ HELP 2 elided lifetimes
+//~^^^ HELP run `rustc --explain E0106` to see a detailed explanation
fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
//~^ ERROR missing lifetime specifier [E0106]
//~^^ HELP lifetime cannot be derived
+//~^^^ HELP run `rustc --explain E0106` to see a detailed explanation
+//~^^^^ HELP consider giving it an explicit bounded or 'static lifetime
fn parse_type_3() -> &str { unimplemented!() }
//~^ ERROR missing lifetime specifier [E0106]
//~^^ HELP no value for it to be borrowed from
+//~^^^ HELP run `rustc --explain E0106` to see a detailed explanation
+//~^^^^ HELP consider giving it a 'static lifetime
fn main() {}
diff --git a/src/test/compile-fail/issue-30302.rs b/src/test/compile-fail/issue-30302.rs
index 26508a47224..56f0b31da0d 100644
--- a/src/test/compile-fail/issue-30302.rs
+++ b/src/test/compile-fail/issue-30302.rs
@@ -18,8 +18,10 @@ fn is_empty<T>(s: Stack<T>) -> bool {
Nil => true,
//~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack`
//~| HELP consider making the path in the pattern qualified: `Stack::Nil`
+//~| HELP run `rustc --explain E0170` to see a detailed explanation
_ => false
//~^ ERROR unreachable pattern
+//~| HELP run `rustc --explain E0001` to see a detailed explanation
}
}
diff --git a/src/test/compile-fail/issue-6702.rs b/src/test/compile-fail/issue-6702.rs
index 66ed817ffa8..6cb825a9be7 100644
--- a/src/test/compile-fail/issue-6702.rs
+++ b/src/test/compile-fail/issue-6702.rs
@@ -16,4 +16,5 @@ struct Monster {
fn main() {
let _m = Monster(); //~ ERROR `Monster` is the name of a struct or
//~^ HELP did you mean to write: `Monster { /* fields */ }`?
+ //~| HELP run `rustc --explain E0423` to see a detailed explanation
}
diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
index 1fa7284f6b5..be4166e43b5 100644
--- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
+++ b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs
@@ -11,12 +11,15 @@
// Lifetime annotation needed because we have no arguments.
fn f() -> &isize { //~ ERROR missing lifetime specifier
//~^ HELP there is no value for it to be borrowed from
+//~| HELP run `rustc --explain E0106` to see a detailed explanation
+//~| HELP consider giving it a 'static lifetime
panic!()
}
// Lifetime annotation needed because we have two by-reference parameters.
fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier
//~^ HELP the signature does not say whether it is borrowed from `_x` or `_y`
+//~| HELP run `rustc --explain E0106` to see a detailed explanation
panic!()
}
@@ -28,11 +31,14 @@ struct Foo<'a> {
// and one on the reference.
fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier
//~^ HELP the signature does not say which one of `_x`'s 2 elided lifetimes it is borrowed from
+//~| HELP run `rustc --explain E0106` to see a detailed explanation
panic!()
}
fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier
//~^ HELP this function's return type contains a borrowed value
+//~| HELP run `rustc --explain E0106` to see a detailed explanation
+//~| HELP consider giving it an explicit bounded or 'static lifetime
panic!()
}
diff --git a/src/test/compile-fail/lint-group-style.rs b/src/test/compile-fail/lint-group-style.rs
index 59ab5be1572..393e46ab539 100644
--- a/src/test/compile-fail/lint-group-style.rs
+++ b/src/test/compile-fail/lint-group-style.rs
@@ -30,6 +30,7 @@ mod test {
mod warn {
#![warn(bad_style)]
//~^ NOTE lint level defined here
+ //~| NOTE lint level defined here
fn CamelCase() {} //~ WARN function `CamelCase` should have a snake case name
diff --git a/src/test/compile-fail/lint-no-drop-on-repr-extern.rs b/src/test/compile-fail/lint-no-drop-on-repr-extern.rs
index 2df57b08f28..91e5065517d 100644
--- a/src/test/compile-fail/lint-no-drop-on-repr-extern.rs
+++ b/src/test/compile-fail/lint-no-drop-on-repr-extern.rs
@@ -15,6 +15,8 @@
#![feature(unsafe_no_drop_flag)]
#![deny(drop_with_repr_extern)]
+//~^ NOTE lint level defined here
+//~| NOTE lint level defined here
#[repr(C)] struct As { x: Box<i8> }
#[repr(C)] enum Ae { Ae(Box<i8>), _None }
diff --git a/src/test/compile-fail/lint-unconditional-recursion.rs b/src/test/compile-fail/lint-unconditional-recursion.rs
index 6e3a00746f3..94e189aa47f 100644
--- a/src/test/compile-fail/lint-unconditional-recursion.rs
+++ b/src/test/compile-fail/lint-unconditional-recursion.rs
@@ -9,6 +9,20 @@
// except according to those terms.
#![deny(unconditional_recursion)]
+//~^ NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
+//~| NOTE lint level defined here
#![allow(dead_code)]
fn foo() { //~ ERROR function cannot return without recurring
foo(); //~ NOTE recursive call site
diff --git a/src/test/compile-fail/liveness-return-last-stmt-semi.rs b/src/test/compile-fail/liveness-return-last-stmt-semi.rs
index a4eb1630afe..343622c5c1b 100644
--- a/src/test/compile-fail/liveness-return-last-stmt-semi.rs
+++ b/src/test/compile-fail/liveness-return-last-stmt-semi.rs
@@ -13,14 +13,18 @@
macro_rules! test { () => { fn foo() -> i32 { 1; } } }
//~^ ERROR not all control paths return a value
//~^^ HELP consider removing this semicolon
+ //~^^^ HELP run `rustc --explain E0269` to see a
fn no_return() -> i32 {} //~ ERROR not all control paths return a value
+ //~^ HELP run `rustc --explain E0269` to see a detailed explanation
fn bar(x: u32) -> u32 { //~ ERROR not all control paths return a value
+ //~^ HELP run `rustc --explain E0269` to see a detailed explanation
x * 2; //~ HELP consider removing this semicolon
}
fn baz(x: u64) -> u32 { //~ ERROR not all control paths return a value
+ //~^ HELP run `rustc --explain E0269` to see a detailed explanation
x * 2;
}
diff --git a/src/test/compile-fail/macro-backtrace-nested.rs b/src/test/compile-fail/macro-backtrace-nested.rs
index a429681bb21..c935ccef055 100644
--- a/src/test/compile-fail/macro-backtrace-nested.rs
+++ b/src/test/compile-fail/macro-backtrace-nested.rs
@@ -21,9 +21,11 @@ macro_rules! call_nested_expr {
macro_rules! call_nested_expr_sum {
() => { 1 + nested_expr!(); } //~ ERROR unresolved name
+ //~^ NOTE in this expansion of nested_expr!
}
fn main() {
1 + call_nested_expr!(); //~ ERROR unresolved name
+ //~^ NOTE in this expansion of call_nested_expr!
call_nested_expr_sum!(); //~ NOTE in this expansion of
}
diff --git a/src/test/compile-fail/macro-backtrace-println.rs b/src/test/compile-fail/macro-backtrace-println.rs
index 294892662d4..a485b9056de 100644
--- a/src/test/compile-fail/macro-backtrace-println.rs
+++ b/src/test/compile-fail/macro-backtrace-println.rs
@@ -22,7 +22,8 @@ macro_rules! myprint {
macro_rules! myprintln {
($fmt:expr) => (myprint!(concat!($fmt, "\n"))); //~ ERROR invalid reference to argument `0`
- //~^ NOTE in this expansion of
+ //~^ NOTE in this expansion of myprint!
+ //~^^ NOTE in this expansion of concat!
}
fn main() {
diff --git a/src/test/compile-fail/method-suggestion-no-duplication.rs b/src/test/compile-fail/method-suggestion-no-duplication.rs
index e6f3c8ab317..c8c1447fea3 100644
--- a/src/test/compile-fail/method-suggestion-no-duplication.rs
+++ b/src/test/compile-fail/method-suggestion-no-duplication.rs
@@ -9,6 +9,7 @@
// except according to those terms.
// issue #21405
+// ignore-tidy-linelength
struct Foo;
@@ -19,4 +20,5 @@ fn main() {
//~^ ERROR no method named `is_empty` found
//~^^ HELP #1: `core::slice::SliceExt`
//~^^^ HELP #2: `core::str::StrExt`
+ //~^^^^ HELP items from traits can only be used if the trait is implemented and in scope; the following traits define an item `is_empty`, perhaps you need to implement one of them:
}
diff --git a/src/test/compile-fail/object-safety-generics.rs b/src/test/compile-fail/object-safety-generics.rs
index 8e3161ef884..5097e3d7b10 100644
--- a/src/test/compile-fail/object-safety-generics.rs
+++ b/src/test/compile-fail/object-safety-generics.rs
@@ -29,6 +29,7 @@ fn make_bar<T:Bar>(t: &T) -> &Bar {
fn make_bar_explicit<T:Bar>(t: &T) -> &Bar {
//~^ ERROR E0038
+ //~^^ NOTE method `bar` has generic type parameters
t as &Bar
}
diff --git a/src/test/compile-fail/on-unimplemented.rs b/src/test/compile-fail/on-unimplemented.rs
index c4eb467c4f9..f386e7cdd5a 100644
--- a/src/test/compile-fail/on-unimplemented.rs
+++ b/src/test/compile-fail/on-unimplemented.rs
@@ -34,6 +34,8 @@ pub fn main() {
let y: Option<Vec<u8>> = collect(x.iter()); // this should give approximately the same error for x.iter().collect()
//~^ ERROR
//~^^ NOTE a collection of type `core::option::Option<collections::vec::Vec<u8>>` cannot be built from an iterator over elements of type `&u8`
+ //~^^^ NOTE required by `collect`
let x: String = foobar(); //~ ERROR
//~^ NOTE test error `collections::string::String` with `u8` `_` `u32`
+ //~^^ NOTE required by `foobar`
}
diff --git a/src/test/compile-fail/recursion_limit.rs b/src/test/compile-fail/recursion_limit.rs
index 368269999a2..226a6d57ddb 100644
--- a/src/test/compile-fail/recursion_limit.rs
+++ b/src/test/compile-fail/recursion_limit.rs
@@ -43,4 +43,15 @@ fn main() {
is_send::<A>();
//~^ ERROR overflow evaluating
//~| NOTE consider adding a `#![recursion_limit="20"]` attribute to your crate
+ //~| NOTE required because it appears within the type `A`
+ //~| NOTE required because it appears within the type `B`
+ //~| NOTE required because it appears within the type `C`
+ //~| NOTE required because it appears within the type `D`
+ //~| NOTE required because it appears within the type `E`
+ //~| NOTE required because it appears within the type `F`
+ //~| NOTE required because it appears within the type `G`
+ //~| NOTE required because it appears within the type `H`
+ //~| NOTE required because it appears within the type `I`
+ //~| NOTE required because it appears within the type `J`
+ //~| NOTE required by `is_send`
}
diff --git a/src/test/compile-fail/ref-suggestion.rs b/src/test/compile-fail/ref-suggestion.rs
index 815f7526632..4625669d5ec 100644
--- a/src/test/compile-fail/ref-suggestion.rs
+++ b/src/test/compile-fail/ref-suggestion.rs
@@ -14,12 +14,14 @@ fn main() {
//~^ HELP use a `ref` binding as shown
//~| SUGGESTION let ref y = x;
x; //~ ERROR use of moved value
+ //~^ HELP run `rustc --explain E0382` to see a detailed explanation
let x = vec![1];
let mut y = x;
//~^ HELP use a `ref` binding as shown
//~| SUGGESTION let ref mut y = x;
x; //~ ERROR use of moved value
+ //~^ HELP run `rustc --explain E0382` to see a detailed explanation
let x = (Some(vec![1]), ());
@@ -30,4 +32,5 @@ fn main() {
_ => {},
}
x; //~ ERROR use of partially moved value
+ //~^ HELP run `rustc --explain E0382` to see a detailed explanation
}
diff --git a/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs b/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs
index 1d04679fd11..8877377a6ec 100644
--- a/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs
+++ b/src/test/compile-fail/suggest-path-instead-of-mod-dot-item.rs
@@ -27,46 +27,54 @@ fn h1() -> i32 {
a.I
//~^ ERROR E0425
//~| HELP To reference an item from the `a` module, use `a::I`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h2() -> i32 {
a.g()
//~^ ERROR E0425
//~| HELP To call a function from the `a` module, use `a::g(..)`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h3() -> i32 {
a.b.J
//~^ ERROR E0425
//~| HELP To reference an item from the `a` module, use `a::b`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h4() -> i32 {
a::b.J
//~^ ERROR E0425
//~| HELP To reference an item from the `a::b` module, use `a::b::J`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h5() -> i32 {
a.b.f()
//~^ ERROR E0425
//~| HELP To reference an item from the `a` module, use `a::b`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h6() -> i32 {
a::b.f()
//~^ ERROR E0425
//~| HELP To call a function from the `a::b` module, use `a::b::f(..)`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h7() {
a::b
//~^ ERROR E0425
//~| HELP Module `a::b` cannot be the value of an expression
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
fn h8() -> i32 {
a::b()
//~^ ERROR E0425
//~| HELP No function corresponds to `a::b(..)`
+ //~| HELP run `rustc --explain E0425` to see a detailed explanation
}
diff --git a/src/test/compile-fail/suggest-private-fields.rs b/src/test/compile-fail/suggest-private-fields.rs
index 8bc8a7a60bd..9c61f618e69 100644
--- a/src/test/compile-fail/suggest-private-fields.rs
+++ b/src/test/compile-fail/suggest-private-fields.rs
@@ -25,6 +25,7 @@ fn main () {
aa: 20, //~ ERROR structure `xc::B` has no field named `aa`
//~^ HELP did you mean `a`?
bb: 20, //~ ERROR structure `xc::B` has no field named `bb`
+ //~^ HELP did you mean `a`?
};
// local crate struct
let l = A {
diff --git a/src/test/compile-fail/trait-object-reference-without-parens-suggestion.rs b/src/test/compile-fail/trait-object-reference-without-parens-suggestion.rs
index fc2ed83b272..29360e58b5b 100644
--- a/src/test/compile-fail/trait-object-reference-without-parens-suggestion.rs
+++ b/src/test/compile-fail/trait-object-reference-without-parens-suggestion.rs
@@ -13,8 +13,10 @@ fn main() {
//~^ ERROR expected a path
//~| HELP try adding parentheses
//~| SUGGESTION let _: &(Copy + 'static);
+ //~| HELP run `rustc --explain E0178` to see a detailed explanation
let _: &'static Copy + 'static;
//~^ ERROR expected a path
//~| HELP try adding parentheses
//~| SUGGESTION let _: &'static (Copy + 'static);
+ //~| HELP run `rustc --explain E0178` to see a detailed explanation
}
diff --git a/src/test/compile-fail/use-mod.rs b/src/test/compile-fail/use-mod.rs
index 9cc3c92e2e3..bbb063770c1 100644
--- a/src/test/compile-fail/use-mod.rs
+++ b/src/test/compile-fail/use-mod.rs
@@ -11,6 +11,7 @@
use foo::bar::{
self,
//~^ ERROR `self` import can only appear once in the list
+//~^^ NOTE previous import of `bar` here
Bar,
self
//~^ NOTE another `self` import appears here
diff --git a/src/test/compile-fail/variance-unused-type-param.rs b/src/test/compile-fail/variance-unused-type-param.rs
index 862d842d62c..f7fed32cb5a 100644
--- a/src/test/compile-fail/variance-unused-type-param.rs
+++ b/src/test/compile-fail/variance-unused-type-param.rs
@@ -16,15 +16,18 @@
struct SomeStruct<A> { x: u32 }
//~^ ERROR parameter `A` is never used
//~| HELP PhantomData
+//~| HELP run `rustc --explain E0392` to see a detailed explanation
enum SomeEnum<A> { Nothing }
//~^ ERROR parameter `A` is never used
//~| HELP PhantomData
+//~| HELP run `rustc --explain E0392` to see a detailed explanation
// Here T might *appear* used, but in fact it isn't.
enum ListCell<T> {
//~^ ERROR parameter `T` is never used
//~| HELP PhantomData
+//~| HELP run `rustc --explain E0392` to see a detailed explanation
Cons(Box<ListCell<T>>),
Nil
}
diff --git a/src/test/run-pass/issue-32292.rs b/src/test/run-pass/issue-32292.rs
new file mode 100644
index 00000000000..3995caa32bf
--- /dev/null
+++ b/src/test/run-pass/issue-32292.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(warnings)]
+
+#[derive(Hash, Ord, PartialOrd, Eq, PartialEq, Debug, Clone, Copy)]
+struct Foo;
+
+fn main() {
+ let _ = Foo;
+} \ No newline at end of file