From 2f5294e1d6ec900f1d650879954016146e5df748 Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Fri, 5 Aug 2016 18:57:37 +0300 Subject: [PATCH 1/8] Fixes #35304 --- src/librustc_typeck/collect.rs | 7 ++++--- src/test/compile-fail/impl-duplicate-methods.rs | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index ec95afe15bd5..6429faf35ff8 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -772,9 +772,10 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) { let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201, "duplicate definitions with name `{}`:", impl_item.name); - span_note!(&mut err, *entry.get(), - "previous definition of `{}` here", - impl_item.name); + err.span_label(*entry.get(), + &format!("previous definition of `{}` here", + impl_item.name)); + err.span_label(impl_item.span, &format!("duplicate definition")); err.emit(); } Vacant(entry) => { diff --git a/src/test/compile-fail/impl-duplicate-methods.rs b/src/test/compile-fail/impl-duplicate-methods.rs index 981eddc9dd96..f6e9ab2d614b 100644 --- a/src/test/compile-fail/impl-duplicate-methods.rs +++ b/src/test/compile-fail/impl-duplicate-methods.rs @@ -12,7 +12,9 @@ struct Foo; impl Foo { fn orange(&self) {} //~ NOTE previous definition of `orange` here - fn orange(&self) {} //~ ERROR duplicate definitions with name `orange` + fn orange(&self) {} + //~^ ERROR duplicate definition + //~| NOTE duplicate definition } fn main() {} From 5bab0e65eb9f8d23dfcb8a3b9d1595f25c9b11b4 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 5 Aug 2016 16:14:11 -0700 Subject: [PATCH 2/8] Update E0206 message to new format --- src/librustc_typeck/coherence/mod.rs | 15 +++++++++++---- src/test/compile-fail/E0206.rs | 10 +++++++--- src/test/compile-fail/coherence-impls-copy.rs | 15 ++++++++++----- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 198e9afd5e12..333c2a690071 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -316,10 +316,17 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> { name) } Err(CopyImplementationError::NotAnAdt) => { - span_err!(tcx.sess, span, E0206, - "the trait `Copy` may not be implemented \ - for this type; type is not a structure or \ - enumeration") + let item = tcx.map.expect_item(impl_node_id); + let span = if let ItemImpl(_, _, _, _, ref ty, _) = item.node { + ty.span + } else { + span + }; + + struct_span_err!(tcx.sess, span, E0206, + "the trait `Copy` may not be implemented for this type") + .span_label(span, &format!("type is not a structure or enumeration")) + .emit(); } Err(CopyImplementationError::HasDestructor) => { span_err!(tcx.sess, span, E0184, diff --git a/src/test/compile-fail/E0206.rs b/src/test/compile-fail/E0206.rs index 31b01da3d75b..6e43812874f2 100644 --- a/src/test/compile-fail/E0206.rs +++ b/src/test/compile-fail/E0206.rs @@ -10,13 +10,17 @@ type Foo = i32; -impl Copy for Foo { } //~ ERROR E0206 - //~^ ERROR E0117 +impl Copy for Foo { } +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration +//~| ERROR E0117 #[derive(Copy, Clone)] struct Bar; -impl Copy for &'static Bar { } //~ ERROR E0206 +impl Copy for &'static Bar { } +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration fn main() { } diff --git a/src/test/compile-fail/coherence-impls-copy.rs b/src/test/compile-fail/coherence-impls-copy.rs index 9c210c132a31..ec00041a8888 100644 --- a/src/test/compile-fail/coherence-impls-copy.rs +++ b/src/test/compile-fail/coherence-impls-copy.rs @@ -27,22 +27,27 @@ impl Clone for TestE { fn clone(&self) -> Self { *self } } impl Copy for MyType {} impl Copy for &'static mut MyType {} -//~^ ERROR E0206 +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {} -//~^ ERROR E0206 +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration //~| ERROR E0117 impl Copy for &'static NotSync {} -//~^ ERROR E0206 +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration impl Copy for [MyType] {} -//~^ ERROR E0206 +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration //~| ERROR E0117 impl Copy for &'static [NotSync] {} -//~^ ERROR E0206 +//~^ ERROR the trait `Copy` may not be implemented for this type +//~| NOTE type is not a structure or enumeration //~| ERROR E0117 fn main() { From 065c685e80930379ada8c4358cdd69c2c99ebb15 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 5 Aug 2016 20:41:25 -0700 Subject: [PATCH 3/8] Update E0223 to the new format --- src/librustc_typeck/astconv.rs | 10 ++++++---- src/test/compile-fail/E0223.rs | 5 ++++- .../associated-types-in-ambiguous-context.rs | 6 ++++++ src/test/compile-fail/issue-34209.rs | 4 +++- src/test/compile-fail/qualified-path-params-2.rs | 8 ++++++-- src/test/compile-fail/self-impl.rs | 8 ++++++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index a11df5ae05d6..953c6b56948c 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1211,10 +1211,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { type_str: &str, trait_str: &str, name: &str) { - span_err!(self.tcx().sess, span, E0223, - "ambiguous associated type; specify the type using the syntax \ - `<{} as {}>::{}`", - type_str, trait_str, name); + struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type") + .span_label(span, &format!("ambiguous associated type")) + .note(&format!("specify the type using the syntax `<{} as {}>::{}`", + type_str, trait_str, name)) + .emit(); + } // Search for a bound on a type parameter which includes the associated item diff --git a/src/test/compile-fail/E0223.rs b/src/test/compile-fail/E0223.rs index bbf7d762ef00..56057b372599 100644 --- a/src/test/compile-fail/E0223.rs +++ b/src/test/compile-fail/E0223.rs @@ -11,5 +11,8 @@ trait MyTrait { type X; } fn main() { - let foo: MyTrait::X; //~ ERROR E0223 + let foo: MyTrait::X; + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::X` } diff --git a/src/test/compile-fail/associated-types-in-ambiguous-context.rs b/src/test/compile-fail/associated-types-in-ambiguous-context.rs index becbc27138b7..ff886e63dc59 100644 --- a/src/test/compile-fail/associated-types-in-ambiguous-context.rs +++ b/src/test/compile-fail/associated-types-in-ambiguous-context.rs @@ -15,15 +15,21 @@ trait Get { fn get(x: T, y: U) -> Get::Value {} //~^ ERROR ambiguous associated type +//~| NOTE ambiguous associated type +//~| NOTE specify the type using the syntax `::Value` trait Grab { type Value; fn grab(&self) -> Grab::Value; //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::Value` } type X = std::ops::Deref::Target; //~^ ERROR ambiguous associated type +//~| NOTE ambiguous associated type +//~| NOTE specify the type using the syntax `::Target` fn main() { } diff --git a/src/test/compile-fail/issue-34209.rs b/src/test/compile-fail/issue-34209.rs index 6fae18dec10a..5e3b777cc0b6 100644 --- a/src/test/compile-fail/issue-34209.rs +++ b/src/test/compile-fail/issue-34209.rs @@ -15,7 +15,9 @@ enum S { fn bug(l: S) { match l { S::B{ } => { }, - //~^ ERROR ambiguous associated type; specify the type using the syntax `::B` + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::B` } } diff --git a/src/test/compile-fail/qualified-path-params-2.rs b/src/test/compile-fail/qualified-path-params-2.rs index 5c661bfcdc0c..e685ebc27209 100644 --- a/src/test/compile-fail/qualified-path-params-2.rs +++ b/src/test/compile-fail/qualified-path-params-2.rs @@ -25,7 +25,11 @@ impl S { fn f() {} } -type A = ::A::f; //~ ERROR type parameters are not allowed on this type -//~^ ERROR ambiguous associated type; specify the type using the syntax `<::A as Trait>::f` +type A = ::A::f; +//~^ ERROR type parameters are not allowed on this type +//~| NOTE type parameter not allowed +//~| ERROR ambiguous associated type +//~| NOTE ambiguous associated type +//~| NOTE specify the type using the syntax `<::A as Trait>::f` fn main() {} diff --git a/src/test/compile-fail/self-impl.rs b/src/test/compile-fail/self-impl.rs index d058c6a5a3b9..860e69fcaec4 100644 --- a/src/test/compile-fail/self-impl.rs +++ b/src/test/compile-fail/self-impl.rs @@ -31,9 +31,13 @@ impl SuperFoo for Bar { impl Bar { fn f() { let _: ::Baz = true; -//~^ERROR: ambiguous associated type; specify the type using the syntax `::Baz` + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::Baz` let _: Self::Baz = true; -//~^ERROR: ambiguous associated type; specify the type using the syntax `::Baz` + //~^ ERROR ambiguous associated type + //~| NOTE ambiguous associated type + //~| NOTE specify the type using the syntax `::Baz` } } From c9e9d425769274b59734d852a8ae64c9fef16d78 Mon Sep 17 00:00:00 2001 From: silenuss Date: Fri, 5 Aug 2016 20:25:34 -0600 Subject: [PATCH 4/8] Update compiler error 0027 to use new error format. --- src/librustc_typeck/check/_match.rs | 8 +++++--- src/test/compile-fail/E0027.rs | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index aae6e3ad36df..47f75e2f4990 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -700,9 +700,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { for field in variant.fields .iter() .filter(|field| !used_fields.contains_key(&field.name)) { - span_err!(tcx.sess, span, E0027, - "pattern does not mention field `{}`", - field.name); + struct_span_err!(tcx.sess, span, E0027, + "pattern does not mention field `{}`", + field.name) + .span_label(span, &format!("missing field `{}`", field.name)) + .emit(); } } } diff --git a/src/test/compile-fail/E0027.rs b/src/test/compile-fail/E0027.rs index b2f20442b77a..ca496a24701f 100644 --- a/src/test/compile-fail/E0027.rs +++ b/src/test/compile-fail/E0027.rs @@ -17,6 +17,8 @@ fn main() { let d = Dog { name: "Rusty".to_string(), age: 8 }; match d { - Dog { age: x } => {} //~ ERROR E0027 + Dog { age: x } => {} + //~^ ERROR pattern does not mention field `name` + //~| NOTE missing field `name` } } From 1d25e2eeccc40cbde2a1ed5be043889c1450cd93 Mon Sep 17 00:00:00 2001 From: silenuss Date: Sat, 6 Aug 2016 00:33:59 -0600 Subject: [PATCH 5/8] Update compiler error 0029 to use new error format. --- src/librustc_typeck/check/_match.rs | 13 ++++++------- src/test/compile-fail/E0029.rs | 6 +++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index aae6e3ad36df..82a100f18993 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -93,13 +93,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { end.span }; - // Note: spacing here is intentional, we want a space before "start" and "end". - span_err!(tcx.sess, span, E0029, - "only char and numeric types are allowed in range patterns\n \ - start type: {}\n end type: {}", - self.ty_to_string(lhs_ty), - self.ty_to_string(rhs_ty) - ); + struct_span_err!(tcx.sess, span, E0029, + "only char and numeric types are allowed in range patterns") + .span_label(span, &format!("ranges require char or numeric types")) + .note(&format!("start type: {}", self.ty_to_string(lhs_ty))) + .note(&format!("end type: {}", self.ty_to_string(rhs_ty))) + .emit(); return; } diff --git a/src/test/compile-fail/E0029.rs b/src/test/compile-fail/E0029.rs index 9cbdec995205..ec84e2a3f8a3 100644 --- a/src/test/compile-fail/E0029.rs +++ b/src/test/compile-fail/E0029.rs @@ -12,7 +12,11 @@ fn main() { let s = "hoho"; match s { - "hello" ... "world" => {} //~ ERROR E0029 + "hello" ... "world" => {} + //~^ ERROR only char and numeric types are allowed in range patterns + //~| NOTE ranges require char or numeric types + //~| NOTE start type: &'static str + //~| NOTE end type: &'static str _ => {} } } From f4dd1f9500e5d5fedc79994b23f9fdf79672ce71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Medzi=C5=84ski?= Date: Fri, 5 Aug 2016 13:06:09 +0200 Subject: [PATCH 6/8] Updated error message E0252 --- src/librustc_resolve/lib.rs | 6 +++++- src/test/compile-fail/double-import.rs | 3 +-- src/test/compile-fail/issue-26886.rs | 2 ++ src/test/compile-fail/use-mod.rs | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c1511b29c9e0..1c74546a4dc4 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3367,7 +3367,11 @@ impl<'a> Resolver<'a> { (true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg), _ => match (old_binding.is_import(), binding.is_import()) { (false, false) => struct_span_err!(self.session, span, E0428, "{}", msg), - (true, true) => struct_span_err!(self.session, span, E0252, "{}", msg), + (true, true) => { + let mut e = struct_span_err!(self.session, span, E0252, "{}", msg); + e.span_label(span, &format!("already imported")); + e + }, _ => { let mut e = struct_span_err!(self.session, span, E0255, "{}", msg); e.span_label(span, &format!("`{}` was already imported", name)); diff --git a/src/test/compile-fail/double-import.rs b/src/test/compile-fail/double-import.rs index 7b915647884f..bd190a6df8e3 100644 --- a/src/test/compile-fail/double-import.rs +++ b/src/test/compile-fail/double-import.rs @@ -7,8 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(no_core)] -#![no_core] // This tests that conflicting imports shows both `use` lines // when reporting the error. @@ -23,5 +21,6 @@ mod sub2 { use sub1::foo; //~ NOTE previous import of `foo` here use sub2::foo; //~ ERROR a value named `foo` has already been imported in this module [E0252] + //~| NOTE already imported fn main() {} diff --git a/src/test/compile-fail/issue-26886.rs b/src/test/compile-fail/issue-26886.rs index c849716f21a3..46e82363c8bd 100644 --- a/src/test/compile-fail/issue-26886.rs +++ b/src/test/compile-fail/issue-26886.rs @@ -11,7 +11,9 @@ use std::sync::{self, Arc}; //~ NOTE previous import //~^ NOTE previous import use std::sync::Arc; //~ ERROR a type named + //~| NOTE already imported use std::sync; //~ ERROR a module named + //~| NOTE already imported fn main() { } diff --git a/src/test/compile-fail/use-mod.rs b/src/test/compile-fail/use-mod.rs index bbb063770c14..6be878dce1fb 100644 --- a/src/test/compile-fail/use-mod.rs +++ b/src/test/compile-fail/use-mod.rs @@ -15,7 +15,8 @@ use foo::bar::{ Bar, self //~^ NOTE another `self` import appears here -//~^^ ERROR a module named `bar` has already been imported in this module +//~| ERROR a module named `bar` has already been imported in this module +//~| NOTE already imported }; use {self}; From eb469d60b6bba039b94d55ddf3b44e7f81bf3bda Mon Sep 17 00:00:00 2001 From: Federico Ravasio Date: Sat, 6 Aug 2016 15:29:12 +0200 Subject: [PATCH 7/8] Updated E0225 to new format. --- src/librustc_typeck/astconv.rs | 7 +++++-- src/test/compile-fail/E0225.rs | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index a11df5ae05d6..749dcc4e1c61 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2091,8 +2091,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { if !trait_bounds.is_empty() { let b = &trait_bounds[0]; - span_err!(self.tcx().sess, b.trait_ref.path.span, E0225, - "only the builtin traits can be used as closure or object bounds"); + let span = b.trait_ref.path.span; + struct_span_err!(self.tcx().sess, span, E0225, + "only the builtin traits can be used as closure or object bounds") + .span_label(span, &format!("non-builtin trait used as bounds")) + .emit(); } let region_bound = diff --git a/src/test/compile-fail/E0225.rs b/src/test/compile-fail/E0225.rs index 190350c5a557..b013788ceff8 100644 --- a/src/test/compile-fail/E0225.rs +++ b/src/test/compile-fail/E0225.rs @@ -9,5 +9,7 @@ // except according to those terms. fn main() { - let _: Box; //~ ERROR E0225 + let _: Box; + //~^ ERROR only the builtin traits can be used as closure or object bounds [E0225] + //~| NOTE non-builtin trait used as bounds } From 24ddca05e75ab16fec6bbe009eabc3420eb68e78 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Sat, 6 Aug 2016 11:35:42 +0100 Subject: [PATCH 8/8] Update error message for E0243 and E0244 --- src/librustc_typeck/astconv.rs | 29 ++++++++++++------- src/test/compile-fail/E0243.rs | 4 ++- src/test/compile-fail/E0244.rs | 5 +++- .../generic-type-less-params-with-defaults.rs | 4 ++- .../generic-type-more-params-with-defaults.rs | 3 +- src/test/compile-fail/issue-14092.rs | 4 ++- src/test/compile-fail/issue-23024.rs | 7 ++++- .../typeck-builtin-bound-type-parameters.rs | 15 ++++++---- .../typeck_type_placeholder_lifetime_1.rs | 3 +- .../typeck_type_placeholder_lifetime_2.rs | 3 +- .../unboxed-closure-sugar-wrong-trait.rs | 3 +- 11 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 3b2bca4ab391..fd5334e1a926 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2248,20 +2248,27 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize, } else { "expected" }; - span_err!(tcx.sess, span, E0243, - "wrong number of type arguments: {} {}, found {}", - expected, required, supplied); + struct_span_err!(tcx.sess, span, E0243, "wrong number of type arguments") + .span_label( + span, + &format!("{} {} type arguments, found {}", expected, required, supplied) + ) + .emit(); } else if supplied > accepted { - let expected = if required < accepted { - "expected at most" + let expected = if required == 0 { + "expected no".to_string() + } else if required < accepted { + format!("expected at most {}", accepted) } else { - "expected" + format!("expected {}", accepted) }; - span_err!(tcx.sess, span, E0244, - "wrong number of type arguments: {} {}, found {}", - expected, - accepted, - supplied); + + struct_span_err!(tcx.sess, span, E0244, "wrong number of type arguments") + .span_label( + span, + &format!("{} type arguments, found {}", expected, supplied) + ) + .emit(); } } diff --git a/src/test/compile-fail/E0243.rs b/src/test/compile-fail/E0243.rs index 8cc245c10cbe..77c9856c261f 100644 --- a/src/test/compile-fail/E0243.rs +++ b/src/test/compile-fail/E0243.rs @@ -9,7 +9,9 @@ // except according to those terms. struct Foo { x: T } -struct Bar { x: Foo } //~ ERROR E0243 +struct Bar { x: Foo } + //~^ ERROR E0243 + //~| NOTE expected 1 type arguments, found 0 fn main() { } diff --git a/src/test/compile-fail/E0244.rs b/src/test/compile-fail/E0244.rs index 4c5744710929..5678a7fd450d 100644 --- a/src/test/compile-fail/E0244.rs +++ b/src/test/compile-fail/E0244.rs @@ -9,7 +9,10 @@ // except according to those terms. struct Foo { x: bool } -struct Bar { x: Foo } //~ ERROR E0244 +struct Bar { x: Foo } + //~^ ERROR E0244 + //~| NOTE expected no type arguments, found 2 + fn main() { } diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/compile-fail/generic-type-less-params-with-defaults.rs index 37737fda4749..d9ac715fa954 100644 --- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs +++ b/src/test/compile-fail/generic-type-less-params-with-defaults.rs @@ -16,5 +16,7 @@ struct Vec( marker::PhantomData<(T,A)>); fn main() { - let _: Vec; //~ ERROR wrong number of type arguments: expected at least 1, found 0 + let _: Vec; + //~^ ERROR E0243 + //~| NOTE expected at least 1 type arguments, found 0 } diff --git a/src/test/compile-fail/generic-type-more-params-with-defaults.rs b/src/test/compile-fail/generic-type-more-params-with-defaults.rs index ad7e4f190c5b..8f733ddfce18 100644 --- a/src/test/compile-fail/generic-type-more-params-with-defaults.rs +++ b/src/test/compile-fail/generic-type-more-params-with-defaults.rs @@ -17,5 +17,6 @@ struct Vec( fn main() { let _: Vec; - //~^ ERROR wrong number of type arguments: expected at most 2, found 3 + //~^ ERROR E0244 + //~| NOTE expected at most 2 type arguments, found 3 } diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/compile-fail/issue-14092.rs index c87dcb8ae79b..dd02fa7ac151 100644 --- a/src/test/compile-fail/issue-14092.rs +++ b/src/test/compile-fail/issue-14092.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn fn1(0: Box) {} //~ ERROR: wrong number of type arguments: expected 1, found 0 +fn fn1(0: Box) {} + //~^ ERROR E0243 + //~| NOTE expected 1 type arguments, found 0 fn main() {} diff --git a/src/test/compile-fail/issue-23024.rs b/src/test/compile-fail/issue-23024.rs index df2a70160f86..50f1323d39c5 100644 --- a/src/test/compile-fail/issue-23024.rs +++ b/src/test/compile-fail/issue-23024.rs @@ -18,6 +18,11 @@ fn main() vfnfer.push(box h); println!("{:?}",(vfnfer[0] as Fn)(3)); //~^ ERROR the precise format of `Fn`-family traits' - //~| ERROR wrong number of type arguments: expected 1, found 0 + //~| ERROR E0243 + //~| NOTE expected 1 type arguments, found 0 //~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`) + //~| NOTE in this expansion of println! + //~| NOTE in this expansion of println! + //~| NOTE in this expansion of println! + //~| NOTE in this expansion of println! } diff --git a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs b/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs index fb6c43a19059..55ccb8c7db9a 100644 --- a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs +++ b/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs @@ -9,20 +9,25 @@ // except according to those terms. fn foo1, U>(x: T) {} -//~^ ERROR: wrong number of type arguments: expected 0, found 1 +//~^ ERROR E0244 +//~| NOTE expected no type arguments, found 1 trait Trait: Copy {} -//~^ ERROR: wrong number of type arguments: expected 0, found 1 +//~^ ERROR E0244 +//~| NOTE expected no type arguments, found 1 struct MyStruct1>; -//~^ ERROR wrong number of type arguments: expected 0, found 1 +//~^ ERROR E0244 +//~| NOTE expected no type arguments, found 1 struct MyStruct2<'a, T: Copy<'a>>; //~^ ERROR: wrong number of lifetime parameters: expected 0, found 1 + fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} -//~^ ERROR: wrong number of type arguments: expected 0, found 1 -//~^^ ERROR: wrong number of lifetime parameters: expected 0, found 1 +//~^ ERROR E0244 +//~| NOTE expected no type arguments, found 1 +//~| ERROR: wrong number of lifetime parameters: expected 0, found 1 fn main() { } diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs index 2cb46cc352be..f60d925a7486 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs @@ -17,5 +17,6 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, _> = Foo { r: &5 }; - //~^ ERROR wrong number of type arguments: expected 1, found 2 + //~^ ERROR E0244 + //~| NOTE expected 1 type arguments, found 2 } diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs index 8178335de593..ec2675ece74b 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs +++ b/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs @@ -17,5 +17,6 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, usize> = Foo { r: &5 }; - //~^ ERROR wrong number of type arguments: expected 1, found 2 + //~^ ERROR E0244 + //~| NOTE expected 1 type arguments, found 2 } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs index 04bbfc445ede..120975761025 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs @@ -13,7 +13,8 @@ trait Trait {} fn f isize>(x: F) {} -//~^ ERROR wrong number of type arguments: expected 0, found 1 +//~^ ERROR E0244 +//~| NOTE expected no type arguments, found 1 //~| ERROR associated type `Output` not found fn main() {}