diff --git a/src/Cargo.lock b/src/Cargo.lock index 27e7438ddfd26..00f556bf0b28f 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -375,6 +375,7 @@ dependencies = [ "libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/src/test/COMPILER_TESTS.md b/src/test/COMPILER_TESTS.md index 0bc29e8b5aa9e..021f27dacbe0f 100644 --- a/src/test/COMPILER_TESTS.md +++ b/src/test/COMPILER_TESTS.md @@ -133,13 +133,15 @@ Sometimes these built-in normalizations are not enough. In such cases, you may provide custom normalization rules using the header commands, e.g. ``` -// normalize-stderr-32bit: "fn() (32 bits)" -> "fn() ($PTR bits)" -// normalize-stderr-64bit: "fn() (64 bits)" -> "fn() ($PTR bits)" +// normalize-stdout-test: "foo" -> "bar" +// normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)" +// normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)" ``` This tells the test, on 32-bit platforms, whenever the compiler writes `fn() (32 bits)` to stderr, it should be normalized to read `fn() ($PTR bits)` -instead. Similar for 64-bit. +instead. Similar for 64-bit. The replacement is performed by regexes using +default regex flavor provided by `regex` crate. The corresponding reference file will use the normalized output to test both 32-bit and 64-bit platforms: @@ -156,4 +158,5 @@ Please see `ui/transmute/main.rs` and `.stderr` for a concrete usage example. Besides `normalize-stderr-32bit` and `-64bit`, one may use any target information or stage supported by `ignore-X` here as well (e.g. -`normalize-stderr-windows`). +`normalize-stderr-windows` or simply `normalize-stderr-test` for unconditional +replacement). diff --git a/src/test/compile-fail/E0005.rs b/src/test/compile-fail/E0005.rs index 809b3af3bea2a..0405bba81b585 100644 --- a/src/test/compile-fail/E0005.rs +++ b/src/test/compile-fail/E0005.rs @@ -11,5 +11,4 @@ fn main() { let x = Some(1); let Some(y) = x; //~ ERROR E0005 - //~| NOTE pattern `None` not covered } diff --git a/src/test/compile-fail/E0007.rs b/src/test/compile-fail/E0007.rs index b72b5e3b2808b..d5acbdebbe9b9 100644 --- a/src/test/compile-fail/E0007.rs +++ b/src/test/compile-fail/E0007.rs @@ -13,9 +13,7 @@ fn main() { match x { op_string @ Some(s) => {}, //~^ ERROR E0007 - //~| NOTE binds an already bound by-move value by moving it //~| ERROR E0303 - //~| NOTE not allowed after `@` None => {}, } } diff --git a/src/test/compile-fail/E0008.rs b/src/test/compile-fail/E0008.rs index 20cc1cbd2232d..ba5720e6f0abd 100644 --- a/src/test/compile-fail/E0008.rs +++ b/src/test/compile-fail/E0008.rs @@ -12,7 +12,6 @@ fn main() { match Some("hi".to_string()) { Some(s) if s.len() == 0 => {}, //~^ ERROR E0008 - //~| NOTE moves value into pattern guard _ => {}, } } diff --git a/src/test/compile-fail/E0009.rs b/src/test/compile-fail/E0009.rs index 767fc0cc5dc07..02e2e80e7eab1 100644 --- a/src/test/compile-fail/E0009.rs +++ b/src/test/compile-fail/E0009.rs @@ -14,8 +14,6 @@ fn main() { match x { Some((y, ref z)) => {}, //~^ ERROR E0009 - //~| NOTE by-move pattern here - //~| NOTE both by-ref and by-move used None => panic!() } } diff --git a/src/test/compile-fail/E0010.rs b/src/test/compile-fail/E0010.rs index ccaf01932d466..66a9319a7df43 100644 --- a/src/test/compile-fail/E0010.rs +++ b/src/test/compile-fail/E0010.rs @@ -12,6 +12,5 @@ #![allow(warnings)] const CON : Box = box 0; //~ ERROR E0010 - //~| NOTE allocation not allowed in fn main() {} diff --git a/src/test/compile-fail/E0017.rs b/src/test/compile-fail/E0017.rs index 726a6f8c6feb4..c98c35a1442ad 100644 --- a/src/test/compile-fail/E0017.rs +++ b/src/test/compile-fail/E0017.rs @@ -12,10 +12,7 @@ static X: i32 = 1; const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0017 - //~| NOTE constants require immutable values static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 - //~| NOTE statics require immutable values //~| ERROR cannot borrow static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 - //~| NOTE statics require immutable values fn main() {} diff --git a/src/test/compile-fail/E0023.rs b/src/test/compile-fail/E0023.rs index c3623e3177b56..24032c59844dc 100644 --- a/src/test/compile-fail/E0023.rs +++ b/src/test/compile-fail/E0023.rs @@ -18,10 +18,7 @@ fn main() { let x = Fruit::Apple(String::new(), String::new()); match x { Fruit::Apple(a) => {}, //~ ERROR E0023 - //~| NOTE expected 2 fields, found 1 Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 - //~| NOTE expected 2 fields, found 3 Fruit::Pear(1, 2) => {}, //~ ERROR E0023 - //~| NOTE expected 1 field, found 2 } } diff --git a/src/test/compile-fail/E0025.rs b/src/test/compile-fail/E0025.rs index 1d15cef8bc930..81d0ea8a5e21d 100644 --- a/src/test/compile-fail/E0025.rs +++ b/src/test/compile-fail/E0025.rs @@ -17,6 +17,4 @@ fn main() { let x = Foo { a:1, b:2 }; let Foo { a: x, a: y, b: 0 } = x; //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern - //~| NOTE first use of `a` } diff --git a/src/test/compile-fail/E0026.rs b/src/test/compile-fail/E0026.rs index ac609da4cbdde..f8ad7b5a30e1c 100644 --- a/src/test/compile-fail/E0026.rs +++ b/src/test/compile-fail/E0026.rs @@ -18,6 +18,5 @@ fn main() { match thing { Thing { x, y, z } => {} //~^ ERROR struct `Thing` does not have a field named `z` [E0026] - //~| NOTE struct `Thing` does not have field `z` } } diff --git a/src/test/compile-fail/E0027.rs b/src/test/compile-fail/E0027.rs index ca496a24701fb..b63b0ab5dfdef 100644 --- a/src/test/compile-fail/E0027.rs +++ b/src/test/compile-fail/E0027.rs @@ -19,6 +19,5 @@ fn main() { match d { Dog { age: x } => {} //~^ ERROR pattern does not mention field `name` - //~| NOTE missing field `name` } } diff --git a/src/test/compile-fail/E0029.rs b/src/test/compile-fail/E0029.rs index e43290bb15416..80d215bd327c9 100644 --- a/src/test/compile-fail/E0029.rs +++ b/src/test/compile-fail/E0029.rs @@ -14,9 +14,6 @@ fn main() { match s { "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 //~| ERROR non-reference pattern used to match a reference _ => {} } diff --git a/src/test/compile-fail/E0030.rs b/src/test/compile-fail/E0030.rs index 74e827b3379a7..ef3bded4beffb 100644 --- a/src/test/compile-fail/E0030.rs +++ b/src/test/compile-fail/E0030.rs @@ -13,6 +13,5 @@ fn main() { match 5u32 { 1000 ... 5 => {} //~^ ERROR lower range bound must be less than or equal to upper - //~| NOTE lower bound larger than upper bound } } diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs index 03d4747209392..3cdbb55f6deaf 100644 --- a/src/test/compile-fail/E0033.rs +++ b/src/test/compile-fail/E0033.rs @@ -15,12 +15,9 @@ trait SomeTrait { fn main() { let trait_obj: &SomeTrait = SomeTrait; //~^ ERROR expected value, found trait `SomeTrait` - //~| NOTE not a value //~| ERROR E0038 //~| method `foo` has no receiver - //~| NOTE the trait `SomeTrait` cannot be made into an object let &invalid = trait_obj; //~^ ERROR E0033 - //~| NOTE type `&SomeTrait` cannot be dereferenced } diff --git a/src/test/compile-fail/E0034.rs b/src/test/compile-fail/E0034.rs index 136a74f7a8b74..6eebd4d4d5360 100644 --- a/src/test/compile-fail/E0034.rs +++ b/src/test/compile-fail/E0034.rs @@ -20,15 +20,12 @@ trait Trait2 { impl Trait1 for Test { fn foo() {} - //~^ NOTE candidate #1 is defined in an impl of the trait `Trait1` for the type `Test` } impl Trait2 for Test { fn foo() {} - //~^ NOTE candidate #2 is defined in an impl of the trait `Trait2` for the type `Test` } fn main() { Test::foo() //~ ERROR multiple applicable items in scope - //~| NOTE multiple `foo` found } diff --git a/src/test/compile-fail/E0038.rs b/src/test/compile-fail/E0038.rs index 6cf3f1ebf19e4..8087928c051bb 100644 --- a/src/test/compile-fail/E0038.rs +++ b/src/test/compile-fail/E0038.rs @@ -14,8 +14,6 @@ trait Trait { fn call_foo(x: Box) { //~^ ERROR E0038 - //~| NOTE the trait `Trait` cannot be made into an object - //~| NOTE method `foo` references the `Self` type in its arguments or return type let y = x.foo(); } diff --git a/src/test/compile-fail/E0040.rs b/src/test/compile-fail/E0040.rs index edfe22186e162..8385d68c540dd 100644 --- a/src/test/compile-fail/E0040.rs +++ b/src/test/compile-fail/E0040.rs @@ -22,5 +22,4 @@ fn main() { let mut x = Foo { x: -7 }; x.drop(); //~^ ERROR E0040 - //~| NOTE explicit destructor calls not allowed } diff --git a/src/test/compile-fail/E0045.rs b/src/test/compile-fail/E0045.rs index 3f098861eb60c..57c639dd143a2 100644 --- a/src/test/compile-fail/E0045.rs +++ b/src/test/compile-fail/E0045.rs @@ -9,7 +9,6 @@ // except according to those terms. extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 - //~| NOTE variadics require C or cdecl calling convention fn main() { } diff --git a/src/test/compile-fail/E0049.rs b/src/test/compile-fail/E0049.rs index 33ebd3f7aca5e..5867e11e9acc6 100644 --- a/src/test/compile-fail/E0049.rs +++ b/src/test/compile-fail/E0049.rs @@ -9,14 +9,13 @@ // except according to those terms. trait Foo { - fn foo(x: T) -> Self; //~ NOTE expected 1 type parameter + fn foo(x: T) -> Self; } struct Bar; impl Foo for Bar { fn foo(x: bool) -> Self { Bar } //~ ERROR E0049 - //~| NOTE found 0 type parameters } fn main() { diff --git a/src/test/compile-fail/E0050.rs b/src/test/compile-fail/E0050.rs index 5c53d62709aef..2ccc380c540d2 100644 --- a/src/test/compile-fail/E0050.rs +++ b/src/test/compile-fail/E0050.rs @@ -9,20 +9,17 @@ // except according to those terms. trait Foo { - fn foo(&self, x: u8) -> bool; //~ NOTE trait requires 2 parameters - fn bar(&self, x: u8, y: u8, z: u8); //~ NOTE trait requires 4 parameters - fn less(&self); //~ NOTE trait requires 1 parameter + fn foo(&self, x: u8) -> bool; + fn bar(&self, x: u8, y: u8, z: u8); + fn less(&self); } struct Bar; impl Foo for Bar { fn foo(&self) -> bool { true } //~ ERROR E0050 - //~| NOTE expected 2 parameters, found 1 fn bar(&self) { } //~ ERROR E0050 - //~| NOTE expected 4 parameters, found 1 fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050 - //~| NOTE expected 1 parameter, found 4 } fn main() { diff --git a/src/test/compile-fail/E0055.rs b/src/test/compile-fail/E0055.rs index 2b2d278ad4cc6..6e186b81cad8d 100644 --- a/src/test/compile-fail/E0055.rs +++ b/src/test/compile-fail/E0055.rs @@ -20,5 +20,4 @@ fn main() { let ref_foo = &&Foo; ref_foo.foo(); //~^ ERROR E0055 - //~| NOTE deref recursion limit reached } diff --git a/src/test/compile-fail/E0060.rs b/src/test/compile-fail/E0060.rs index 8246c42a4d408..f4505209b6689 100644 --- a/src/test/compile-fail/E0060.rs +++ b/src/test/compile-fail/E0060.rs @@ -10,7 +10,6 @@ extern "C" { fn printf(_: *const u8, ...) -> u32; - //~^ NOTE defined here } fn main() { diff --git a/src/test/compile-fail/E0061.rs b/src/test/compile-fail/E0061.rs index ebd4ad2e292ae..221e18cf89dd5 100644 --- a/src/test/compile-fail/E0061.rs +++ b/src/test/compile-fail/E0061.rs @@ -9,10 +9,8 @@ // except according to those terms. fn f(a: u16, b: &str) {} -//~^ NOTE defined here fn f2(a: u16) {} -//~^ NOTE defined here fn main() { f(0); diff --git a/src/test/compile-fail/E0062.rs b/src/test/compile-fail/E0062.rs index 822d93e52d588..684c9464ff824 100644 --- a/src/test/compile-fail/E0062.rs +++ b/src/test/compile-fail/E0062.rs @@ -14,9 +14,8 @@ struct Foo { fn main() { let x = Foo { - x: 0, //~ NOTE first use of `x` + x: 0, x: 0, //~^ ERROR E0062 - //~| NOTE used more than once }; } diff --git a/src/test/compile-fail/E0063.rs b/src/test/compile-fail/E0063.rs index e7044102abc71..0208aff066b4d 100644 --- a/src/test/compile-fail/E0063.rs +++ b/src/test/compile-fail/E0063.rs @@ -41,14 +41,10 @@ struct TruncatedPluralFoo { fn main() { let w = SingleFoo { }; //~^ ERROR missing field `x` in initializer of `SingleFoo` - //~| NOTE missing `x` let x = PluralFoo {x: 1}; //~^ ERROR missing fields `y`, `z` in initializer of `PluralFoo` - //~| NOTE missing `y`, `z` let y = TruncatedFoo{x:1}; //~^ missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo` - //~| NOTE `a`, `b`, `y` and 1 other field let z = TruncatedPluralFoo{x:1}; //~^ ERROR missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo` - //~| NOTE missing `a`, `b`, `c` and 2 other fields } diff --git a/src/test/compile-fail/E0067.rs b/src/test/compile-fail/E0067.rs index 56d2e82806230..a3fc30ee1c71a 100644 --- a/src/test/compile-fail/E0067.rs +++ b/src/test/compile-fail/E0067.rs @@ -13,6 +13,4 @@ use std::collections::LinkedList; fn main() { LinkedList::new() += 1; //~ ERROR E0368 //~^ ERROR E0067 - //~^^ NOTE invalid expression for left-hand side - //~| NOTE cannot use `+=` on type `std::collections::LinkedList<_>` } diff --git a/src/test/compile-fail/E0069.rs b/src/test/compile-fail/E0069.rs index 00facc9172802..a6a7898ed4e89 100644 --- a/src/test/compile-fail/E0069.rs +++ b/src/test/compile-fail/E0069.rs @@ -11,7 +11,6 @@ fn foo() -> u8 { return; //~^ ERROR `return;` in a function whose return type is not `()` - //~| NOTE return type is not () } fn main() { diff --git a/src/test/compile-fail/E0071.rs b/src/test/compile-fail/E0071.rs index 95653ae83e7cd..d71dc7966fa91 100644 --- a/src/test/compile-fail/E0071.rs +++ b/src/test/compile-fail/E0071.rs @@ -14,5 +14,4 @@ type FooAlias = Foo; fn main() { let u = FooAlias { value: 0 }; //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071] - //~| NOTE not a struct } diff --git a/src/test/compile-fail/E0076.rs b/src/test/compile-fail/E0076.rs index c31dc62eb666b..b159cf107cefb 100644 --- a/src/test/compile-fail/E0076.rs +++ b/src/test/compile-fail/E0076.rs @@ -13,7 +13,6 @@ #[repr(simd)] struct Bad(u16, u32, u32); //~^ ERROR E0076 -//~| NOTE SIMD elements must have the same type fn main() { } diff --git a/src/test/compile-fail/E0081.rs b/src/test/compile-fail/E0081.rs index 9911e093a8980..3b571667336ac 100644 --- a/src/test/compile-fail/E0081.rs +++ b/src/test/compile-fail/E0081.rs @@ -9,10 +9,9 @@ // except according to those terms. enum Enum { - P = 3, //~ NOTE first use of `3isize` + P = 3, X = 3, //~^ ERROR discriminant value `3isize` already exists - //~| NOTE enum already has `3isize` Y = 5 } diff --git a/src/test/compile-fail/E0084.rs b/src/test/compile-fail/E0084.rs index d19eed7124e82..2be206c9702bf 100644 --- a/src/test/compile-fail/E0084.rs +++ b/src/test/compile-fail/E0084.rs @@ -9,7 +9,7 @@ // except according to those terms. #[repr(i32)] //~ ERROR: E0084 -enum Foo {} //~ NOTE: zero-variant enum +enum Foo {} fn main() { } diff --git a/src/test/compile-fail/E0087.rs b/src/test/compile-fail/E0087.rs index 0b8150affc0c0..6dc08860614d7 100644 --- a/src/test/compile-fail/E0087.rs +++ b/src/test/compile-fail/E0087.rs @@ -13,8 +13,6 @@ fn bar() {} fn main() { foo::(); //~ ERROR expected at most 0 type parameters, found 1 type parameter [E0087] - //~^ NOTE expected 0 type parameters bar::(); //~ ERROR expected at most 1 type parameter, found 2 type parameters [E0087] - //~^ NOTE expected 1 type parameter } diff --git a/src/test/compile-fail/E0089.rs b/src/test/compile-fail/E0089.rs index 986630d818fff..21df9abd0932e 100644 --- a/src/test/compile-fail/E0089.rs +++ b/src/test/compile-fail/E0089.rs @@ -12,5 +12,4 @@ fn foo() {} fn main() { foo::(); //~ ERROR expected 2 type parameters, found 1 type parameter [E0089] - //~| NOTE expected 2 type parameters } diff --git a/src/test/compile-fail/E0090.rs b/src/test/compile-fail/E0090.rs index c37f37031add6..13b2131cc8be0 100644 --- a/src/test/compile-fail/E0090.rs +++ b/src/test/compile-fail/E0090.rs @@ -12,5 +12,4 @@ fn foo<'a: 'b, 'b: 'a>() {} fn main() { foo::<'static>(); //~ ERROR expected 2 lifetime parameters, found 1 lifetime parameter [E0090] - //~^ NOTE expected 2 lifetime parameters } diff --git a/src/test/compile-fail/E0091.rs b/src/test/compile-fail/E0091.rs index 0d6c246de2a0e..da988dbf819ac 100644 --- a/src/test/compile-fail/E0091.rs +++ b/src/test/compile-fail/E0091.rs @@ -9,9 +9,7 @@ // except according to those terms. type Foo = u32; //~ ERROR E0091 - //~| NOTE unused type parameter type Foo2 = Box; //~ ERROR E0091 - //~| NOTE unused type parameter fn main() { } diff --git a/src/test/compile-fail/E0092.rs b/src/test/compile-fail/E0092.rs index c8bb31a7857ee..b08164ac06d42 100644 --- a/src/test/compile-fail/E0092.rs +++ b/src/test/compile-fail/E0092.rs @@ -11,7 +11,7 @@ #![feature(intrinsics)] extern "rust-intrinsic" { fn atomic_foo(); //~ ERROR E0092 -} //~| NOTE unrecognized atomic operation +} fn main() { } diff --git a/src/test/compile-fail/E0093.rs b/src/test/compile-fail/E0093.rs index fdc48455a679c..d84f9f649113c 100644 --- a/src/test/compile-fail/E0093.rs +++ b/src/test/compile-fail/E0093.rs @@ -12,7 +12,6 @@ extern "rust-intrinsic" { fn foo(); //~^ ERROR E0093 - //~| NOTE unrecognized intrinsic } fn main() { diff --git a/src/test/compile-fail/E0094.rs b/src/test/compile-fail/E0094.rs index d09353a203800..3a31874b24422 100644 --- a/src/test/compile-fail/E0094.rs +++ b/src/test/compile-fail/E0094.rs @@ -11,7 +11,6 @@ #![feature(intrinsics)] extern "rust-intrinsic" { fn size_of() -> usize; //~ ERROR E0094 - //~| NOTE expected 1 type parameter } fn main() { diff --git a/src/test/compile-fail/E0106.rs b/src/test/compile-fail/E0106.rs index d5644ab060887..0674930a11cca 100644 --- a/src/test/compile-fail/E0106.rs +++ b/src/test/compile-fail/E0106.rs @@ -11,17 +11,14 @@ struct Foo { x: &bool, //~^ ERROR E0106 - //~| NOTE expected lifetime parameter } enum Bar { A(u8), B(&bool), //~^ ERROR E0106 - //~| NOTE expected lifetime parameter } type MyStr = &str; //~^ ERROR E0106 - //~| NOTE expected lifetime parameter struct Baz<'a>(&'a str); struct Buzz<'a, 'b>(&'a str, &'b str); diff --git a/src/test/compile-fail/E0109.rs b/src/test/compile-fail/E0109.rs index 2e4cbf8692693..9fc478422504b 100644 --- a/src/test/compile-fail/E0109.rs +++ b/src/test/compile-fail/E0109.rs @@ -9,7 +9,6 @@ // except according to those terms. type X = u32; //~ ERROR E0109 - //~| NOTE type parameter not allowed fn main() { } diff --git a/src/test/compile-fail/E0110.rs b/src/test/compile-fail/E0110.rs index 5a9e7a43de96b..fd169f4acc5eb 100644 --- a/src/test/compile-fail/E0110.rs +++ b/src/test/compile-fail/E0110.rs @@ -9,7 +9,6 @@ // except according to those terms. type X = u32<'static>; //~ ERROR E0110 - //~| NOTE lifetime parameter not allowed on this type fn main() { } diff --git a/src/test/compile-fail/E0116.rs b/src/test/compile-fail/E0116.rs index f885241eec4c7..cd7d8dc3efb98 100644 --- a/src/test/compile-fail/E0116.rs +++ b/src/test/compile-fail/E0116.rs @@ -10,8 +10,6 @@ impl Vec {} //~^ ERROR E0116 -//~| NOTE impl for type defined outside of crate. -//~| NOTE define and implement a trait or new type instead fn main() { } diff --git a/src/test/compile-fail/E0117.rs b/src/test/compile-fail/E0117.rs index 3da00da205fec..982f875c7b0a8 100644 --- a/src/test/compile-fail/E0117.rs +++ b/src/test/compile-fail/E0117.rs @@ -9,9 +9,6 @@ // except according to those terms. impl Drop for u32 {} //~ ERROR E0117 -//~^ NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead //~| ERROR the Drop trait may only be implemented on structures //~| implementing Drop requires a struct diff --git a/src/test/compile-fail/E0118.rs b/src/test/compile-fail/E0118.rs index 3fc478f1e403e..d37ff34b861f4 100644 --- a/src/test/compile-fail/E0118.rs +++ b/src/test/compile-fail/E0118.rs @@ -9,8 +9,6 @@ // except according to those terms. impl (u8, u8) { //~ ERROR E0118 -//~^ NOTE impl requires a base type -//~| NOTE either implement a trait on it or create a newtype to wrap it instead fn get_state(&self) -> String { String::new() } diff --git a/src/test/compile-fail/E0119.rs b/src/test/compile-fail/E0119.rs index 56820bcd1840c..9528631b3047b 100644 --- a/src/test/compile-fail/E0119.rs +++ b/src/test/compile-fail/E0119.rs @@ -12,7 +12,7 @@ trait MyTrait { fn get(&self) -> usize; } -impl MyTrait for T { //~ NOTE first implementation here +impl MyTrait for T { fn get(&self) -> usize { 0 } } @@ -21,7 +21,6 @@ struct Foo { } impl MyTrait for Foo { //~ ERROR E0119 - //~| NOTE conflicting implementation for `Foo` fn get(&self) -> usize { self.value } } diff --git a/src/test/compile-fail/E0120.rs b/src/test/compile-fail/E0120.rs index 80cc0d2680f7c..8d09b877f002b 100644 --- a/src/test/compile-fail/E0120.rs +++ b/src/test/compile-fail/E0120.rs @@ -12,7 +12,6 @@ trait MyTrait { fn foo() {} } impl Drop for MyTrait { //~^ ERROR E0120 - //~| NOTE implementing Drop requires a struct fn drop(&mut self) {} } diff --git a/src/test/compile-fail/E0124.rs b/src/test/compile-fail/E0124.rs index 18c5074610656..3ef20c6dd4084 100644 --- a/src/test/compile-fail/E0124.rs +++ b/src/test/compile-fail/E0124.rs @@ -9,10 +9,9 @@ // except according to those terms. struct Foo { - field1: i32, //~ NOTE `field1` first declared here + field1: i32, field1: i32, //~^ ERROR field `field1` is already declared [E0124] - //~| NOTE field already declared } fn main() { diff --git a/src/test/compile-fail/E0128.rs b/src/test/compile-fail/E0128.rs index f5829b9385941..37071012825ec 100644 --- a/src/test/compile-fail/E0128.rs +++ b/src/test/compile-fail/E0128.rs @@ -9,7 +9,6 @@ // except according to those terms. struct Foo { //~ ERROR E0128 - //~| NOTE defaulted type parameters cannot be forward declared field1: T, field2: U, } diff --git a/src/test/compile-fail/E0130.rs b/src/test/compile-fail/E0130.rs index e9e027fd1dc19..d11b59cdf334d 100644 --- a/src/test/compile-fail/E0130.rs +++ b/src/test/compile-fail/E0130.rs @@ -11,7 +11,6 @@ extern { fn foo((a, b): (u32, u32)); //~^ ERROR E0130 - //~| NOTE pattern not allowed in foreign function } fn main() { diff --git a/src/test/compile-fail/E0131.rs b/src/test/compile-fail/E0131.rs index e6e924e2d966f..c7e31edd301d4 100644 --- a/src/test/compile-fail/E0131.rs +++ b/src/test/compile-fail/E0131.rs @@ -10,5 +10,4 @@ fn main() { //~^ ERROR E0131 - //~| NOTE main cannot have type parameters } diff --git a/src/test/compile-fail/E0132.rs b/src/test/compile-fail/E0132.rs index 91ff6b85a42ce..25ccb344aba34 100644 --- a/src/test/compile-fail/E0132.rs +++ b/src/test/compile-fail/E0132.rs @@ -12,7 +12,6 @@ #[start] fn f< T >() {} //~ ERROR E0132 - //~| NOTE start function cannot have type parameters fn main() { } diff --git a/src/test/compile-fail/E0133.rs b/src/test/compile-fail/E0133.rs index f60d9a5083f6f..2e54f65e7bff4 100644 --- a/src/test/compile-fail/E0133.rs +++ b/src/test/compile-fail/E0133.rs @@ -13,5 +13,4 @@ unsafe fn f() { return; } fn main() { f(); //~^ ERROR E0133 - //~| NOTE call to unsafe function } diff --git a/src/test/compile-fail/E0137.rs b/src/test/compile-fail/E0137.rs index f45afc9f37bd5..067ebcc727cea 100644 --- a/src/test/compile-fail/E0137.rs +++ b/src/test/compile-fail/E0137.rs @@ -11,9 +11,8 @@ #![feature(main)] #[main] -fn foo() {} //~ NOTE first #[main] function +fn foo() {} #[main] fn f() {} //~^ ERROR E0137 -//~| NOTE additional #[main] function diff --git a/src/test/compile-fail/E0138.rs b/src/test/compile-fail/E0138.rs index 11d90658ab26a..856616c857085 100644 --- a/src/test/compile-fail/E0138.rs +++ b/src/test/compile-fail/E0138.rs @@ -12,9 +12,7 @@ #[start] fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } -//~^ NOTE previous `start` function here #[start] fn f(argc: isize, argv: *const *const u8) -> isize { 0 } //~^ ERROR E0138 -//~| NOTE multiple `start` functions diff --git a/src/test/compile-fail/E0162.rs b/src/test/compile-fail/E0162.rs index 0b63d7c3f85c7..e13b0af6f7977 100644 --- a/src/test/compile-fail/E0162.rs +++ b/src/test/compile-fail/E0162.rs @@ -13,7 +13,6 @@ struct Irrefutable(i32); fn main() { let irr = Irrefutable(0); if let Irrefutable(x) = irr { //~ ERROR E0162 - //~| NOTE irrefutable pattern println!("{}", x); } } diff --git a/src/test/compile-fail/E0164.rs b/src/test/compile-fail/E0164.rs index cf6cf15115ac0..a7f10ddb5a7f8 100644 --- a/src/test/compile-fail/E0164.rs +++ b/src/test/compile-fail/E0164.rs @@ -18,7 +18,6 @@ impl Foo { fn bar(foo: Foo) -> u32 { match foo { Foo::B(i) => i, //~ ERROR E0164 - //~| NOTE not a tuple variant or struct } } diff --git a/src/test/compile-fail/E0184.rs b/src/test/compile-fail/E0184.rs index 9ec2eeba5cc5f..5d72d00ffe876 100644 --- a/src/test/compile-fail/E0184.rs +++ b/src/test/compile-fail/E0184.rs @@ -9,8 +9,6 @@ // except according to those terms. #[derive(Copy)] //~ ERROR E0184 - //~| NOTE Copy not allowed on types with destructors - //~| NOTE in this expansion of #[derive(Copy)] struct Foo; impl Drop for Foo { diff --git a/src/test/compile-fail/E0191.rs b/src/test/compile-fail/E0191.rs index dcfe441ab0d00..489ebb033f84e 100644 --- a/src/test/compile-fail/E0191.rs +++ b/src/test/compile-fail/E0191.rs @@ -13,7 +13,6 @@ trait Trait { } type Foo = Trait; //~ ERROR E0191 - //~| NOTE missing associated type `Bar` value fn main() { } diff --git a/src/test/compile-fail/E0194.rs b/src/test/compile-fail/E0194.rs index 6b1f718dd76c5..17e0751859d9f 100644 --- a/src/test/compile-fail/E0194.rs +++ b/src/test/compile-fail/E0194.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -trait Foo { //~ NOTE first `T` declared here +trait Foo { fn do_something(&self) -> T; fn do_something_else(&self, bar: T); //~^ ERROR E0194 - //~| NOTE shadows another type parameter } fn main() { diff --git a/src/test/compile-fail/E0206.rs b/src/test/compile-fail/E0206.rs index 1131e8e1b01ca..da0370b301b5b 100644 --- a/src/test/compile-fail/E0206.rs +++ b/src/test/compile-fail/E0206.rs @@ -12,18 +12,13 @@ type Foo = i32; impl Copy for Foo { } //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead #[derive(Copy, Clone)] struct Bar; 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/E0207.rs b/src/test/compile-fail/E0207.rs index fbddb81d7c70b..bd87dbaf786a5 100644 --- a/src/test/compile-fail/E0207.rs +++ b/src/test/compile-fail/E0207.rs @@ -11,7 +11,6 @@ struct Foo; impl Foo { //~ ERROR E0207 - //~| NOTE unconstrained type parameter fn get(&self) -> T { ::default() } diff --git a/src/test/compile-fail/E0214.rs b/src/test/compile-fail/E0214.rs index e9c3cb72c11b0..2b090391c743b 100644 --- a/src/test/compile-fail/E0214.rs +++ b/src/test/compile-fail/E0214.rs @@ -11,5 +11,4 @@ fn main() { let v: Vec(&str) = vec!["foo"]; //~^ ERROR E0214 - //~| NOTE only traits may use parentheses } diff --git a/src/test/compile-fail/E0220.rs b/src/test/compile-fail/E0220.rs index c5a1824514d74..2866ffcd63792 100644 --- a/src/test/compile-fail/E0220.rs +++ b/src/test/compile-fail/E0220.rs @@ -13,8 +13,6 @@ trait Trait { } type Foo = Trait; //~ ERROR E0220 - //~| NOTE associated type `F` not found //~| ERROR E0191 - //~| NOTE missing associated type `Bar` value fn main() { } diff --git a/src/test/compile-fail/E0221.rs b/src/test/compile-fail/E0221.rs index aed2b4084e810..99092465b0ae7 100644 --- a/src/test/compile-fail/E0221.rs +++ b/src/test/compile-fail/E0221.rs @@ -12,27 +12,24 @@ trait T1 {} trait T2 {} trait Foo { - type A: T1; //~ NOTE: ambiguous `A` from `Foo` + type A: T1; } trait Bar : Foo { - type A: T2; //~ NOTE: ambiguous `A` from `Bar` + type A: T2; fn do_something() { let _: Self::A; //~^ ERROR E0221 - //~| NOTE ambiguous associated type `A` } } trait T3 {} trait My : std::str::FromStr { - type Err: T3; //~ NOTE: ambiguous `Err` from `My` + type Err: T3; fn test() { let _: Self::Err; //~^ ERROR E0221 - //~| NOTE ambiguous associated type `Err` - //~| NOTE associated type `Self` could derive from `std::str::FromStr` } } diff --git a/src/test/compile-fail/E0223.rs b/src/test/compile-fail/E0223.rs index 56057b372599d..0683197b2b670 100644 --- a/src/test/compile-fail/E0223.rs +++ b/src/test/compile-fail/E0223.rs @@ -13,6 +13,4 @@ trait MyTrait { type X; } fn main() { 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/E0225.rs b/src/test/compile-fail/E0225.rs index c2f610ecd2816..6c77443c5ede9 100644 --- a/src/test/compile-fail/E0225.rs +++ b/src/test/compile-fail/E0225.rs @@ -11,5 +11,4 @@ fn main() { let _: Box; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] - //~| NOTE non-auto additional trait } diff --git a/src/test/compile-fail/E0229.rs b/src/test/compile-fail/E0229.rs index d15f9937f1382..b70fb092a5410 100644 --- a/src/test/compile-fail/E0229.rs +++ b/src/test/compile-fail/E0229.rs @@ -22,7 +22,6 @@ impl Foo for isize { fn baz(x: &>::A) {} //~^ ERROR associated type bindings are not allowed here [E0229] -//~| NOTE associated type not allowed here fn main() { } diff --git a/src/test/compile-fail/E0232.rs b/src/test/compile-fail/E0232.rs index a33120bbebd23..04657c65c8e45 100644 --- a/src/test/compile-fail/E0232.rs +++ b/src/test/compile-fail/E0232.rs @@ -12,8 +12,6 @@ #[rustc_on_unimplemented] //~^ ERROR E0232 -//~| NOTE value required here -//~| NOTE eg `#[rustc_on_unimplemented = "foo"]` trait Bar {} fn main() { diff --git a/src/test/compile-fail/E0243.rs b/src/test/compile-fail/E0243.rs index d20435a37ff5b..615ce0b5d4265 100644 --- a/src/test/compile-fail/E0243.rs +++ b/src/test/compile-fail/E0243.rs @@ -11,7 +11,6 @@ struct Foo { x: T } struct Bar { x: Foo } //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243] - //~| NOTE expected 1 type argument fn main() { } diff --git a/src/test/compile-fail/E0244.rs b/src/test/compile-fail/E0244.rs index 02d4b337894b2..9a78b3139d064 100644 --- a/src/test/compile-fail/E0244.rs +++ b/src/test/compile-fail/E0244.rs @@ -11,7 +11,6 @@ struct Foo { x: bool } struct Bar { x: Foo } //~^ ERROR wrong number of type arguments: expected 0, found 2 [E0244] - //~| NOTE expected no type arguments fn main() { diff --git a/src/test/compile-fail/E0253.rs b/src/test/compile-fail/E0253.rs index 5a06c01241b4b..186d9019aaeba 100644 --- a/src/test/compile-fail/E0253.rs +++ b/src/test/compile-fail/E0253.rs @@ -16,6 +16,5 @@ mod foo { use foo::MyTrait::do_something; //~^ ERROR E0253 - //~|NOTE cannot be imported directly fn main() {} diff --git a/src/test/compile-fail/E0254.rs b/src/test/compile-fail/E0254.rs index 996a6b97cd998..46c74fe3735a3 100644 --- a/src/test/compile-fail/E0254.rs +++ b/src/test/compile-fail/E0254.rs @@ -12,7 +12,6 @@ #![allow(unused_extern_crates)] extern crate alloc; -//~^ NOTE previous import of the extern crate `alloc` here mod foo { pub trait alloc { @@ -22,7 +21,5 @@ mod foo { use foo::alloc; //~^ ERROR E0254 -//~| NOTE `alloc` reimported here -//~| NOTE `alloc` must be defined only once in the type namespace of this module fn main() {} diff --git a/src/test/compile-fail/E0259.rs b/src/test/compile-fail/E0259.rs index e125cc0c19c37..5a47541c708be 100644 --- a/src/test/compile-fail/E0259.rs +++ b/src/test/compile-fail/E0259.rs @@ -12,12 +12,8 @@ #![allow(unused_extern_crates)] extern crate alloc; -//~^ NOTE previous import of the extern crate `alloc` here extern crate libc as alloc; //~^ ERROR E0259 -//~| NOTE `alloc` reimported here -//~| NOTE `alloc` must be defined only once in the type namespace of this module -//~| NOTE You can use `as` to change the binding name of the import fn main() {} diff --git a/src/test/compile-fail/E0260.rs b/src/test/compile-fail/E0260.rs index ad8888e58f79a..1b01bb12203d3 100644 --- a/src/test/compile-fail/E0260.rs +++ b/src/test/compile-fail/E0260.rs @@ -12,12 +12,9 @@ #![allow(unused_extern_crates)] extern crate alloc; -//~^ NOTE previous import of the extern crate `alloc` here mod alloc { //~^ ERROR the name `alloc` is defined multiple times [E0260] -//~| NOTE `alloc` redefined here -//~| NOTE `alloc` must be defined only once in the type namespace of this module pub trait MyTrait { fn do_something(); } diff --git a/src/test/compile-fail/E0263.rs b/src/test/compile-fail/E0263.rs index 11a8ff443a845..722f1c25e07d1 100644 --- a/src/test/compile-fail/E0263.rs +++ b/src/test/compile-fail/E0263.rs @@ -10,8 +10,6 @@ fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { //~^ ERROR E0263 - //~| NOTE declared twice - //~| NOTE previous declaration here } fn main() {} diff --git a/src/test/compile-fail/E0267.rs b/src/test/compile-fail/E0267.rs index b58fbce8bc648..6287256e866c9 100644 --- a/src/test/compile-fail/E0267.rs +++ b/src/test/compile-fail/E0267.rs @@ -10,5 +10,4 @@ fn main() { let w = || { break; }; //~ ERROR E0267 - //~| NOTE cannot break inside of a closure } diff --git a/src/test/compile-fail/E0268.rs b/src/test/compile-fail/E0268.rs index 3313e07667a1c..41e88e2f492a9 100644 --- a/src/test/compile-fail/E0268.rs +++ b/src/test/compile-fail/E0268.rs @@ -10,5 +10,4 @@ fn main() { break; //~ ERROR E0268 - //~| NOTE cannot break outside of a loop } diff --git a/src/test/compile-fail/E0277-2.rs b/src/test/compile-fail/E0277-2.rs index 816d352955427..4d1c50002a39c 100644 --- a/src/test/compile-fail/E0277-2.rs +++ b/src/test/compile-fail/E0277-2.rs @@ -25,9 +25,4 @@ fn is_send() { } fn main() { is_send::(); //~^ ERROR the trait bound `*const u8: std::marker::Send` is not satisfied in `Foo` - //~| NOTE: `*const u8` cannot be sent between threads safely - //~| NOTE: required because it appears within the type `Baz` - //~| NOTE: required because it appears within the type `Bar` - //~| NOTE: required because it appears within the type `Foo` - //~| NOTE: required by `is_send` } diff --git a/src/test/compile-fail/E0277.rs b/src/test/compile-fail/E0277.rs index 8b34936419db5..784f7465d439b 100644 --- a/src/test/compile-fail/E0277.rs +++ b/src/test/compile-fail/E0277.rs @@ -20,13 +20,8 @@ fn some_func(foo: T) { fn f(p: Path) { } //~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path` -//~| NOTE `[u8]` does not have a constant size known at compile-time -//~| NOTE required because it appears within the type `std::path::Path` -//~| NOTE all local variables must have a statically known size fn main() { some_func(5i32); //~^ ERROR the trait bound `i32: Foo` is not satisfied - //~| NOTE the trait `Foo` is not implemented for `i32` - //~| NOTE required by `some_func` } diff --git a/src/test/compile-fail/E0297.rs b/src/test/compile-fail/E0297.rs index 436e4c1f9d22e..afe4444c7afdf 100644 --- a/src/test/compile-fail/E0297.rs +++ b/src/test/compile-fail/E0297.rs @@ -13,5 +13,4 @@ fn main() { for Some(x) in xs {} //~^ ERROR E0005 - //~| NOTE pattern `None` not covered } diff --git a/src/test/compile-fail/E0301.rs b/src/test/compile-fail/E0301.rs index b7872509f5408..06e98289b0d57 100644 --- a/src/test/compile-fail/E0301.rs +++ b/src/test/compile-fail/E0301.rs @@ -12,7 +12,6 @@ fn main() { match Some(()) { None => { }, option if option.take().is_none() => {}, //~ ERROR E0301 - //~| NOTE borrowed mutably in pattern guard Some(_) => { } } } diff --git a/src/test/compile-fail/E0302.rs b/src/test/compile-fail/E0302.rs index 5ad74fd6cab05..6a5ad40b10907 100644 --- a/src/test/compile-fail/E0302.rs +++ b/src/test/compile-fail/E0302.rs @@ -12,7 +12,6 @@ fn main() { match Some(()) { None => { }, option if { option = None; false } => { }, //~ ERROR E0302 - //~| NOTE assignment in pattern guard Some(_) => { } } } diff --git a/src/test/compile-fail/E0303.rs b/src/test/compile-fail/E0303.rs index e631fe2a8a7cc..6027414fdbd4b 100644 --- a/src/test/compile-fail/E0303.rs +++ b/src/test/compile-fail/E0303.rs @@ -12,10 +12,7 @@ fn main() { match Some("hi".to_string()) { ref op_string_ref @ Some(s) => {}, //~^ ERROR pattern bindings are not allowed after an `@` [E0303] - //~| NOTE not allowed after `@` //~| ERROR E0009 - //~| NOTE by-move pattern here - //~| NOTE both by-ref and by-move used None => {}, } } diff --git a/src/test/compile-fail/E0365.rs b/src/test/compile-fail/E0365.rs index ea5fd6ed4772f..a1efcde42b05b 100644 --- a/src/test/compile-fail/E0365.rs +++ b/src/test/compile-fail/E0365.rs @@ -14,7 +14,5 @@ mod foo { pub use foo as foo2; //~^ ERROR `foo` is private, and cannot be reexported [E0365] -//~| NOTE reexport of private `foo` -//~| NOTE consider declaring type or module `foo` with `pub` fn main() {} diff --git a/src/test/compile-fail/E0375.rs b/src/test/compile-fail/E0375.rs index 29d8e920c4ce7..094ed35cc2d6d 100644 --- a/src/test/compile-fail/E0375.rs +++ b/src/test/compile-fail/E0375.rs @@ -21,8 +21,5 @@ struct Foo { impl CoerceUnsized> for Foo {} //~^ ERROR E0375 -//~| NOTE requires multiple coercions -//~| NOTE `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced -//~| NOTE currently, 2 fields need coercions: b (T to U), c (U to T) fn main() {} diff --git a/src/test/compile-fail/E0389.rs b/src/test/compile-fail/E0389.rs index 584dfd5fa440c..445831bf8d7f7 100644 --- a/src/test/compile-fail/E0389.rs +++ b/src/test/compile-fail/E0389.rs @@ -16,6 +16,5 @@ fn main() { let mut fancy = FancyNum{ num: 5 }; let fancy_ref = &(&mut fancy); fancy_ref.num = 6; //~ ERROR E0389 - //~^ NOTE assignment into an immutable reference println!("{}", fancy_ref.num); } diff --git a/src/test/compile-fail/E0392.rs b/src/test/compile-fail/E0392.rs index a21e500e519bb..4c3efcf4e8d75 100644 --- a/src/test/compile-fail/E0392.rs +++ b/src/test/compile-fail/E0392.rs @@ -9,7 +9,6 @@ // except according to those terms. enum Foo { Bar } //~ ERROR E0392 - //~| NOTE unused type parameter fn main() { } diff --git a/src/test/compile-fail/E0393.rs b/src/test/compile-fail/E0393.rs index f045e873519cd..9165bc2837b51 100644 --- a/src/test/compile-fail/E0393.rs +++ b/src/test/compile-fail/E0393.rs @@ -12,8 +12,6 @@ trait A {} fn together_we_will_rule_the_galaxy(son: &A) {} //~^ ERROR E0393 -//~| NOTE missing reference to `T` -//~| NOTE because of the default `Self` reference, type parameters must be specified on object types fn main() { } diff --git a/src/test/compile-fail/E0394.rs b/src/test/compile-fail/E0394.rs index c7d5665cd2c58..dae8e14c5ef18 100644 --- a/src/test/compile-fail/E0394.rs +++ b/src/test/compile-fail/E0394.rs @@ -13,8 +13,6 @@ static A: u32 = 0; static B: u32 = A; //~^ ERROR E0394 -//~| NOTE referring to another static by value -//~| NOTE use the address-of operator or a constant instead fn main() { } diff --git a/src/test/compile-fail/E0395.rs b/src/test/compile-fail/E0395.rs index 98f08cd68c22d..00008ea6b6f37 100644 --- a/src/test/compile-fail/E0395.rs +++ b/src/test/compile-fail/E0395.rs @@ -12,6 +12,5 @@ static FOO: i32 = 42; static BAR: i32 = 42; static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395 - //~| NOTE comparing raw pointers in static fn main() { } diff --git a/src/test/compile-fail/E0396.rs b/src/test/compile-fail/E0396.rs index 47080fb6e9ef7..7f34acdfb9007 100644 --- a/src/test/compile-fail/E0396.rs +++ b/src/test/compile-fail/E0396.rs @@ -11,7 +11,6 @@ const REG_ADDR: *const u8 = 0x5f3759df as *const u8; const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396 - //~| NOTE dereference of raw pointer in constant fn main() { } diff --git a/src/test/compile-fail/E0403.rs b/src/test/compile-fail/E0403.rs index cd8532fc4c305..6a68013dc6ffe 100644 --- a/src/test/compile-fail/E0403.rs +++ b/src/test/compile-fail/E0403.rs @@ -9,8 +9,6 @@ // except according to those terms. fn foo(s: T, u: T) {} //~ ERROR E0403 - //~| NOTE already used - //~| NOTE first use of `T` fn main() { } diff --git a/src/test/compile-fail/E0407.rs b/src/test/compile-fail/E0407.rs index c207dbfca5565..41d8b4513ce53 100644 --- a/src/test/compile-fail/E0407.rs +++ b/src/test/compile-fail/E0407.rs @@ -18,7 +18,6 @@ impl Foo for Bar { fn a() {} fn b() {} //~^ ERROR E0407 - //~| NOTE not a member of trait `Foo` } fn main() { diff --git a/src/test/compile-fail/E0408.rs b/src/test/compile-fail/E0408.rs index ce77a537e263d..8ddeb20afdc1e 100644 --- a/src/test/compile-fail/E0408.rs +++ b/src/test/compile-fail/E0408.rs @@ -13,7 +13,6 @@ fn main() { match x { Some(y) | None => {} //~ ERROR variable `y` is not bound in all patterns - _ => () //~| NOTE pattern doesn't bind `y` - //~| NOTE variable not in all patterns + _ => () } } diff --git a/src/test/compile-fail/E0426.rs b/src/test/compile-fail/E0426.rs index be21421cb0781..d6261d3a74e15 100644 --- a/src/test/compile-fail/E0426.rs +++ b/src/test/compile-fail/E0426.rs @@ -12,6 +12,5 @@ fn main () { loop { break 'a; //~^ ERROR E0426 - //~| NOTE undeclared label `'a` } } diff --git a/src/test/compile-fail/E0428.rs b/src/test/compile-fail/E0428.rs index 4042219b5cc1a..3c709f3a39922 100644 --- a/src/test/compile-fail/E0428.rs +++ b/src/test/compile-fail/E0428.rs @@ -10,8 +10,6 @@ struct Bar; //~ previous definition of the type `Bar` here struct Bar; //~ ERROR E0428 - //~| NOTE `Bar` redefined here - //~| NOTE `Bar` must be defined only once in the type namespace of this module fn main () { } diff --git a/src/test/compile-fail/E0435.rs b/src/test/compile-fail/E0435.rs index 50a6d174e222a..5246fda6aaf6f 100644 --- a/src/test/compile-fail/E0435.rs +++ b/src/test/compile-fail/E0435.rs @@ -11,5 +11,4 @@ fn main () { let foo = 42u32; let _: [u8; foo]; //~ ERROR E0435 - //~| NOTE non-constant value } diff --git a/src/test/compile-fail/E0437.rs b/src/test/compile-fail/E0437.rs index 62ee8dc346492..7440a82773e7a 100644 --- a/src/test/compile-fail/E0437.rs +++ b/src/test/compile-fail/E0437.rs @@ -12,7 +12,6 @@ trait Foo {} impl Foo for i32 { type Bar = bool; //~ ERROR E0437 - //~| NOTE not a member of trait `Foo` } fn main () { diff --git a/src/test/compile-fail/E0438.rs b/src/test/compile-fail/E0438.rs index 99e0dbbcea804..61d25134993f0 100644 --- a/src/test/compile-fail/E0438.rs +++ b/src/test/compile-fail/E0438.rs @@ -13,7 +13,6 @@ trait Bar {} impl Bar for i32 { const BAR: bool = true; //~ ERROR E0438 - //~| NOTE not a member of trait `Bar` } fn main () { diff --git a/src/test/compile-fail/E0445.rs b/src/test/compile-fail/E0445.rs index efef8305e5354..a1447e7ebcddc 100644 --- a/src/test/compile-fail/E0445.rs +++ b/src/test/compile-fail/E0445.rs @@ -14,12 +14,9 @@ trait Foo { pub trait Bar : Foo {} //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE private trait can't be public pub struct Bar2(pub T); //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE private trait can't be public pub fn foo (t: T) {} //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE private trait can't be public fn main() {} diff --git a/src/test/compile-fail/E0446.rs b/src/test/compile-fail/E0446.rs index 493a272261776..c576661828471 100644 --- a/src/test/compile-fail/E0446.rs +++ b/src/test/compile-fail/E0446.rs @@ -12,7 +12,6 @@ mod Foo { struct Bar(u32); pub fn bar() -> Bar { //~ ERROR E0446 - //~| NOTE can't leak private type Bar(0) } } diff --git a/src/test/compile-fail/E0449.rs b/src/test/compile-fail/E0449.rs index 0b3fdb9e6abe6..ac365db33e5cd 100644 --- a/src/test/compile-fail/E0449.rs +++ b/src/test/compile-fail/E0449.rs @@ -15,13 +15,9 @@ trait Foo { } pub impl Bar {} //~ ERROR E0449 - //~| NOTE `pub` not needed here - //~| NOTE place qualifiers on individual impl items instead pub impl Foo for Bar { //~ ERROR E0449 - //~| NOTE `pub` not needed here pub fn foo() {} //~ ERROR E0449 - //~| NOTE `pub` not needed here } fn main() { diff --git a/src/test/compile-fail/E0451.rs b/src/test/compile-fail/E0451.rs index ace96c9983e66..af4e7d628bb25 100644 --- a/src/test/compile-fail/E0451.rs +++ b/src/test/compile-fail/E0451.rs @@ -22,10 +22,8 @@ mod Bar { fn pat_match(foo: Bar::Foo) { let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451 - //~^ NOTE field `b` is private } fn main() { let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 - //~^ NOTE field `b` is private } diff --git a/src/test/compile-fail/E0453.rs b/src/test/compile-fail/E0453.rs index 6fed3dca94ef1..8e51b84bab8e6 100644 --- a/src/test/compile-fail/E0453.rs +++ b/src/test/compile-fail/E0453.rs @@ -9,10 +9,8 @@ // except according to those terms. #![forbid(non_snake_case)] -//~^ NOTE `forbid` level set here #[allow(non_snake_case)] //~^ ERROR allow(non_snake_case) overruled by outer forbid(non_snake_case) -//~| NOTE overruled by previous forbid fn main() { } diff --git a/src/test/compile-fail/E0454.rs b/src/test/compile-fail/E0454.rs index 39887927c885f..afd0f5f5e461e 100644 --- a/src/test/compile-fail/E0454.rs +++ b/src/test/compile-fail/E0454.rs @@ -10,7 +10,6 @@ #[link(name = "")] extern {} //~^ ERROR E0454 -//~| NOTE empty name given fn main() { } diff --git a/src/test/compile-fail/E0458.rs b/src/test/compile-fail/E0458.rs index e87158ae3b03f..fea27ef811586 100644 --- a/src/test/compile-fail/E0458.rs +++ b/src/test/compile-fail/E0458.rs @@ -9,9 +9,7 @@ // except according to those terms. #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 - //~| NOTE unknown kind //~| ERROR E0459 - //~| NOTE missing `name` argument fn main() { } diff --git a/src/test/compile-fail/E0459.rs b/src/test/compile-fail/E0459.rs index 41376bd9ef5a2..dc7ac714f2239 100644 --- a/src/test/compile-fail/E0459.rs +++ b/src/test/compile-fail/E0459.rs @@ -9,7 +9,6 @@ // except according to those terms. #[link(kind = "dylib")] extern {} //~ ERROR E0459 - //~| NOTE missing `name` argument fn main() { } diff --git a/src/test/compile-fail/E0463.rs b/src/test/compile-fail/E0463.rs index 3ce5b83e89fd4..aae83975b22f8 100644 --- a/src/test/compile-fail/E0463.rs +++ b/src/test/compile-fail/E0463.rs @@ -11,7 +11,6 @@ #![feature(plugin)] #![plugin(cookie_monster)] //~^ ERROR E0463 -//~| NOTE can't find crate extern crate cake_is_a_lie; fn main() { diff --git a/src/test/compile-fail/E0496.rs b/src/test/compile-fail/E0496.rs index 8aeeeebcb5676..4ca3cd9c13da6 100644 --- a/src/test/compile-fail/E0496.rs +++ b/src/test/compile-fail/E0496.rs @@ -13,9 +13,7 @@ struct Foo<'a> { } impl<'a> Foo<'a> { - //~^ NOTE first declared here fn f<'a>(x: &'a i32) { //~ ERROR E0496 - //~^ NOTE lifetime 'a already in scope } } diff --git a/src/test/compile-fail/E0517.rs b/src/test/compile-fail/E0517.rs index 7feda670f52a3..561223ccdf11e 100644 --- a/src/test/compile-fail/E0517.rs +++ b/src/test/compile-fail/E0517.rs @@ -9,16 +9,16 @@ // except according to those terms. #[repr(C)] //~ ERROR: E0517 -type Foo = u8; //~ NOTE: not a struct, enum or union +type Foo = u8; #[repr(packed)] //~ ERROR: E0517 -enum Foo2 {Bar, Baz} //~ NOTE: not a struct +enum Foo2 {Bar, Baz} #[repr(u8)] //~ ERROR: E0517 -struct Foo3 {bar: bool, baz: bool} //~ NOTE: not an enum +struct Foo3 {bar: bool, baz: bool} #[repr(C)] //~ ERROR: E0517 -impl Foo3 { //~ NOTE: not a struct, enum or union +impl Foo3 { } fn main() { diff --git a/src/test/compile-fail/E0518.rs b/src/test/compile-fail/E0518.rs index 63d40db0049da..6d5b6e48e0dab 100644 --- a/src/test/compile-fail/E0518.rs +++ b/src/test/compile-fail/E0518.rs @@ -9,10 +9,10 @@ // except according to those terms. #[inline(always)] //~ ERROR: E0518 -struct Foo; //~ NOTE: not a function +struct Foo; #[inline(never)] //~ ERROR: E0518 -impl Foo { //~ NOTE: not a function +impl Foo { } fn main() { diff --git a/src/test/compile-fail/E0520.rs b/src/test/compile-fail/E0520.rs index ff6152d377f67..eae5b11a81904 100644 --- a/src/test/compile-fail/E0520.rs +++ b/src/test/compile-fail/E0520.rs @@ -19,15 +19,12 @@ impl SpaceLlama for T { } impl SpaceLlama for T { -//~^ NOTE parent `impl` is here fn fly(&self) {} } impl SpaceLlama for i32 { default fn fly(&self) {} //~^ ERROR E0520 - //~| NOTE cannot specialize default item `fly` - //~| NOTE `fly` in the parent `impl` must be marked `default` } fn main() { diff --git a/src/test/compile-fail/E0527.rs b/src/test/compile-fail/E0527.rs index 0b664094a40d7..67d222e867e63 100644 --- a/src/test/compile-fail/E0527.rs +++ b/src/test/compile-fail/E0527.rs @@ -15,7 +15,6 @@ fn main() { match r { &[a, b] => { //~^ ERROR E0527 - //~| NOTE expected 4 elements println!("a={}, b={}", a, b); } } diff --git a/src/test/compile-fail/E0528.rs b/src/test/compile-fail/E0528.rs index e912650f11292..e2aa2c067cbcd 100644 --- a/src/test/compile-fail/E0528.rs +++ b/src/test/compile-fail/E0528.rs @@ -15,7 +15,6 @@ fn main() { match r { &[a, b, c, rest..] => { //~^ ERROR E0528 - //~| NOTE pattern cannot match array of 2 elements } } } diff --git a/src/test/compile-fail/E0529.rs b/src/test/compile-fail/E0529.rs index 18d3e68816aad..5262ad7b716f5 100644 --- a/src/test/compile-fail/E0529.rs +++ b/src/test/compile-fail/E0529.rs @@ -15,7 +15,6 @@ fn main() { match r { [a, b] => { //~^ ERROR E0529 - //~| NOTE pattern cannot match with input type `f32` } } } diff --git a/src/test/compile-fail/E0558.rs b/src/test/compile-fail/E0558.rs index 0c2ca69849166..64a6ee4cf5872 100644 --- a/src/test/compile-fail/E0558.rs +++ b/src/test/compile-fail/E0558.rs @@ -10,7 +10,6 @@ #[export_name] //~^ ERROR E0558 -//~| NOTE did you mean #[export_name="*"]? pub fn something() {} diff --git a/src/test/compile-fail/E0559.rs b/src/test/compile-fail/E0559.rs index e8b0915d2b533..da0f692cc2839 100644 --- a/src/test/compile-fail/E0559.rs +++ b/src/test/compile-fail/E0559.rs @@ -15,6 +15,4 @@ enum Field { fn main() { let s = Field::Fool { joke: 0 }; //~^ ERROR E0559 - //~| NOTE `Field::Fool` does not have this field - //~| NOTE available fields are: `x` } diff --git a/src/test/compile-fail/E0560.rs b/src/test/compile-fail/E0560.rs index 955ef7ca99ceb..bbb7f08d62e35 100644 --- a/src/test/compile-fail/E0560.rs +++ b/src/test/compile-fail/E0560.rs @@ -15,6 +15,4 @@ struct Simba { fn main() { let s = Simba { mother: 1, father: 0 }; //~^ ERROR E0560 - //~| NOTE `Simba` does not have this field - //~| NOTE available fields are: `mother` } diff --git a/src/test/compile-fail/E0605.rs b/src/test/compile-fail/E0605.rs index add3fd8fd8ac2..4b5b8beb36865 100644 --- a/src/test/compile-fail/E0605.rs +++ b/src/test/compile-fail/E0605.rs @@ -11,9 +11,7 @@ fn main() { let x = 0u8; x as Vec; //~ ERROR E0605 - //~| NOTE an `as` expression can only be used to convert between primitive types let v = 0 as *const u8; v as &u8; //~ ERROR E0605 - //~| NOTE an `as` expression can only be used to convert between primitive types } diff --git a/src/test/compile-fail/E0618.rs b/src/test/compile-fail/E0618.rs index 1ba2e8e2e5613..f28ac200dea5a 100644 --- a/src/test/compile-fail/E0618.rs +++ b/src/test/compile-fail/E0618.rs @@ -14,7 +14,6 @@ enum X { fn main() { X::Entry(); //~ ERROR expected function, found `X::Entry` [E0618] - //~| HELP did you mean to write `X::Entry`? let x = 0i32; x(); //~ ERROR expected function, found `i32` [E0618] } diff --git a/src/test/compile-fail/trait-suggest-where-clause.rs b/src/test/compile-fail/trait-suggest-where-clause.rs deleted file mode 100644 index 2c38d8d2e28ba..0000000000000 --- a/src/test/compile-fail/trait-suggest-where-clause.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2016 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::mem; - -struct Misc(T); - -fn check() { - // suggest a where-clause, if needed - mem::size_of::(); - //~^ ERROR `U: std::marker::Sized` is not satisfied - //~| HELP consider adding a `where U: std::marker::Sized` bound - //~| NOTE required by `std::mem::size_of` - //~| NOTE `U` does not have a constant size known at compile-time - //~| HELP the trait `std::marker::Sized` is not implemented for `U` - - mem::size_of::>(); - //~^ ERROR `U: std::marker::Sized` is not satisfied - //~| HELP consider adding a `where U: std::marker::Sized` bound - //~| NOTE required because it appears within the type `Misc` - //~| NOTE required by `std::mem::size_of` - //~| NOTE `U` does not have a constant size known at compile-time - //~| HELP within `Misc`, the trait `std::marker::Sized` is not implemented for `U` - - // ... even if T occurs as a type parameter - - >::from; - //~^ ERROR `u64: std::convert::From` is not satisfied - //~| HELP consider adding a `where u64: std::convert::From` bound - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From` is not implemented for `u64` - - ::Item>>::from; - //~^ ERROR `u64: std::convert::From<::Item>` is not satisfied - //~| HELP consider adding a `where u64: - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From<::Item>` is not implemented - - // ... but not if there are inference variables - - as From>::from; - //~^ ERROR `Misc<_>: std::convert::From` is not satisfied - //~| NOTE required by `std::convert::From::from` - //~| NOTE the trait `std::convert::From` is not implemented for `Misc<_>` - - // ... and also not if the error is not related to the type - - mem::size_of::<[T]>(); - //~^ ERROR `[T]: std::marker::Sized` is not satisfied - //~| NOTE `[T]` does not have a constant size - //~| NOTE required by `std::mem::size_of` - //~| HELP the trait `std::marker::Sized` is not implemented for `[T]` - - mem::size_of::<[&U]>(); - //~^ ERROR `[&U]: std::marker::Sized` is not satisfied - //~| NOTE `[&U]` does not have a constant size - //~| NOTE required by `std::mem::size_of` - //~| HELP the trait `std::marker::Sized` is not implemented for `[&U]` -} - -fn main() { -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs similarity index 87% rename from src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs rename to src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index 75a025f064852..21b8057431b86 100644 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -14,14 +14,11 @@ #![feature(plugin)] #![plugin(lint_plugin_test)] #![forbid(test_lint)] -//~^ NOTE lint level defined here -//~| NOTE `forbid` level set here fn lintme() { } //~ ERROR item is named 'lintme' #[allow(test_lint)] //~^ ERROR allow(test_lint) overruled by outer forbid(test_lint) -//~| NOTE overruled by previous forbid pub fn main() { lintme(); } diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr new file mode 100644 index 0000000000000..459be9db578af --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -0,0 +1,23 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-attrs.rs:18:1 + | +18 | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-plugin-forbid-attrs.rs:16:11 + | +16 | #![forbid(test_lint)] + | ^^^^^^^^^ + +error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) + --> $DIR/lint-plugin-forbid-attrs.rs:20:9 + | +16 | #![forbid(test_lint)] + | --------- `forbid` level set here +... +20 | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-panic.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs similarity index 100% rename from src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-panic.rs rename to src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs diff --git a/src/test/compile-fail-fulldeps/proc-macro/load-panic.rs b/src/test/ui-fulldeps/proc-macro/load-panic.rs similarity index 95% rename from src/test/compile-fail-fulldeps/proc-macro/load-panic.rs rename to src/test/ui-fulldeps/proc-macro/load-panic.rs index c483c048b418f..328f398efd5c6 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/load-panic.rs +++ b/src/test/ui-fulldeps/proc-macro/load-panic.rs @@ -15,7 +15,6 @@ extern crate derive_panic; #[derive(A)] //~^ ERROR: proc-macro derive panicked -//~| HELP: message: nope! struct Foo; fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/load-panic.stderr b/src/test/ui-fulldeps/proc-macro/load-panic.stderr new file mode 100644 index 0000000000000..1be1609d45b2b --- /dev/null +++ b/src/test/ui-fulldeps/proc-macro/load-panic.stderr @@ -0,0 +1,8 @@ +error: proc-macro derive panicked + --> $DIR/load-panic.rs:16:10 + | +16 | #[derive(A)] + | ^ + | + = help: message: nope! + diff --git a/src/test/compile-fail-fulldeps/proc-macro/signature.rs b/src/test/ui-fulldeps/proc-macro/signature.rs similarity index 82% rename from src/test/compile-fail-fulldeps/proc-macro/signature.rs rename to src/test/ui-fulldeps/proc-macro/signature.rs index e249c9e9aa262..f2ea6f778cd26 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/signature.rs +++ b/src/test/ui-fulldeps/proc-macro/signature.rs @@ -16,7 +16,5 @@ extern crate proc_macro; #[proc_macro_derive(A)] pub unsafe extern fn foo(a: i32, b: u32) -> u32 { //~^ ERROR: mismatched types - //~| NOTE: expected normal fn, found unsafe fn - //~| NOTE: expected type `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` loop {} } diff --git a/src/test/ui-fulldeps/proc-macro/signature.stderr b/src/test/ui-fulldeps/proc-macro/signature.stderr new file mode 100644 index 0000000000000..2beb0aac8626e --- /dev/null +++ b/src/test/ui-fulldeps/proc-macro/signature.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/signature.rs:17:1 + | +17 | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 { +18 | | //~^ ERROR: mismatched types +19 | | loop {} +20 | | } + | |_^ expected normal fn, found unsafe fn + | + = note: expected type `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` + found type `unsafe extern "C" fn(i32, u32) -> u32 {foo}` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/update-all-references.sh b/src/test/ui-fulldeps/update-all-references.sh new file mode 100644 index 0000000000000..bfc6f923f9d2e --- /dev/null +++ b/src/test/ui-fulldeps/update-all-references.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# 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 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# A script to update the references for all tests. The idea is that +# you do a run, which will generate files in the build directory +# containing the (normalized) actual output of the compiler. You then +# run this script, which will copy those files over. If you find +# yourself manually editing a foo.stderr file, you're doing it wrong. +# +# See all `update-references.sh`, if you just want to update a single test. + +if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" != "" ]]; then + echo "usage: $0 " + echo "" + echo "For example:" + echo " $0 ../../../build/x86_64-apple-darwin/test/ui" +fi + +BUILD_DIR=$PWD/$1 +MY_DIR=$(dirname $0) +cd $MY_DIR +find . -name '*.rs' | xargs ./update-references.sh $BUILD_DIR diff --git a/src/test/ui-fulldeps/update-references.sh b/src/test/ui-fulldeps/update-references.sh new file mode 100644 index 0000000000000..b9ded7d1e951c --- /dev/null +++ b/src/test/ui-fulldeps/update-references.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# 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 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +# A script to update the references for particular tests. The idea is +# that you do a run, which will generate files in the build directory +# containing the (normalized) actual output of the compiler. This +# script will then copy that output and replace the "expected output" +# files. You can then commit the changes. +# +# If you find yourself manually editing a foo.stderr file, you're +# doing it wrong. + +if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then + echo "usage: $0 " + echo "" + echo "For example:" + echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" +fi + +MYDIR=$(dirname $0) + +BUILD_DIR="$1" +shift + +while [[ "$1" != "" ]]; do + STDERR_NAME="${1/%.rs/.stderr}" + STDOUT_NAME="${1/%.rs/.stdout}" + shift + if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ + ! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then + echo updating $MYDIR/$STDOUT_NAME + cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME + fi + if [ -f $BUILD_DIR/$STDERR_NAME ] && \ + ! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then + echo updating $MYDIR/$STDERR_NAME + cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME + fi +done + + diff --git a/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs b/src/test/ui/arbitrary-self-types-not-object-safe.rs similarity index 77% rename from src/test/compile-fail/arbitrary-self-types-not-object-safe.rs rename to src/test/ui/arbitrary-self-types-not-object-safe.rs index 6b10739bd8e59..48918b996ef59 100644 --- a/src/test/compile-fail/arbitrary-self-types-not-object-safe.rs +++ b/src/test/ui/arbitrary-self-types-not-object-safe.rs @@ -39,12 +39,7 @@ impl Bar for usize { fn make_foo() { let x = Box::new(5usize) as Box; //~^ ERROR E0038 - //~| NOTE method `foo` has a non-standard `self` type - //~| NOTE the trait `Foo` cannot be made into an object //~| ERROR E0038 - //~| NOTE method `foo` has a non-standard `self` type - //~| NOTE the trait `Foo` cannot be made into an object - //~| NOTE requirements on the impl of `std::ops::CoerceUnsized>` } fn make_bar() { diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/arbitrary-self-types-not-object-safe.stderr new file mode 100644 index 0000000000000..a1090fe031eb9 --- /dev/null +++ b/src/test/ui/arbitrary-self-types-not-object-safe.stderr @@ -0,0 +1,19 @@ +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:40:33 + | +40 | let x = Box::new(5usize) as Box; + | ^^^^^^^^ the trait `Foo` cannot be made into an object + | + = note: method `foo` has a non-standard `self` type. Only `&self`, `&mut self`, and `Box` are currently supported for trait objects + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/arbitrary-self-types-not-object-safe.rs:40:13 + | +40 | let x = Box::new(5usize) as Box; + | ^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object + | + = note: method `foo` has a non-standard `self` type. Only `&self`, `&mut self`, and `Box` are currently supported for trait objects + = note: required because of the requirements on the impl of `std::ops::CoerceUnsized>` for `std::boxed::Box` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/ui/asm-out-assign-imm.rs similarity index 92% rename from src/test/compile-fail/asm-out-assign-imm.rs rename to src/test/ui/asm-out-assign-imm.rs index f2629fa52ffdd..49084e01a15db 100644 --- a/src/test/compile-fail/asm-out-assign-imm.rs +++ b/src/test/ui/asm-out-assign-imm.rs @@ -23,12 +23,11 @@ fn foo(x: isize) { println!("{}", x); } target_arch = "aarch64"))] pub fn main() { let x: isize; - x = 1; //~ NOTE first assignment + x = 1; foo(x); unsafe { asm!("mov $1, $0" : "=r"(x) : "r"(5)); //~^ ERROR cannot assign twice to immutable variable `x` - //~| NOTE cannot assign twice to immutable } foo(x); } diff --git a/src/test/ui/asm-out-assign-imm.stderr b/src/test/ui/asm-out-assign-imm.stderr new file mode 100644 index 0000000000000..cf5486fec5f93 --- /dev/null +++ b/src/test/ui/asm-out-assign-imm.stderr @@ -0,0 +1,11 @@ +error[E0384]: cannot assign twice to immutable variable `x` + --> $DIR/asm-out-assign-imm.rs:29:9 + | +26 | x = 1; + | ----- first assignment to `x` +... +29 | asm!("mov $1, $0" : "=r"(x) : "r"(5)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs b/src/test/ui/associated-const-impl-wrong-lifetime.rs similarity index 77% rename from src/test/compile-fail/associated-const-impl-wrong-lifetime.rs rename to src/test/ui/associated-const-impl-wrong-lifetime.rs index 51681a4bb880b..77653b27fb538 100644 --- a/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs +++ b/src/test/ui/associated-const-impl-wrong-lifetime.rs @@ -15,12 +15,8 @@ trait Foo { impl<'a> Foo for &'a () { -//~^ NOTE the lifetime 'a as defined const NAME: &'a str = "unit"; //~^ ERROR mismatched types [E0308] - //~| NOTE lifetime mismatch - //~| NOTE expected type `&'static str` - //~| NOTE ...does not necessarily outlive the static lifetime } fn main() {} diff --git a/src/test/ui/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-const-impl-wrong-lifetime.stderr new file mode 100644 index 0000000000000..a7aee9b19f1a1 --- /dev/null +++ b/src/test/ui/associated-const-impl-wrong-lifetime.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/associated-const-impl-wrong-lifetime.rs:18:5 + | +18 | const NAME: &'a str = "unit"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `&'static str` + found type `&'a str` +note: the lifetime 'a as defined on the impl at 17:1... + --> $DIR/associated-const-impl-wrong-lifetime.rs:17:1 + | +17 | / impl<'a> Foo for &'a () { +18 | | const NAME: &'a str = "unit"; +19 | | //~^ ERROR mismatched types [E0308] +20 | | } + | |_^ + = note: ...does not necessarily outlive the static lifetime + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-const-impl-wrong-type.rs b/src/test/ui/associated-const-impl-wrong-type.rs similarity index 88% rename from src/test/compile-fail/associated-const-impl-wrong-type.rs rename to src/test/ui/associated-const-impl-wrong-type.rs index e38851ccd6ff6..240dfd160974b 100644 --- a/src/test/compile-fail/associated-const-impl-wrong-type.rs +++ b/src/test/ui/associated-const-impl-wrong-type.rs @@ -10,7 +10,7 @@ trait Foo { - const BAR: u32; //~ NOTE type in trait + const BAR: u32; } struct SignedBar; @@ -18,7 +18,6 @@ struct SignedBar; impl Foo for SignedBar { const BAR: i32 = -1; //~^ ERROR implemented const `BAR` has an incompatible type for trait [E0326] - //~| NOTE expected u32, found i32 } fn main() {} diff --git a/src/test/ui/associated-const-impl-wrong-type.stderr b/src/test/ui/associated-const-impl-wrong-type.stderr new file mode 100644 index 0000000000000..a2afe905cb505 --- /dev/null +++ b/src/test/ui/associated-const-impl-wrong-type.stderr @@ -0,0 +1,11 @@ +error[E0326]: implemented const `BAR` has an incompatible type for trait + --> $DIR/associated-const-impl-wrong-type.rs:19:16 + | +13 | const BAR: u32; + | --- type in trait +... +19 | const BAR: i32 = -1; + | ^^^ expected u32, found i32 + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type-projection-from-multiple-supertraits.rs similarity index 71% rename from src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs rename to src/test/ui/associated-type-projection-from-multiple-supertraits.rs index b33bbfd84258f..5536566c61992 100644 --- a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type-projection-from-multiple-supertraits.rs @@ -13,18 +13,12 @@ pub trait Vehicle { type Color; - //~^ NOTE ambiguous `Color` from `Vehicle` - //~| NOTE ambiguous `Color` from `Vehicle` - //~| NOTE ambiguous `Color` from `Vehicle` fn go(&self) { } } pub trait Box { type Color; - //~^ NOTE ambiguous `Color` from `Box` - //~| NOTE ambiguous `Color` from `Box` - //~| NOTE ambiguous `Color` from `Box` // fn mail(&self) { } } @@ -34,19 +28,15 @@ pub trait BoxCar : Box + Vehicle { fn dent(c: C, color: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE ambiguous associated type `Color` } fn dent_object(c: BoxCar) { //~^ ERROR ambiguous associated type //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified - //~| NOTE ambiguous associated type `Color` - //~| NOTE missing associated type `Color` value } fn paint(c: C, d: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` - //~| NOTE ambiguous associated type `Color` } pub fn main() { } diff --git a/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr new file mode 100644 index 0000000000000..6215c1dc089d2 --- /dev/null +++ b/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr @@ -0,0 +1,44 @@ +error[E0221]: ambiguous associated type `Color` in bounds of `C` + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:29:32 + | +15 | type Color; + | ----------- ambiguous `Color` from `Vehicle` +... +21 | type Color; + | ----------- ambiguous `Color` from `Box` +... +29 | fn dent(c: C, color: C::Color) { + | ^^^^^^^^ ambiguous associated type `Color` + +error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar` + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:33 + | +15 | type Color; + | ----------- ambiguous `Color` from `Vehicle` +... +21 | type Color; + | ----------- ambiguous `Color` from `Box` +... +33 | fn dent_object(c: BoxCar) { + | ^^^^^^^^^^^ ambiguous associated type `Color` + +error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:26 + | +33 | fn dent_object(c: BoxCar) { + | ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value + +error[E0221]: ambiguous associated type `Color` in bounds of `C` + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29 + | +15 | type Color; + | ----------- ambiguous `Color` from `Vehicle` +... +21 | type Color; + | ----------- ambiguous `Color` from `Box` +... +38 | fn paint(c: C, d: C::Color) { + | ^^^^^^^^ ambiguous associated type `Color` + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs similarity index 93% rename from src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs rename to src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs index 74a388e726991..75b60aa8d10b7 100644 --- a/src/test/compile-fail/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs @@ -32,5 +32,4 @@ fn ice(a: A) { let r = loop {}; r = r + a; //~^ ERROR the trait bound `(): Add` is not satisfied - //~| NOTE the trait `Add` is not implemented for `()` } diff --git a/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr new file mode 100644 index 0000000000000..1a49cc7a283bb --- /dev/null +++ b/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr @@ -0,0 +1,8 @@ +error[E0277]: the trait bound `(): Add` is not satisfied + --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11 + | +33 | r = r + a; + | ^ the trait `Add` is not implemented for `()` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/associated-types-in-ambiguous-context.rs b/src/test/ui/associated-types-in-ambiguous-context.rs similarity index 71% rename from src/test/compile-fail/associated-types-in-ambiguous-context.rs rename to src/test/ui/associated-types-in-ambiguous-context.rs index ff886e63dc59e..becbc27138b77 100644 --- a/src/test/compile-fail/associated-types-in-ambiguous-context.rs +++ b/src/test/ui/associated-types-in-ambiguous-context.rs @@ -15,21 +15,15 @@ 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/ui/associated-types-in-ambiguous-context.stderr b/src/test/ui/associated-types-in-ambiguous-context.stderr new file mode 100644 index 0000000000000..b0196234bda04 --- /dev/null +++ b/src/test/ui/associated-types-in-ambiguous-context.stderr @@ -0,0 +1,26 @@ +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:16:36 + | +16 | fn get(x: T, y: U) -> Get::Value {} + | ^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `::Value` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:25:10 + | +25 | type X = std::ops::Deref::Target; + | ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `::Target` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:21:23 + | +21 | fn grab(&self) -> Grab::Value; + | ^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `::Value` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/augmented-assignments.rs b/src/test/ui/augmented-assignments.rs similarity index 94% rename from src/test/compile-fail/augmented-assignments.rs rename to src/test/ui/augmented-assignments.rs index 736aa465aa732..82f5c49eeb7ae 100644 --- a/src/test/compile-fail/augmented-assignments.rs +++ b/src/test/ui/augmented-assignments.rs @@ -22,7 +22,6 @@ fn main() { let mut x = Int(1); x //~ error: use of moved value: `x` //~^ value used here after move - //~| note: move occurs because `x` has type `Int` += x; //~ value moved here diff --git a/src/test/ui/augmented-assignments.stderr b/src/test/ui/augmented-assignments.stderr new file mode 100644 index 0000000000000..0367270d16676 --- /dev/null +++ b/src/test/ui/augmented-assignments.stderr @@ -0,0 +1,22 @@ +error[E0596]: cannot borrow immutable local variable `y` as mutable + --> $DIR/augmented-assignments.rs:30:5 + | +28 | let y = Int(2); + | - consider changing this to `mut y` +29 | //~^ consider changing this to `mut y` +30 | y //~ error: cannot borrow immutable local variable `y` as mutable + | ^ cannot borrow mutably + +error[E0382]: use of moved value: `x` + --> $DIR/augmented-assignments.rs:23:5 + | +23 | x //~ error: use of moved value: `x` + | ^ value used here after move +... +26 | x; //~ value moved here + | - value moved here + | + = note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/auxiliary/changing-crates-a1.rs b/src/test/ui/auxiliary/changing-crates-a1.rs similarity index 100% rename from src/test/compile-fail/auxiliary/changing-crates-a1.rs rename to src/test/ui/auxiliary/changing-crates-a1.rs diff --git a/src/test/compile-fail/auxiliary/changing-crates-a2.rs b/src/test/ui/auxiliary/changing-crates-a2.rs similarity index 100% rename from src/test/compile-fail/auxiliary/changing-crates-a2.rs rename to src/test/ui/auxiliary/changing-crates-a2.rs diff --git a/src/test/compile-fail/auxiliary/changing-crates-b.rs b/src/test/ui/auxiliary/changing-crates-b.rs similarity index 100% rename from src/test/compile-fail/auxiliary/changing-crates-b.rs rename to src/test/ui/auxiliary/changing-crates-b.rs diff --git a/src/test/ui/auxiliary/coherence_lib.rs b/src/test/ui/auxiliary/coherence_lib.rs new file mode 100644 index 0000000000000..daa123849e4e7 --- /dev/null +++ b/src/test/ui/auxiliary/coherence_lib.rs @@ -0,0 +1,25 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub trait Remote { + fn foo(&self) { } +} + +pub trait Remote1 { + fn foo(&self, t: T) { } +} + +pub trait Remote2 { + fn foo(&self, t: T, u: U) { } +} + +pub struct Pair(T,U); diff --git a/src/test/ui/auxiliary/empty-struct.rs b/src/test/ui/auxiliary/empty-struct.rs new file mode 100644 index 0000000000000..4a30286563422 --- /dev/null +++ b/src/test/ui/auxiliary/empty-struct.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct XEmpty1 {} +pub struct XEmpty2; +pub struct XEmpty6(); + +pub enum XE { + XEmpty3 {}, + XEmpty4, + XEmpty5(), +} diff --git a/src/test/compile-fail/auxiliary/issue-36708.rs b/src/test/ui/auxiliary/issue-36708.rs similarity index 100% rename from src/test/compile-fail/auxiliary/issue-36708.rs rename to src/test/ui/auxiliary/issue-36708.rs diff --git a/src/test/ui/auxiliary/lint_output_format.rs b/src/test/ui/auxiliary/lint_output_format.rs new file mode 100644 index 0000000000000..0553b4a49b7ae --- /dev/null +++ b/src/test/ui/auxiliary/lint_output_format.rs @@ -0,0 +1,30 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="lint_output_format"] +#![crate_type = "lib"] +#![feature(staged_api)] +#![unstable(feature = "test_feature", issue = "0")] + +#[stable(feature = "test_feature", since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0", reason = "text")] +pub fn foo() -> usize { + 20 +} + +#[unstable(feature = "test_feature", issue = "0")] +pub fn bar() -> usize { + 40 +} + +#[unstable(feature = "test_feature", issue = "0")] +pub fn baz() -> usize { + 30 +} diff --git a/src/test/ui/auxiliary/struct_field_privacy.rs b/src/test/ui/auxiliary/struct_field_privacy.rs new file mode 100644 index 0000000000000..5fea97da03ee3 --- /dev/null +++ b/src/test/ui/auxiliary/struct_field_privacy.rs @@ -0,0 +1,19 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct A { + a: isize, + pub b: isize, +} + +pub struct B { + pub a: isize, + b: isize, +} diff --git a/src/test/compile-fail/auxiliary/svh-a-base.rs b/src/test/ui/auxiliary/svh-a-base.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-base.rs rename to src/test/ui/auxiliary/svh-a-base.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-lit.rs b/src/test/ui/auxiliary/svh-a-change-lit.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-lit.rs rename to src/test/ui/auxiliary/svh-a-change-lit.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs b/src/test/ui/auxiliary/svh-a-change-significant-cfg.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-significant-cfg.rs rename to src/test/ui/auxiliary/svh-a-change-significant-cfg.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs b/src/test/ui/auxiliary/svh-a-change-trait-bound.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-trait-bound.rs rename to src/test/ui/auxiliary/svh-a-change-trait-bound.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs b/src/test/ui/auxiliary/svh-a-change-type-arg.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-type-arg.rs rename to src/test/ui/auxiliary/svh-a-change-type-arg.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs b/src/test/ui/auxiliary/svh-a-change-type-ret.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-type-ret.rs rename to src/test/ui/auxiliary/svh-a-change-type-ret.rs diff --git a/src/test/compile-fail/auxiliary/svh-a-change-type-static.rs b/src/test/ui/auxiliary/svh-a-change-type-static.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-a-change-type-static.rs rename to src/test/ui/auxiliary/svh-a-change-type-static.rs diff --git a/src/test/compile-fail/auxiliary/svh-b.rs b/src/test/ui/auxiliary/svh-b.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-b.rs rename to src/test/ui/auxiliary/svh-b.rs diff --git a/src/test/compile-fail/auxiliary/svh-uta-base.rs b/src/test/ui/auxiliary/svh-uta-base.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-uta-base.rs rename to src/test/ui/auxiliary/svh-uta-base.rs diff --git a/src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs b/src/test/ui/auxiliary/svh-uta-change-use-trait.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-uta-change-use-trait.rs rename to src/test/ui/auxiliary/svh-uta-change-use-trait.rs diff --git a/src/test/compile-fail/auxiliary/svh-utb.rs b/src/test/ui/auxiliary/svh-utb.rs similarity index 100% rename from src/test/compile-fail/auxiliary/svh-utb.rs rename to src/test/ui/auxiliary/svh-utb.rs diff --git a/src/test/ui/auxiliary/two_macros.rs b/src/test/ui/auxiliary/two_macros.rs new file mode 100644 index 0000000000000..060960f0dbc88 --- /dev/null +++ b/src/test/ui/auxiliary/two_macros.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_export] +macro_rules! macro_one { () => ("one") } + +#[macro_export] +macro_rules! macro_two { () => ("two") } diff --git a/src/test/compile-fail/binary-op-on-double-ref.rs b/src/test/ui/binary-op-on-double-ref.rs similarity index 80% rename from src/test/compile-fail/binary-op-on-double-ref.rs rename to src/test/ui/binary-op-on-double-ref.rs index 23ca026f541dd..8b31be911b89a 100644 --- a/src/test/compile-fail/binary-op-on-double-ref.rs +++ b/src/test/ui/binary-op-on-double-ref.rs @@ -13,8 +13,6 @@ fn main() { let vr = v.iter().filter(|x| { x % 2 == 0 //~^ ERROR binary operation `%` cannot be applied to type `&&{integer}` - //~| NOTE this is a reference to a type that `%` can be applied to - //~| NOTE an implementation of `std::ops::Rem` might be missing for `&&{integer}` }); println!("{:?}", vr); } diff --git a/src/test/ui/binary-op-on-double-ref.stderr b/src/test/ui/binary-op-on-double-ref.stderr new file mode 100644 index 0000000000000..4a2490bac91ab --- /dev/null +++ b/src/test/ui/binary-op-on-double-ref.stderr @@ -0,0 +1,11 @@ +error[E0369]: binary operation `%` cannot be applied to type `&&{integer}` + --> $DIR/binary-op-on-double-ref.rs:14:9 + | +14 | x % 2 == 0 + | ^^^^^ + | + = note: this is a reference to a type that `%` can be applied to; you need to dereference this variable once for this operation to work + = note: an implementation of `std::ops::Rem` might be missing for `&&{integer}` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/blind-item-item-shadow.rs b/src/test/ui/blind-item-item-shadow.rs similarity index 78% rename from src/test/compile-fail/blind-item-item-shadow.rs rename to src/test/ui/blind-item-item-shadow.rs index af3abe5e0569a..38f9a552e1b04 100644 --- a/src/test/compile-fail/blind-item-item-shadow.rs +++ b/src/test/ui/blind-item-item-shadow.rs @@ -8,11 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -mod foo { pub mod foo { } } //~ NOTE previous definition of the module `foo` here +mod foo { pub mod foo { } } use foo::foo; //~^ ERROR the name `foo` is defined multiple times //~| `foo` reimported here -//~| NOTE `foo` must be defined only once in the type namespace of this module fn main() {} diff --git a/src/test/ui/blind-item-item-shadow.stderr b/src/test/ui/blind-item-item-shadow.stderr new file mode 100644 index 0000000000000..b9f3e742c66f4 --- /dev/null +++ b/src/test/ui/blind-item-item-shadow.stderr @@ -0,0 +1,17 @@ +error[E0255]: the name `foo` is defined multiple times + --> $DIR/blind-item-item-shadow.rs:13:5 + | +11 | mod foo { pub mod foo { } } + | ---------------------------- previous definition of the module `foo` here +12 | +13 | use foo::foo; + | ^^^^^^^^ `foo` reimported here + | + = note: `foo` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +13 | use foo::foo as Otherfoo; + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/block-result/consider-removing-last-semi.rs b/src/test/ui/block-result/consider-removing-last-semi.rs index 530a0e4156228..0d4deb3c8041b 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.rs +++ b/src/test/ui/block-result/consider-removing-last-semi.rs @@ -10,12 +10,12 @@ fn f() -> String { //~ ERROR mismatched types 0u8; - "bla".to_string(); //~ HELP consider removing this semicolon + "bla".to_string(); } fn g() -> String { //~ ERROR mismatched types "this won't work".to_string(); - "removeme".to_string(); //~ HELP consider removing this semicolon + "removeme".to_string(); } fn main() {} diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr index 5905cfa9322a2..453f3879f4ba2 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.stderr +++ b/src/test/ui/block-result/consider-removing-last-semi.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types 11 | fn f() -> String { //~ ERROR mismatched types | __________________^ 12 | | 0u8; -13 | | "bla".to_string(); //~ HELP consider removing this semicolon +13 | | "bla".to_string(); | | - help: consider removing this semicolon 14 | | } | |_^ expected struct `std::string::String`, found () @@ -18,7 +18,7 @@ error[E0308]: mismatched types 16 | fn g() -> String { //~ ERROR mismatched types | __________________^ 17 | | "this won't work".to_string(); -18 | | "removeme".to_string(); //~ HELP consider removing this semicolon +18 | | "removeme".to_string(); | | - help: consider removing this semicolon 19 | | } | |_^ expected struct `std::string::String`, found () diff --git a/src/test/ui/block-result/issue-11714.rs b/src/test/ui/block-result/issue-11714.rs index 255eb771694cc..bc3936582aae9 100644 --- a/src/test/ui/block-result/issue-11714.rs +++ b/src/test/ui/block-result/issue-11714.rs @@ -11,7 +11,7 @@ fn blah() -> i32 { //~ ERROR mismatched types 1 - ; //~ HELP consider removing this semicolon + ; } fn main() { } diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr index 4daf40e6172f6..946d18048944f 100644 --- a/src/test/ui/block-result/issue-11714.stderr +++ b/src/test/ui/block-result/issue-11714.stderr @@ -5,7 +5,7 @@ error[E0308]: mismatched types | __________________^ 12 | | 1 13 | | -14 | | ; //~ HELP consider removing this semicolon +14 | | ; | | - help: consider removing this semicolon 15 | | } | |_^ expected i32, found () diff --git a/src/test/ui/block-result/issue-13428.rs b/src/test/ui/block-result/issue-13428.rs index 9406199afc231..36520301f552d 100644 --- a/src/test/ui/block-result/issue-13428.rs +++ b/src/test/ui/block-result/issue-13428.rs @@ -15,12 +15,12 @@ fn foo() -> String { //~ ERROR mismatched types "world") // Put the trailing semicolon on its own line to test that the // note message gets the offending semicolon exactly - ; //~ HELP consider removing this semicolon + ; } fn bar() -> String { //~ ERROR mismatched types "foobar".to_string() - ; //~ HELP consider removing this semicolon + ; } pub fn main() {} diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr index 7bd4529c46399..22bbb2aadf61c 100644 --- a/src/test/ui/block-result/issue-13428.stderr +++ b/src/test/ui/block-result/issue-13428.stderr @@ -7,7 +7,7 @@ error[E0308]: mismatched types 15 | | "world") 16 | | // Put the trailing semicolon on its own line to test that the 17 | | // note message gets the offending semicolon exactly -18 | | ; //~ HELP consider removing this semicolon +18 | | ; | | - help: consider removing this semicolon 19 | | } | |_^ expected struct `std::string::String`, found () @@ -21,7 +21,7 @@ error[E0308]: mismatched types 21 | fn bar() -> String { //~ ERROR mismatched types | ____________________^ 22 | | "foobar".to_string() -23 | | ; //~ HELP consider removing this semicolon +23 | | ; | | - help: consider removing this semicolon 24 | | } | |_^ expected struct `std::string::String`, found () diff --git a/src/test/compile-fail/bogus-tag.rs b/src/test/ui/bogus-tag.rs similarity index 89% rename from src/test/compile-fail/bogus-tag.rs rename to src/test/ui/bogus-tag.rs index a629f76d8b3e9..46536cc85750c 100644 --- a/src/test/compile-fail/bogus-tag.rs +++ b/src/test/ui/bogus-tag.rs @@ -10,7 +10,6 @@ enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } -//~^ NOTE variant `hsl` not found here fn main() { let red: color = color::rgb(255, 0, 0); @@ -18,6 +17,5 @@ fn main() { color::rgb(r, g, b) => { println!("rgb"); } color::hsl(h, s, l) => { println!("hsl"); } //~^ ERROR no variant - //~| NOTE variant not found in `color` } } diff --git a/src/test/ui/bogus-tag.stderr b/src/test/ui/bogus-tag.stderr new file mode 100644 index 0000000000000..49dedcd074279 --- /dev/null +++ b/src/test/ui/bogus-tag.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant named `hsl` found for type `color` in the current scope + --> $DIR/bogus-tag.rs:18:7 + | +12 | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } + | ---------- variant `hsl` not found here +... +18 | color::hsl(h, s, l) => { println!("hsl"); } + | ^^^^^^^^^^^^^^^^^^^ variant not found in `color` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs b/src/test/ui/borrowck/borrowck-box-insensitivity.rs similarity index 85% rename from src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs rename to src/test/ui/borrowck/borrowck-box-insensitivity.rs index d09cb73d6702a..75bf6bce04b39 100644 --- a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs +++ b/src/test/ui/borrowck/borrowck-box-insensitivity.rs @@ -60,7 +60,6 @@ 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 //~| move out of @@ -69,15 +68,12 @@ fn move_after_borrow() { 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 - //~^ NOTE use of borrowed `a.x` } 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 //~| move out of @@ -86,27 +82,22 @@ fn move_after_mut_borrow() { fn borrow_after_mut_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &mut a.x; - //~^ NOTE mutable borrow occurs here (via `a.x`) let _y = &a.y; //~ ERROR cannot borrow //~^ immutable borrow occurs here (via `a.y`) } -//~^ NOTE mutable borrow ends here fn mut_borrow_after_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &a.x; - //~^ NOTE immutable borrow occurs here (via `a.x`) let _y = &mut a.y; //~ ERROR cannot borrow //~^ mutable borrow occurs here (via `a.y`) } -//~^ NOTE immutable 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; //~^ value moved here let _y = a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box` //~| value used here after move } @@ -115,7 +106,6 @@ fn move_after_move_nested() { let _x = a.x.x; //~^ value moved here let _y = a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box` //~| value used here after move } @@ -124,7 +114,6 @@ fn borrow_after_move_nested() { let _x = a.x.x; //~^ value moved here let _y = &a.y; //~ ERROR use of collaterally moved - //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box` //~| value used here after move } @@ -140,15 +129,12 @@ fn move_after_borrow_nested() { 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 - //~^ NOTE use of borrowed `a.x.x` } 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 //~| move out of @@ -161,7 +147,6 @@ fn borrow_after_mut_borrow_nested() { let _y = &a.y; //~ ERROR cannot borrow //~^ immutable borrow occurs here } -//~^ NOTE mutable 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 }; @@ -170,7 +155,6 @@ fn mut_borrow_after_borrow_nested() { let _y = &mut a.y; //~ ERROR cannot borrow //~^ mutable borrow occurs here } -//~^ NOTE immutable borrow ends here fn main() { copy_after_move(); diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.stderr b/src/test/ui/borrowck/borrowck-box-insensitivity.stderr new file mode 100644 index 0000000000000..88e8490843d31 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-box-insensitivity.stderr @@ -0,0 +1,163 @@ +error[E0382]: use of moved value: `a` + --> $DIR/borrowck-box-insensitivity.rs:37:9 + | +35 | let _x = a.x; + | -- value moved here +36 | //~^ value moved here +37 | let _y = a.y; //~ ERROR use of moved + | ^^ value used here after move + | + = note: move occurs because `a.x` has type `std::boxed::Box`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `a` + --> $DIR/borrowck-box-insensitivity.rs:46:9 + | +44 | let _x = a.x; + | -- value moved here +45 | //~^ value moved here +46 | let _y = a.y; //~ ERROR use of moved + | ^^ value used here after move + | + = note: move occurs because `a.x` has type `std::boxed::Box`, which does not implement the `Copy` trait + +error[E0382]: use of moved value: `a` + --> $DIR/borrowck-box-insensitivity.rs:55:15 + | +53 | let _x = a.x; + | -- value moved here +54 | //~^ value moved here +55 | let _y = &a.y; //~ ERROR use of moved + | ^^^ value used here after move + | + = note: move occurs because `a.x` has type `std::boxed::Box`, which does not implement the `Copy` trait + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:63:9 + | +62 | let _x = &a.x; + | --- borrow of `a.x` occurs here +63 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0503]: cannot use `a.y` because it was mutably borrowed + --> $DIR/borrowck-box-insensitivity.rs:71:9 + | +70 | let _x = &mut a.x; + | --- borrow of `a.x` occurs here +71 | let _y = a.y; //~ ERROR cannot use + | ^^ use of borrowed `a.x` + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:77:9 + | +76 | let _x = &mut a.x; + | --- borrow of `a.x` occurs here +77 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0502]: cannot borrow `a` (via `a.y`) as immutable because `a` is also borrowed as mutable (via `a.x`) + --> $DIR/borrowck-box-insensitivity.rs:85:15 + | +84 | let _x = &mut a.x; + | --- mutable borrow occurs here (via `a.x`) +85 | let _y = &a.y; //~ ERROR cannot borrow + | ^^^ immutable borrow occurs here (via `a.y`) +86 | //~^ immutable borrow occurs here (via `a.y`) +87 | } + | - mutable borrow ends here + +error[E0502]: cannot borrow `a` (via `a.y`) as mutable because `a` is also borrowed as immutable (via `a.x`) + --> $DIR/borrowck-box-insensitivity.rs:92:19 + | +91 | let _x = &a.x; + | --- immutable borrow occurs here (via `a.x`) +92 | let _y = &mut a.y; //~ ERROR cannot borrow + | ^^^ mutable borrow occurs here (via `a.y`) +93 | //~^ mutable borrow occurs here (via `a.y`) +94 | } + | - immutable borrow ends here + +error[E0382]: use of collaterally moved value: `a.y` + --> $DIR/borrowck-box-insensitivity.rs:100:9 + | +98 | let _x = a.x.x; + | -- value moved here +99 | //~^ value moved here +100 | let _y = a.y; //~ ERROR use of collaterally moved + | ^^ value used here after move + | + = note: move occurs because `a.x.x` has type `std::boxed::Box`, which does not implement the `Copy` trait + +error[E0382]: use of collaterally moved value: `a.y` + --> $DIR/borrowck-box-insensitivity.rs:108:9 + | +106 | let _x = a.x.x; + | -- value moved here +107 | //~^ value moved here +108 | let _y = a.y; //~ ERROR use of collaterally moved + | ^^ value used here after move + | + = note: move occurs because `a.x.x` has type `std::boxed::Box`, which does not implement the `Copy` trait + +error[E0382]: use of collaterally moved value: `a.y` + --> $DIR/borrowck-box-insensitivity.rs:116:15 + | +114 | let _x = a.x.x; + | -- value moved here +115 | //~^ value moved here +116 | let _y = &a.y; //~ ERROR use of collaterally moved + | ^^^ value used here after move + | + = note: move occurs because `a.x.x` has type `std::boxed::Box`, which does not implement the `Copy` trait + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:124:9 + | +122 | let _x = &a.x.x; + | ----- borrow of `a.x.x` occurs here +123 | //~^ borrow of `a.x.x` occurs here +124 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0503]: cannot use `a.y` because it was mutably borrowed + --> $DIR/borrowck-box-insensitivity.rs:132:9 + | +131 | let _x = &mut a.x.x; + | ----- borrow of `a.x.x` occurs here +132 | let _y = a.y; //~ ERROR cannot use + | ^^ use of borrowed `a.x.x` + +error[E0505]: cannot move out of `a.y` because it is borrowed + --> $DIR/borrowck-box-insensitivity.rs:138:9 + | +137 | let _x = &mut a.x.x; + | ----- borrow of `a.x.x` occurs here +138 | let _y = a.y; + | ^^ move out of `a.y` occurs here + +error[E0502]: cannot borrow `a.y` as immutable because `a.x.x` is also borrowed as mutable + --> $DIR/borrowck-box-insensitivity.rs:147:15 + | +145 | let _x = &mut a.x.x; + | ----- mutable borrow occurs here +146 | //~^ mutable borrow occurs here +147 | let _y = &a.y; //~ ERROR cannot borrow + | ^^^ immutable borrow occurs here +148 | //~^ immutable borrow occurs here +149 | } + | - mutable borrow ends here + +error[E0502]: cannot borrow `a.y` as mutable because `a.x.x` is also borrowed as immutable + --> $DIR/borrowck-box-insensitivity.rs:155:19 + | +153 | let _x = &a.x.x; + | ----- immutable borrow occurs here +154 | //~^ immutable borrow occurs here +155 | let _y = &mut a.y; //~ ERROR cannot borrow + | ^^^ mutable borrow occurs here +156 | //~^ mutable borrow occurs here +157 | } + | - immutable borrow ends here + +error: aborting due to 16 previous errors + diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs similarity index 91% rename from src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs rename to src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs index ec330247f238b..87e40df7663ba 100644 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-1.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs @@ -22,6 +22,4 @@ fn main() { let mut books = vec![1,2,3]; spawn(|| books.push(4)); //~^ ERROR E0373 - //~| NOTE `books` is borrowed here - //~| NOTE may outlive borrowed value `books` } diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr new file mode 100644 index 0000000000000..cc0bd15c489ea --- /dev/null +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr @@ -0,0 +1,14 @@ +error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function + --> $DIR/borrowck-escaping-closure-error-1.rs:23:11 + | +23 | spawn(|| books.push(4)); + | ^^ ----- `books` is borrowed here + | | + | may outlive borrowed value `books` +help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword + | +23 | spawn(move || books.push(4)); + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs similarity index 91% rename from src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs rename to src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs index 81685c32f2f29..67700be890b1f 100644 --- a/src/test/compile-fail/borrowck/borrowck-escaping-closure-error-2.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs @@ -20,8 +20,6 @@ fn foo<'a>(x: &'a i32) -> Box { let mut books = vec![1,2,3]; Box::new(|| books.push(4)) //~^ ERROR E0373 - //~| NOTE `books` is borrowed here - //~| NOTE may outlive borrowed value `books` } fn main() { } diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr new file mode 100644 index 0000000000000..f8963c175c8ab --- /dev/null +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr @@ -0,0 +1,14 @@ +error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function + --> $DIR/borrowck-escaping-closure-error-2.rs:21:14 + | +21 | Box::new(|| books.push(4)) + | ^^ ----- `books` is borrowed here + | | + | may outlive borrowed value `books` +help: to force the closure to take ownership of `books` (and any other referenced variables), use the `move` keyword + | +21 | Box::new(move || books.push(4)) + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/borrowck-in-static.rs b/src/test/ui/borrowck/borrowck-in-static.rs index b30234811acb2..16b0e8638de39 100644 --- a/src/test/ui/borrowck/borrowck-in-static.rs +++ b/src/test/ui/borrowck/borrowck-in-static.rs @@ -11,9 +11,8 @@ // check that borrowck looks inside consts/statics static FN : &'static (Fn() -> (BoxBox>) + Sync) = &|| { - let x = Box::new(0); //~ NOTE captured outer variable + let x = Box::new(0); Box::new(|| x) //~ ERROR cannot move out of captured outer variable - //~^ NOTE cannot move out of captured outer variable }; fn main() { diff --git a/src/test/ui/borrowck/borrowck-in-static.stderr b/src/test/ui/borrowck/borrowck-in-static.stderr index 92ca36e117e60..6e47c46cdec94 100644 --- a/src/test/ui/borrowck/borrowck-in-static.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure --> $DIR/borrowck-in-static.rs:15:17 | -14 | let x = Box::new(0); //~ NOTE captured outer variable +14 | let x = Box::new(0); | - captured outer variable 15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable | ^ cannot move out of captured outer variable in an `Fn` closure diff --git a/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs b/src/test/ui/borrowck/borrowck-move-error-with-note.rs similarity index 82% rename from src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs rename to src/test/ui/borrowck/borrowck-move-error-with-note.rs index 5d9c9d0bd4615..e0491159a687e 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.rs @@ -20,9 +20,9 @@ fn blah() { let f = &Foo::Foo1(box 1, box 2); match *f { //~ ERROR cannot move out of //~| cannot move out - Foo::Foo1(num1, //~ NOTE to prevent move - num2) => (), //~ NOTE and here - Foo::Foo2(num) => (), //~ NOTE and here + Foo::Foo1(num1, + num2) => (), + Foo::Foo2(num) => (), Foo::Foo3 => () } } @@ -39,8 +39,8 @@ fn move_in_match() { match (S {f: "foo".to_string(), g: "bar".to_string()}) { S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait //~| cannot move out of here - f: _s, //~ NOTE to prevent move - g: _t //~ NOTE and here + f: _s, + g: _t } => {} } } @@ -56,7 +56,7 @@ fn blah2() { let a = &A { a: box 1 }; match a.a { //~ ERROR cannot move out of //~| cannot move out - n => { //~ NOTE to prevent move + n => { free(n) } } diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr new file mode 100644 index 0000000000000..c16c80345d513 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr @@ -0,0 +1,36 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/borrowck-move-error-with-note.rs:21:11 + | +21 | match *f { //~ ERROR cannot move out of + | ^^ cannot move out of borrowed content +22 | //~| cannot move out +23 | Foo::Foo1(num1, + | ---- hint: to prevent move, use `ref num1` or `ref mut num1` +24 | num2) => (), + | ---- ...and here (use `ref num2` or `ref mut num2`) +25 | Foo::Foo2(num) => (), + | --- ...and here (use `ref num` or `ref mut num`) + +error[E0509]: cannot move out of type `S`, which implements the `Drop` trait + --> $DIR/borrowck-move-error-with-note.rs:40:9 + | +40 | / S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait +41 | | //~| cannot move out of here +42 | | f: _s, + | | -- hint: to prevent move, use `ref _s` or `ref mut _s` +43 | | g: _t + | | -- ...and here (use `ref _t` or `ref mut _t`) +44 | | } => {} + | |_________^ cannot move out of here + +error[E0507]: cannot move out of borrowed content + --> $DIR/borrowck-move-error-with-note.rs:57:11 + | +57 | match a.a { //~ ERROR cannot move out of + | ^ cannot move out of borrowed content +58 | //~| cannot move out +59 | n => { + | - hint: to prevent move, use `ref n` or `ref mut n` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs similarity index 97% rename from src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs rename to src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs index 311208f07b88d..938ce3f2cb880 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-vec-tail.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs @@ -32,7 +32,6 @@ pub fn main() { //~| cannot move out //~| to prevent move Foo { string: b }] => { - //~^ NOTE and here } _ => { unreachable!(); diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr new file mode 100644 index 0000000000000..f99bbb20ccdf1 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -0,0 +1,17 @@ +error[E0508]: cannot move out of type `[Foo]`, a non-copy slice + --> $DIR/borrowck-move-out-of-vec-tail.rs:30:18 + | +30 | &[Foo { string: a }, + | ^ - hint: to prevent move, use `ref a` or `ref mut a` + | __________________| + | | +31 | | //~^ ERROR cannot move out of type `[Foo]` +32 | | //~| cannot move out +33 | | //~| to prevent move +34 | | Foo { string: b }] => { + | |_________________________________-__^ cannot move out of here + | | + | ...and here (use `ref b` or `ref mut b`) + +error: aborting due to previous error + diff --git a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs similarity index 92% rename from src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs rename to src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs index 3ca8cc431e098..a6553160557e4 100644 --- a/src/test/compile-fail/borrowck/borrowck-report-with-custom-diagnostic.rs +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs @@ -17,7 +17,6 @@ fn main() { let z = &x; //~ ERROR cannot borrow //~^ immutable borrow occurs here } -//~^ NOTE mutable borrow ends here fn foo() { match true { @@ -29,7 +28,6 @@ fn foo() { let z = &mut x; //~ ERROR cannot borrow //~^ mutable borrow occurs here } - //~^ NOTE immutable borrow ends here false => () } } @@ -43,5 +41,4 @@ fn bar() { let z = &mut x; //~ ERROR cannot borrow //~^ second mutable borrow occurs here }; - //~^ NOTE first borrow ends here } diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr new file mode 100644 index 0000000000000..fb6917141fc97 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr @@ -0,0 +1,38 @@ +error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-report-with-custom-diagnostic.rs:17:14 + | +15 | let y = &mut x; + | - mutable borrow occurs here +16 | //~^ mutable borrow occurs here +17 | let z = &x; //~ ERROR cannot borrow + | ^ immutable borrow occurs here +18 | //~^ immutable borrow occurs here +19 | } + | - mutable borrow ends here + +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-report-with-custom-diagnostic.rs:28:26 + | +26 | let y = &x; + | - immutable borrow occurs here +27 | //~^ immutable borrow occurs here +28 | let z = &mut x; //~ ERROR cannot borrow + | ^ mutable borrow occurs here +29 | //~^ mutable borrow occurs here +30 | } + | - immutable borrow ends here + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/borrowck-report-with-custom-diagnostic.rs:41:22 + | +39 | let y = &mut x; + | - first mutable borrow occurs here +40 | //~^ first mutable borrow occurs here +41 | let z = &mut x; //~ ERROR cannot borrow + | ^ second mutable borrow occurs here +42 | //~^ second mutable borrow occurs here +43 | }; + | - first borrow ends here + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs similarity index 94% rename from src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs rename to src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index 98bb6b14b945c..07b268f1a4b01 100644 --- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -63,7 +63,7 @@ fn d() { match vec { &mut [ //~ ERROR cannot move out //~^ cannot move out - _b] => {} //~ NOTE to prevent move + _b] => {} _ => {} } let a = vec[0]; //~ ERROR cannot move out @@ -76,9 +76,6 @@ fn e() { match vec { &mut [_a, _b, _c] => {} //~ ERROR cannot move out //~| cannot move out - //~| NOTE to prevent move - //~| NOTE and here - //~| NOTE and here _ => {} } let a = vec[0]; //~ ERROR cannot move out diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr new file mode 100644 index 0000000000000..899ffb446b96b --- /dev/null +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -0,0 +1,82 @@ +error[E0506]: cannot assign to `vec[..]` because it is borrowed + --> $DIR/borrowck-vec-pattern-nesting.rs:21:13 + | +19 | [box ref _a, _, _] => { + | ------ borrow of `vec[..]` occurs here +20 | //~^ borrow of `vec[..]` occurs here +21 | vec[0] = box 4; //~ ERROR cannot assign + | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here + +error[E0506]: cannot assign to `vec[..]` because it is borrowed + --> $DIR/borrowck-vec-pattern-nesting.rs:33:13 + | +31 | &mut [ref _b..] => { + | ------ borrow of `vec[..]` occurs here +32 | //~^ borrow of `vec[..]` occurs here +33 | vec[0] = box 4; //~ ERROR cannot assign + | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here + +error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:43:14 + | +43 | &mut [_a, //~ ERROR cannot move out + | ^-- hint: to prevent move, use `ref _a` or `ref mut _a` + | ______________| + | | +44 | | //~| cannot move out +45 | | //~| to prevent move +46 | | .. +47 | | ] => { + | |_________^ cannot move out of here + +error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:56:13 + | +56 | let a = vec[0]; //~ ERROR cannot move out + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` + +error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:64:14 + | +64 | &mut [ //~ ERROR cannot move out + | ______________^ +65 | | //~^ cannot move out +66 | | _b] => {} + | |__________--^ cannot move out of here + | | + | hint: to prevent move, use `ref _b` or `ref mut _b` + +error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:69:13 + | +69 | let a = vec[0]; //~ ERROR cannot move out + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` + +error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:77:14 + | +77 | &mut [_a, _b, _c] => {} //~ ERROR cannot move out + | ^--^^--^^--^ + | || | | + | || | ...and here (use `ref _c` or `ref mut _c`) + | || ...and here (use `ref _b` or `ref mut _b`) + | |hint: to prevent move, use `ref _a` or `ref mut _a` + | cannot move out of here + +error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice + --> $DIR/borrowck-vec-pattern-nesting.rs:81:13 + | +81 | let a = vec[0]; //~ ERROR cannot move out + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs index 788d68caa524e..cd9f1636c3f4d 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs @@ -16,10 +16,9 @@ fn call(f: F) where F : Fn() { } fn main() { - let y = vec![format!("World")]; //~ NOTE captured outer variable + let y = vec![format!("World")]; call(|| { y.into_iter(); //~^ ERROR cannot move out of captured outer variable in an `Fn` closure - //~| NOTE cannot move out of }); } diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index 895ce1ba31803..6aa0846f53e26 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9 | -19 | let y = vec![format!("World")]; //~ NOTE captured outer variable +19 | let y = vec![format!("World")]; | - captured outer variable 20 | call(|| { 21 | y.into_iter(); diff --git a/src/test/compile-fail/cast-as-bool.rs b/src/test/ui/cast-as-bool.rs similarity index 93% rename from src/test/compile-fail/cast-as-bool.rs rename to src/test/ui/cast-as-bool.rs index af42d5c275c75..68e26c23e4432 100644 --- a/src/test/compile-fail/cast-as-bool.rs +++ b/src/test/ui/cast-as-bool.rs @@ -11,5 +11,4 @@ fn main() { let u = 5 as bool; //~^ ERROR cannot cast as `bool` - //~| HELP compare with zero instead } diff --git a/src/test/ui/cast-as-bool.stderr b/src/test/ui/cast-as-bool.stderr new file mode 100644 index 0000000000000..346ebf07fc3f5 --- /dev/null +++ b/src/test/ui/cast-as-bool.stderr @@ -0,0 +1,10 @@ +error[E0054]: cannot cast as `bool` + --> $DIR/cast-as-bool.rs:12:13 + | +12 | let u = 5 as bool; + | ^^^^^^^^^ unsupported cast + | + = help: compare with zero instead + +error: aborting due to previous error + diff --git a/src/test/compile-fail/cast-rfc0401-2.rs b/src/test/ui/cast-rfc0401-2.rs similarity index 95% rename from src/test/compile-fail/cast-rfc0401-2.rs rename to src/test/ui/cast-rfc0401-2.rs index 1598a9aa1fc41..0dac707688d66 100644 --- a/src/test/compile-fail/cast-rfc0401-2.rs +++ b/src/test/ui/cast-rfc0401-2.rs @@ -15,5 +15,4 @@ fn main() { let _ = 3 as bool; //~^ ERROR cannot cast as `bool` - //~| HELP compare with zero } diff --git a/src/test/ui/cast-rfc0401-2.stderr b/src/test/ui/cast-rfc0401-2.stderr new file mode 100644 index 0000000000000..1febe6a618fde --- /dev/null +++ b/src/test/ui/cast-rfc0401-2.stderr @@ -0,0 +1,10 @@ +error[E0054]: cannot cast as `bool` + --> $DIR/cast-rfc0401-2.rs:16:13 + | +16 | let _ = 3 as bool; + | ^^^^^^^^^ unsupported cast + | + = help: compare with zero instead + +error: aborting due to previous error + diff --git a/src/test/compile-fail/changing-crates.rs b/src/test/ui/changing-crates.rs similarity index 88% rename from src/test/compile-fail/changing-crates.rs rename to src/test/ui/changing-crates.rs index 89310706b52ed..5963a58a2d2f9 100644 --- a/src/test/compile-fail/changing-crates.rs +++ b/src/test/ui/changing-crates.rs @@ -14,10 +14,9 @@ // aux-build:changing-crates-a1.rs // aux-build:changing-crates-b.rs // aux-build:changing-crates-a2.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: the following crate versions were found -//~| NOTE: perhaps that crate needs to be recompiled fn main() {} diff --git a/src/test/ui/changing-crates.stderr b/src/test/ui/changing-crates.stderr new file mode 100644 index 0000000000000..50287fa3fde9f --- /dev/null +++ b/src/test/ui/changing-crates.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/changing-crates.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/ui/closure_context/issue-42065.rs b/src/test/ui/closure_context/issue-42065.rs index 276c6a941b299..9daa76d858ffb 100644 --- a/src/test/ui/closure_context/issue-42065.rs +++ b/src/test/ui/closure_context/issue-42065.rs @@ -14,13 +14,10 @@ fn main() { let dict: HashMap = HashMap::new(); let debug_dump_dict = || { for (key, value) in dict { - //~^ NOTE closure cannot be invoked more than once println!("{:?} - {:?}", key, value); } }; debug_dump_dict(); - //~^ NOTE: value moved here debug_dump_dict(); //~^ ERROR use of moved value: `debug_dump_dict` - //~| NOTE value used here after move } diff --git a/src/test/ui/closure_context/issue-42065.stderr b/src/test/ui/closure_context/issue-42065.stderr index b31322f6d168d..c195940ade6fa 100644 --- a/src/test/ui/closure_context/issue-42065.stderr +++ b/src/test/ui/closure_context/issue-42065.stderr @@ -1,10 +1,9 @@ error[E0382]: use of moved value: `debug_dump_dict` - --> $DIR/issue-42065.rs:23:5 + --> $DIR/issue-42065.rs:21:5 | -21 | debug_dump_dict(); +20 | debug_dump_dict(); | --------------- value moved here -22 | //~^ NOTE: value moved here -23 | debug_dump_dict(); +21 | debug_dump_dict(); | ^^^^^^^^^^^^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `dict` out of its environment diff --git a/src/test/compile-fail/coherence-error-suppression.rs b/src/test/ui/coherence-error-suppression.rs similarity index 100% rename from src/test/compile-fail/coherence-error-suppression.rs rename to src/test/ui/coherence-error-suppression.rs diff --git a/src/test/ui/coherence-error-suppression.stderr b/src/test/ui/coherence-error-suppression.stderr new file mode 100644 index 0000000000000..57b746f19e856 --- /dev/null +++ b/src/test/ui/coherence-error-suppression.stderr @@ -0,0 +1,8 @@ +error[E0412]: cannot find type `DoesNotExist` in this scope + --> $DIR/coherence-error-suppression.rs:19:14 + | +19 | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-impls-copy.rs b/src/test/ui/coherence-impls-copy.rs similarity index 66% rename from src/test/compile-fail/coherence-impls-copy.rs rename to src/test/ui/coherence-impls-copy.rs index fe121a3bc48ff..51f43d27c34d2 100644 --- a/src/test/compile-fail/coherence-impls-copy.rs +++ b/src/test/ui/coherence-impls-copy.rs @@ -28,36 +28,22 @@ impl Copy for MyType {} impl Copy for &'static mut MyType {} //~^ 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 the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead impl Copy for &'static NotSync {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration impl Copy for [MyType] {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead -//~| NOTE impl doesn't use types inside crate impl Copy for &'static [NotSync] {} //~^ ERROR the trait `Copy` may not be implemented for this type -//~| NOTE type is not a structure or enumeration //~| ERROR only traits defined in the current crate can be implemented for arbitrary types -//~| NOTE impl doesn't use types inside crate -//~| NOTE the impl does not reference any types defined in this crate -//~| NOTE define and implement a trait or new type instead fn main() { } diff --git a/src/test/ui/coherence-impls-copy.stderr b/src/test/ui/coherence-impls-copy.stderr new file mode 100644 index 0000000000000..e5e91df771fdc --- /dev/null +++ b/src/test/ui/coherence-impls-copy.stderr @@ -0,0 +1,59 @@ +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:29:15 + | +29 | impl Copy for &'static mut MyType {} + | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:33:15 + | +33 | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:37:15 + | +37 | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:40:15 + | +40 | impl Copy for [MyType] {} + | ^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:44:15 + | +44 | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:33:1 + | +33 | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:40:1 + | +40 | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:44:1 + | +44 | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference any types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/coherence-overlap-downstream-inherent.rs b/src/test/ui/coherence-overlap-downstream-inherent.rs similarity index 79% rename from src/test/compile-fail/coherence-overlap-downstream-inherent.rs rename to src/test/ui/coherence-overlap-downstream-inherent.rs index 66068b535556c..fd6e1d339f383 100644 --- a/src/test/compile-fail/coherence-overlap-downstream-inherent.rs +++ b/src/test/ui/coherence-overlap-downstream-inherent.rs @@ -16,17 +16,12 @@ pub trait Sugar {} pub trait Fruit {} impl Sweet { fn dummy(&self) { } } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` impl Sweet { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` trait Bar {} struct A(T, X); impl A where T: Bar { fn f(&self) {} } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `f` -//~| NOTE downstream crates may implement trait `Bar<_>` for type `i32` impl A { fn f(&self) {} } -//~^ NOTE other definition for `f` fn main() {} diff --git a/src/test/ui/coherence-overlap-downstream-inherent.stderr b/src/test/ui/coherence-overlap-downstream-inherent.stderr new file mode 100644 index 0000000000000..aca6800deb5cc --- /dev/null +++ b/src/test/ui/coherence-overlap-downstream-inherent.stderr @@ -0,0 +1,22 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-downstream-inherent.rs:17:26 + | +17 | impl Sweet { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +18 | //~^ ERROR E0592 +19 | impl Sweet { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + +error[E0592]: duplicate definitions with name `f` + --> $DIR/coherence-overlap-downstream-inherent.rs:23:38 + | +23 | impl A where T: Bar { fn f(&self) {} } + | ^^^^^^^^^^^^^^ duplicate definitions for `f` +24 | //~^ ERROR E0592 +25 | impl A { fn f(&self) {} } + | -------------- other definition for `f` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/coherence-overlap-downstream.rs b/src/test/ui/coherence-overlap-downstream.rs similarity index 78% rename from src/test/compile-fail/coherence-overlap-downstream.rs rename to src/test/ui/coherence-overlap-downstream.rs index 1df02737dec58..63898ef9a20a7 100644 --- a/src/test/compile-fail/coherence-overlap-downstream.rs +++ b/src/test/ui/coherence-overlap-downstream.rs @@ -15,18 +15,13 @@ pub trait Sugar {} pub trait Fruit {} pub trait Sweet {} impl Sweet for T { } -//~^ NOTE first implementation here impl Sweet for T { } //~^ ERROR E0119 -//~| NOTE conflicting implementation pub trait Foo {} pub trait Bar {} impl Foo for T where T: Bar {} -//~^ NOTE first implementation here impl Foo for i32 {} //~^ ERROR E0119 -//~| NOTE conflicting implementation for `i32` -//~| NOTE downstream crates may implement trait `Bar<_>` for type `i32` fn main() { } diff --git a/src/test/ui/coherence-overlap-downstream.stderr b/src/test/ui/coherence-overlap-downstream.stderr new file mode 100644 index 0000000000000..8a3ef97fd5564 --- /dev/null +++ b/src/test/ui/coherence-overlap-downstream.stderr @@ -0,0 +1,20 @@ +error[E0119]: conflicting implementations of trait `Sweet`: + --> $DIR/coherence-overlap-downstream.rs:18:1 + | +17 | impl Sweet for T { } + | ----------------------------- first implementation here +18 | impl Sweet for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: + --> $DIR/coherence-overlap-downstream.rs:24:1 + | +23 | impl Foo for T where T: Bar {} + | ------------------------------------------ first implementation here +24 | impl Foo for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/coherence-overlap-issue-23516-inherent.rs similarity index 83% rename from src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs rename to src/test/ui/coherence-overlap-issue-23516-inherent.rs index 355af60710a9b..94a7bdbc69e41 100644 --- a/src/test/compile-fail/coherence-overlap-issue-23516-inherent.rs +++ b/src/test/ui/coherence-overlap-issue-23516-inherent.rs @@ -18,9 +18,6 @@ struct Cake(X); impl Cake { fn dummy(&self) { } } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -//~| NOTE downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` impl Cake> { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` fn main() { } diff --git a/src/test/ui/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/coherence-overlap-issue-23516-inherent.stderr new file mode 100644 index 0000000000000..24d9b26fe9d62 --- /dev/null +++ b/src/test/ui/coherence-overlap-issue-23516-inherent.stderr @@ -0,0 +1,13 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-issue-23516-inherent.rs:19:25 + | +19 | impl Cake { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +20 | //~^ ERROR E0592 +21 | impl Cake> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-overlap-issue-23516.rs b/src/test/ui/coherence-overlap-issue-23516.rs similarity index 82% rename from src/test/compile-fail/coherence-overlap-issue-23516.rs rename to src/test/ui/coherence-overlap-issue-23516.rs index ffef5bf10871a..3cd184b9be9c6 100644 --- a/src/test/compile-fail/coherence-overlap-issue-23516.rs +++ b/src/test/ui/coherence-overlap-issue-23516.rs @@ -15,10 +15,7 @@ pub trait Sugar { fn dummy(&self) { } } pub trait Sweet { fn dummy(&self) { } } impl Sweet for T { } -//~^ NOTE first implementation here impl Sweet for Box { } //~^ ERROR E0119 -//~| NOTE conflicting implementation for `std::boxed::Box<_>` -//~| NOTE downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` fn main() { } diff --git a/src/test/ui/coherence-overlap-issue-23516.stderr b/src/test/ui/coherence-overlap-issue-23516.stderr new file mode 100644 index 0000000000000..8e107e06a9e04 --- /dev/null +++ b/src/test/ui/coherence-overlap-issue-23516.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: + --> $DIR/coherence-overlap-issue-23516.rs:18:1 + | +17 | impl Sweet for T { } + | ----------------------------- first implementation here +18 | impl Sweet for Box { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-overlap-upstream-inherent.rs b/src/test/ui/coherence-overlap-upstream-inherent.rs similarity index 82% rename from src/test/compile-fail/coherence-overlap-upstream-inherent.rs rename to src/test/ui/coherence-overlap-upstream-inherent.rs index 1d0c63110cecd..a5a6a88a128be 100644 --- a/src/test/compile-fail/coherence-overlap-upstream-inherent.rs +++ b/src/test/ui/coherence-overlap-upstream-inherent.rs @@ -20,9 +20,6 @@ use coherence_lib::Remote; struct A(X); impl A where T: Remote { fn dummy(&self) { } } //~^ ERROR E0592 -//~| NOTE duplicate definitions for `dummy` -//~| NOTE upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` impl A { fn dummy(&self) { } } -//~^ NOTE other definition for `dummy` fn main() {} diff --git a/src/test/ui/coherence-overlap-upstream-inherent.stderr b/src/test/ui/coherence-overlap-upstream-inherent.stderr new file mode 100644 index 0000000000000..db32bcb81c6ee --- /dev/null +++ b/src/test/ui/coherence-overlap-upstream-inherent.stderr @@ -0,0 +1,13 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-upstream-inherent.rs:21:32 + | +21 | impl A where T: Remote { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +22 | //~^ ERROR E0592 +23 | impl A { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + diff --git a/src/test/compile-fail/coherence-overlap-upstream.rs b/src/test/ui/coherence-overlap-upstream.rs similarity index 81% rename from src/test/compile-fail/coherence-overlap-upstream.rs rename to src/test/ui/coherence-overlap-upstream.rs index e978143a067c5..f772848cb5869 100644 --- a/src/test/compile-fail/coherence-overlap-upstream.rs +++ b/src/test/ui/coherence-overlap-upstream.rs @@ -19,10 +19,7 @@ use coherence_lib::Remote; trait Foo {} impl Foo for T where T: Remote {} -//~^ NOTE first implementation here impl Foo for i16 {} //~^ ERROR E0119 -//~| NOTE conflicting implementation for `i16` -//~| NOTE upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` fn main() {} diff --git a/src/test/ui/coherence-overlap-upstream.stderr b/src/test/ui/coherence-overlap-upstream.stderr new file mode 100644 index 0000000000000..48961572b72ca --- /dev/null +++ b/src/test/ui/coherence-overlap-upstream.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i16`: + --> $DIR/coherence-overlap-upstream.rs:22:1 + | +21 | impl Foo for T where T: Remote {} + | ------------------------------------ first implementation here +22 | impl Foo for i16 {} + | ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-deref-ptr.rs b/src/test/ui/const-deref-ptr.rs similarity index 90% rename from src/test/compile-fail/const-deref-ptr.rs rename to src/test/ui/const-deref-ptr.rs index c626801d48c03..fa15f3e87c694 100644 --- a/src/test/compile-fail/const-deref-ptr.rs +++ b/src/test/ui/const-deref-ptr.rs @@ -12,6 +12,5 @@ fn main() { static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 - //~| NOTE dereference of raw pointer in constant println!("{}", C); } diff --git a/src/test/ui/const-deref-ptr.stderr b/src/test/ui/const-deref-ptr.stderr new file mode 100644 index 0000000000000..60f9a3a37ba99 --- /dev/null +++ b/src/test/ui/const-deref-ptr.stderr @@ -0,0 +1,8 @@ +error[E0396]: raw pointers cannot be dereferenced in statics + --> $DIR/const-deref-ptr.rs:14:29 + | +14 | static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer in constant + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-eval-overflow-2.rs b/src/test/ui/const-eval-overflow-2.rs similarity index 93% rename from src/test/compile-fail/const-eval-overflow-2.rs rename to src/test/ui/const-eval-overflow-2.rs index 0fd41a17b2c9c..6b7f631ff4c8d 100644 --- a/src/test/compile-fail/const-eval-overflow-2.rs +++ b/src/test/ui/const-eval-overflow-2.rs @@ -24,7 +24,7 @@ const NEG_NEG_128: i8 = -NEG_128; fn main() { match -128i8 { - NEG_NEG_128 => println!("A"), //~ NOTE for pattern here + NEG_NEG_128 => println!("A"), _ => println!("B"), } } diff --git a/src/test/ui/const-eval-overflow-2.stderr b/src/test/ui/const-eval-overflow-2.stderr new file mode 100644 index 0000000000000..a9d29d0107192 --- /dev/null +++ b/src/test/ui/const-eval-overflow-2.stderr @@ -0,0 +1,14 @@ +error[E0080]: constant evaluation error + --> $DIR/const-eval-overflow-2.rs:21:25 + | +21 | const NEG_NEG_128: i8 = -NEG_128; + | ^^^^^^^^ attempt to negate with overflow + | +note: for pattern here + --> $DIR/const-eval-overflow-2.rs:27:9 + | +27 | NEG_NEG_128 => println!("A"), + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-eval-overflow-4.rs b/src/test/ui/const-eval-overflow-4.rs similarity index 93% rename from src/test/compile-fail/const-eval-overflow-4.rs rename to src/test/ui/const-eval-overflow-4.rs index 2b1c1017b5b00..4423fdec33a85 100644 --- a/src/test/compile-fail/const-eval-overflow-4.rs +++ b/src/test/ui/const-eval-overflow-4.rs @@ -22,9 +22,7 @@ use std::{u8, u16, u32, u64, usize}; const A_I8_T : [u32; (i8::MAX as i8 + 1i8) as usize] //~^ ERROR constant evaluation error - //~^^ NOTE attempt to add with overflow //~| WARNING constant evaluation error - //~| NOTE on by default = [0; (i8::MAX as usize) + 1]; fn main() { @@ -34,4 +32,3 @@ fn main() { fn foo(x: T) { println!("{:?}", x); } - diff --git a/src/test/ui/const-eval-overflow-4.stderr b/src/test/ui/const-eval-overflow-4.stderr new file mode 100644 index 0000000000000..98c6ae1b9bcac --- /dev/null +++ b/src/test/ui/const-eval-overflow-4.stderr @@ -0,0 +1,16 @@ +warning: constant evaluation error: attempt to add with overflow + --> $DIR/const-eval-overflow-4.rs:23:13 + | +23 | : [u32; (i8::MAX as i8 + 1i8) as usize] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0080]: constant evaluation error + --> $DIR/const-eval-overflow-4.rs:23:13 + | +23 | : [u32; (i8::MAX as i8 + 1i8) as usize] + | ^^^^^^^^^^^^^^^^^^^^^ attempt to add with overflow + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-eval-span.rs b/src/test/ui/const-eval-span.rs similarity index 95% rename from src/test/compile-fail/const-eval-span.rs rename to src/test/ui/const-eval-span.rs index 16f89606b01e6..f0fa1c0b9b47d 100644 --- a/src/test/compile-fail/const-eval-span.rs +++ b/src/test/ui/const-eval-span.rs @@ -19,7 +19,6 @@ enum E { V = CONSTANT, //~^ ERROR mismatched types //~| expected isize, found struct `S` - //~| NOTE expected type `isize` //~| found type `S` } diff --git a/src/test/ui/const-eval-span.stderr b/src/test/ui/const-eval-span.stderr new file mode 100644 index 0000000000000..e64af57a18649 --- /dev/null +++ b/src/test/ui/const-eval-span.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/const-eval-span.rs:19:9 + | +19 | V = CONSTANT, + | ^^^^^^^^ expected isize, found struct `S` + | + = note: expected type `isize` + found type `S` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-fn-error.rs b/src/test/ui/const-fn-error.rs similarity index 85% rename from src/test/compile-fail/const-fn-error.rs rename to src/test/ui/const-fn-error.rs index baf836b4dad1b..ac1c2fe5432de 100644 --- a/src/test/compile-fail/const-fn-error.rs +++ b/src/test/ui/const-fn-error.rs @@ -24,7 +24,6 @@ const fn f(x: usize) -> usize { #[allow(unused_variables)] fn main() { - let a : [i32; f(X)]; //~ NOTE for constant expression here - //~| WARNING constant evaluation error: non-constant path - //~| on by default + let a : [i32; f(X)]; + //~^ WARNING constant evaluation error: non-constant path } diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/const-fn-error.stderr new file mode 100644 index 0000000000000..0e275e78fc68c --- /dev/null +++ b/src/test/ui/const-fn-error.stderr @@ -0,0 +1,46 @@ +warning: constant evaluation error: non-constant path in constant expression + --> $DIR/const-fn-error.rs:27:19 + | +27 | let a : [i32; f(X)]; + | ^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0016]: blocks in constant functions are limited to items and tail expressions + --> $DIR/const-fn-error.rs:16:19 + | +16 | let mut sum = 0; //~ ERROR blocks in constant functions are limited + | ^ + +error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors + --> $DIR/const-fn-error.rs:17:5 + | +17 | / for i in 0..x { //~ ERROR calls in constant functions +18 | | //~| ERROR constant function contains unimplemented +19 | | sum += i; +20 | | } + | |_____^ + +error[E0019]: constant function contains unimplemented expression type + --> $DIR/const-fn-error.rs:17:5 + | +17 | / for i in 0..x { //~ ERROR calls in constant functions +18 | | //~| ERROR constant function contains unimplemented +19 | | sum += i; +20 | | } + | |_____^ + +error[E0080]: constant evaluation error + --> $DIR/const-fn-error.rs:21:5 + | +21 | sum //~ ERROR E0080 + | ^^^ non-constant path in constant expression + | +note: for constant expression here + --> $DIR/const-fn-error.rs:27:13 + | +27 | let a : [i32; f(X)]; + | ^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/const-fn-mismatch.rs b/src/test/ui/const-fn-mismatch.rs similarity index 95% rename from src/test/compile-fail/const-fn-mismatch.rs rename to src/test/ui/const-fn-mismatch.rs index 7ea72e23779ec..4e1fa6bd186ec 100644 --- a/src/test/compile-fail/const-fn-mismatch.rs +++ b/src/test/ui/const-fn-mismatch.rs @@ -22,7 +22,6 @@ trait Foo { impl Foo for u32 { const fn f() -> u32 { 22 } //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const } fn main() { } diff --git a/src/test/ui/const-fn-mismatch.stderr b/src/test/ui/const-fn-mismatch.stderr new file mode 100644 index 0000000000000..4f6a98fb8eb05 --- /dev/null +++ b/src/test/ui/const-fn-mismatch.stderr @@ -0,0 +1,8 @@ +error[E0379]: trait fns cannot be declared const + --> $DIR/const-fn-mismatch.rs:23:5 + | +23 | const fn f() -> u32 { 22 } + | ^^^^^ trait fns cannot be const + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-fn-not-in-trait.rs b/src/test/ui/const-fn-not-in-trait.rs similarity index 90% rename from src/test/compile-fail/const-fn-not-in-trait.rs rename to src/test/ui/const-fn-not-in-trait.rs index 257d4d5ee9921..1877929173d46 100644 --- a/src/test/compile-fail/const-fn-not-in-trait.rs +++ b/src/test/ui/const-fn-not-in-trait.rs @@ -16,10 +16,8 @@ trait Foo { const fn f() -> u32; //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const const fn g() -> u32 { 0 } //~^ ERROR trait fns cannot be declared const - //~| NOTE trait fns cannot be const } fn main() { } diff --git a/src/test/ui/const-fn-not-in-trait.stderr b/src/test/ui/const-fn-not-in-trait.stderr new file mode 100644 index 0000000000000..d23bf3b411b28 --- /dev/null +++ b/src/test/ui/const-fn-not-in-trait.stderr @@ -0,0 +1,14 @@ +error[E0379]: trait fns cannot be declared const + --> $DIR/const-fn-not-in-trait.rs:17:5 + | +17 | const fn f() -> u32; + | ^^^^^ trait fns cannot be const + +error[E0379]: trait fns cannot be declared const + --> $DIR/const-fn-not-in-trait.rs:19:5 + | +19 | const fn g() -> u32 { 0 } + | ^^^^^ trait fns cannot be const + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/const-len-underflow-separate-spans.rs b/src/test/ui/const-len-underflow-separate-spans.rs similarity index 82% rename from src/test/compile-fail/const-len-underflow-separate-spans.rs rename to src/test/ui/const-len-underflow-separate-spans.rs index eaad9e7e92bab..823cc988947cb 100644 --- a/src/test/compile-fail/const-len-underflow-separate-spans.rs +++ b/src/test/ui/const-len-underflow-separate-spans.rs @@ -15,12 +15,9 @@ const ONE: usize = 1; const TWO: usize = 2; const LEN: usize = ONE - TWO; -//~^ ERROR E0080 -//~| attempt to subtract with overflow -//~| NOTE attempt to subtract with overflow -//~| NOTE on by default +//~^ ERROR constant evaluation error [E0080] +//~| WARN attempt to subtract with overflow fn main() { let a: [i8; LEN] = unimplemented!(); - //~^ NOTE for constant expression here } diff --git a/src/test/ui/const-len-underflow-separate-spans.stderr b/src/test/ui/const-len-underflow-separate-spans.stderr new file mode 100644 index 0000000000000..6e6c2130e1ccd --- /dev/null +++ b/src/test/ui/const-len-underflow-separate-spans.stderr @@ -0,0 +1,22 @@ +warning: constant evaluation error: attempt to subtract with overflow + --> $DIR/const-len-underflow-separate-spans.rs:17:20 + | +17 | const LEN: usize = ONE - TWO; + | ^^^^^^^^^ + | + = note: #[warn(const_err)] on by default + +error[E0080]: constant evaluation error + --> $DIR/const-len-underflow-separate-spans.rs:17:20 + | +17 | const LEN: usize = ONE - TWO; + | ^^^^^^^^^ attempt to subtract with overflow + | +note: for constant expression here + --> $DIR/const-len-underflow-separate-spans.rs:22:12 + | +22 | let a: [i8; LEN] = unimplemented!(); + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-pattern-not-const-evaluable.rs b/src/test/ui/const-pattern-not-const-evaluable.rs similarity index 94% rename from src/test/compile-fail/const-pattern-not-const-evaluable.rs rename to src/test/ui/const-pattern-not-const-evaluable.rs index 71cac3edbc188..263c0bdc64c6f 100644 --- a/src/test/compile-fail/const-pattern-not-const-evaluable.rs +++ b/src/test/ui/const-pattern-not-const-evaluable.rs @@ -34,7 +34,7 @@ const GOO: Cake = foo(); fn main() { match BlackForest { - FOO => println!("hi"), //~ NOTE: for pattern here + FOO => println!("hi"), GOO => println!("meh"), WORKS => println!("möp"), _ => println!("bye"), diff --git a/src/test/ui/const-pattern-not-const-evaluable.stderr b/src/test/ui/const-pattern-not-const-evaluable.stderr new file mode 100644 index 0000000000000..5441937e4dd60 --- /dev/null +++ b/src/test/ui/const-pattern-not-const-evaluable.stderr @@ -0,0 +1,14 @@ +error[E0080]: constant evaluation error + --> $DIR/const-pattern-not-const-evaluable.rs:22:31 + | +22 | const BOO: Pair = Pair(Marmor, BlackForest); + | ^^^^ unimplemented constant expression: tuple struct constructors + | +note: for pattern here + --> $DIR/const-pattern-not-const-evaluable.rs:37:9 + | +37 | FOO => println!("hi"), + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/const-unsized.rs b/src/test/ui/const-unsized.rs similarity index 67% rename from src/test/compile-fail/const-unsized.rs rename to src/test/ui/const-unsized.rs index 4b212814ded29..c6ce34b60ca77 100644 --- a/src/test/compile-fail/const-unsized.rs +++ b/src/test/ui/const-unsized.rs @@ -12,23 +12,15 @@ use std::fmt::Debug; const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); //~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size const CONST_FOO: str = *"foo"; //~^ ERROR `str: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); //~^ ERROR `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size static STATIC_BAR: str = *"bar"; //~^ ERROR `str: std::marker::Sized` is not satisfied -//~| NOTE does not have a constant size known at compile-time -//~| NOTE constant expressions must have a statically known size fn main() { println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr new file mode 100644 index 0000000000000..ba948643a37b0 --- /dev/null +++ b/src/test/ui/const-unsized.stderr @@ -0,0 +1,38 @@ +error[E0277]: the trait bound `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:13:29 + | +13 | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); + | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: constant expressions must have a statically known size + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:16:24 + | +16 | const CONST_FOO: str = *"foo"; + | ^^^^^^ `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: constant expressions must have a statically known size + +error[E0277]: the trait bound `std::fmt::Debug + std::marker::Sync + 'static: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:19:31 + | +19 | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); + | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: constant expressions must have a statically known size + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/const-unsized.rs:22:26 + | +22 | static STATIC_BAR: str = *"bar"; + | ^^^^^^ `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: constant expressions must have a statically known size + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/cycle-trait-supertrait-indirect.rs b/src/test/ui/cycle-trait-supertrait-indirect.rs similarity index 74% rename from src/test/compile-fail/cycle-trait-supertrait-indirect.rs rename to src/test/ui/cycle-trait-supertrait-indirect.rs index 905d546e99a06..c3b0276bcf9cb 100644 --- a/src/test/compile-fail/cycle-trait-supertrait-indirect.rs +++ b/src/test/ui/cycle-trait-supertrait-indirect.rs @@ -12,16 +12,13 @@ // a direct participant in the cycle. trait A: B { - //~^ NOTE the cycle begins when computing the supertraits of `B`... } trait B: C { - //~^ NOTE ...which then requires computing the supertraits of `C`... } trait C: B { } //~^ ERROR unsupported cyclic reference //~| cyclic reference - //~| NOTE ...which then again requires computing the supertraits of `B`, completing the cycle fn main() { } diff --git a/src/test/ui/cycle-trait-supertrait-indirect.stderr b/src/test/ui/cycle-trait-supertrait-indirect.stderr new file mode 100644 index 0000000000000..107644037a9ca --- /dev/null +++ b/src/test/ui/cycle-trait-supertrait-indirect.stderr @@ -0,0 +1,20 @@ +error[E0391]: unsupported cyclic reference between types/traits detected + --> $DIR/cycle-trait-supertrait-indirect.rs:20:1 + | +20 | trait C: B { } + | ^^^^^^^^^^ cyclic reference + | +note: the cycle begins when computing the supertraits of `B`... + --> $DIR/cycle-trait-supertrait-indirect.rs:14:1 + | +14 | trait A: B { + | ^^^^^^^^^^ +note: ...which then requires computing the supertraits of `C`... + --> $DIR/cycle-trait-supertrait-indirect.rs:17:1 + | +17 | trait B: C { + | ^^^^^^^^^^ + = note: ...which then again requires computing the supertraits of `B`, completing the cycle. + +error: aborting due to previous error + diff --git a/src/test/ui/deprecated-macro_escape-inner.rs b/src/test/ui/deprecated-macro_escape-inner.rs index 3d253ba49dad9..dce80698dea39 100644 --- a/src/test/ui/deprecated-macro_escape-inner.rs +++ b/src/test/ui/deprecated-macro_escape-inner.rs @@ -12,7 +12,6 @@ mod foo { #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use - //~^ HELP consider an outer attribute } fn main() { diff --git a/src/test/compile-fail/derived-errors/issue-31997-1.rs b/src/test/ui/derived-errors/issue-31997-1.rs similarity index 97% rename from src/test/compile-fail/derived-errors/issue-31997-1.rs rename to src/test/ui/derived-errors/issue-31997-1.rs index 6a9d8db9654ac..7d79c48c06ae2 100644 --- a/src/test/compile-fail/derived-errors/issue-31997-1.rs +++ b/src/test/ui/derived-errors/issue-31997-1.rs @@ -29,7 +29,6 @@ fn main() { let mut map = HashMap::new(); //~^ ERROR E0433 - //~| NOTE Use of undeclared type or module `HashMap` for line in input.lines() { let line = line.unwrap(); diff --git a/src/test/ui/derived-errors/issue-31997-1.stderr b/src/test/ui/derived-errors/issue-31997-1.stderr new file mode 100644 index 0000000000000..732cf9bacbcd1 --- /dev/null +++ b/src/test/ui/derived-errors/issue-31997-1.stderr @@ -0,0 +1,8 @@ +error[E0433]: failed to resolve. Use of undeclared type or module `HashMap` + --> $DIR/issue-31997-1.rs:30:19 + | +30 | let mut map = HashMap::new(); + | ^^^^^^^ Use of undeclared type or module `HashMap` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/discrim-overflow-2.rs b/src/test/ui/discrim-overflow-2.rs similarity index 62% rename from src/test/compile-fail/discrim-overflow-2.rs rename to src/test/ui/discrim-overflow-2.rs index 213683b580883..9f77e77d158cd 100644 --- a/src/test/compile-fail/discrim-overflow-2.rs +++ b/src/test/ui/discrim-overflow-2.rs @@ -25,8 +25,6 @@ fn f_i8() { Ok = i8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 127i8 - //~| NOTE explicitly set `OhNo = -128i8` if that is desired outcome } } @@ -36,8 +34,6 @@ fn f_u8() { Ok = u8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 255u8 - //~| NOTE explicitly set `OhNo = 0u8` if that is desired outcome } } @@ -47,8 +43,6 @@ fn f_i16() { Ok = i16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 32767i16 - //~| NOTE explicitly set `OhNo = -32768i16` if that is desired outcome } } @@ -58,8 +52,6 @@ fn f_u16() { Ok = u16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 65535u16 - //~| NOTE explicitly set `OhNo = 0u16` if that is desired outcome } } @@ -69,8 +61,6 @@ fn f_i32() { Ok = i32::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 2147483647i32 - //~| NOTE explicitly set `OhNo = -2147483648i32` if that is desired outcome } } @@ -80,8 +70,6 @@ fn f_u32() { Ok = u32::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 4294967295u32 - //~| NOTE explicitly set `OhNo = 0u32` if that is desired outcome } } @@ -91,8 +79,6 @@ fn f_i64() { Ok = i64::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 9223372036854775807i64 - //~| NOTE explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome } } @@ -102,8 +88,6 @@ fn f_u64() { Ok = u64::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 18446744073709551615u64 - //~| NOTE explicitly set `OhNo = 0u64` if that is desired outcome } } diff --git a/src/test/ui/discrim-overflow-2.stderr b/src/test/ui/discrim-overflow-2.stderr new file mode 100644 index 0000000000000..660110cd73715 --- /dev/null +++ b/src/test/ui/discrim-overflow-2.stderr @@ -0,0 +1,66 @@ +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:27:9 + | +27 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 127i8 + | + = note: explicitly set `OhNo = -128i8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:36:9 + | +36 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 255u8 + | + = note: explicitly set `OhNo = 0u8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:45:9 + | +45 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 32767i16 + | + = note: explicitly set `OhNo = -32768i16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:54:9 + | +54 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 65535u16 + | + = note: explicitly set `OhNo = 0u16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:63:9 + | +63 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 2147483647i32 + | + = note: explicitly set `OhNo = -2147483648i32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:72:9 + | +72 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 4294967295u32 + | + = note: explicitly set `OhNo = 0u32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:81:9 + | +81 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 9223372036854775807i64 + | + = note: explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow-2.rs:90:9 + | +90 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 18446744073709551615u64 + | + = note: explicitly set `OhNo = 0u64` if that is desired outcome + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/discrim-overflow.rs b/src/test/ui/discrim-overflow.rs similarity index 73% rename from src/test/compile-fail/discrim-overflow.rs rename to src/test/ui/discrim-overflow.rs index a3039b8d9573a..0b31d9f97f174 100644 --- a/src/test/compile-fail/discrim-overflow.rs +++ b/src/test/ui/discrim-overflow.rs @@ -23,8 +23,6 @@ fn f_i8() { Ok = i8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 127i8 - //~| NOTE explicitly set `OhNo = -128i8` if that is desired outcome } let x = A::Ok; @@ -36,8 +34,6 @@ fn f_u8() { Ok = u8::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 255u8 - //~| NOTE explicitly set `OhNo = 0u8` if that is desired outcome } let x = A::Ok; @@ -49,8 +45,6 @@ fn f_i16() { Ok = i16::MAX - 1, Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] - //~| NOTE overflowed on value after 32767i16 - //~| NOTE explicitly set `OhNo = -32768i16` if that is desired outcome } let x = A::Ok; @@ -63,7 +57,6 @@ fn f_u16() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 65535u16 - //~| NOTE explicitly set `OhNo = 0u16` if that is desired outcome } let x = A::Ok; @@ -76,7 +69,6 @@ fn f_i32() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 2147483647i32 - //~| NOTE explicitly set `OhNo = -2147483648i32` if that is desired outcome } let x = A::Ok; @@ -89,7 +81,6 @@ fn f_u32() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 4294967295u32 - //~| NOTE explicitly set `OhNo = 0u32` if that is desired outcome } let x = A::Ok; @@ -102,7 +93,6 @@ fn f_i64() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 9223372036854775807i64 - //~| NOTE explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome } let x = A::Ok; @@ -115,7 +105,6 @@ fn f_u64() { Ok2, OhNo, //~ ERROR enum discriminant overflowed [E0370] //~| overflowed on value after 18446744073709551615u64 - //~| NOTE explicitly set `OhNo = 0u64` if that is desired outcome } let x = A::Ok; diff --git a/src/test/ui/discrim-overflow.stderr b/src/test/ui/discrim-overflow.stderr new file mode 100644 index 0000000000000..733810006d74a --- /dev/null +++ b/src/test/ui/discrim-overflow.stderr @@ -0,0 +1,66 @@ +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:25:9 + | +25 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 127i8 + | + = note: explicitly set `OhNo = -128i8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:36:9 + | +36 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 255u8 + | + = note: explicitly set `OhNo = 0u8` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:47:9 + | +47 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 32767i16 + | + = note: explicitly set `OhNo = -32768i16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:58:9 + | +58 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 65535u16 + | + = note: explicitly set `OhNo = 0u16` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:70:9 + | +70 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 2147483647i32 + | + = note: explicitly set `OhNo = -2147483648i32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:82:9 + | +82 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 4294967295u32 + | + = note: explicitly set `OhNo = 0u32` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:94:9 + | +94 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 9223372036854775807i64 + | + = note: explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome + +error[E0370]: enum discriminant overflowed + --> $DIR/discrim-overflow.rs:106:9 + | +106 | OhNo, //~ ERROR enum discriminant overflowed [E0370] + | ^^^^ overflowed on value after 18446744073709551615u64 + | + = note: explicitly set `OhNo = 0u64` if that is desired outcome + +error: aborting due to 8 previous errors + diff --git a/src/test/compile-fail/double-import.rs b/src/test/ui/double-import.rs similarity index 78% rename from src/test/compile-fail/double-import.rs rename to src/test/ui/double-import.rs index 21b8ded6d9333..154c9bebb0fea 100644 --- a/src/test/compile-fail/double-import.rs +++ b/src/test/ui/double-import.rs @@ -19,9 +19,7 @@ mod sub2 { pub fn foo() {} // implementation 2 } -use sub1::foo; //~ NOTE previous import of the value `foo` here +use sub1::foo; use sub2::foo; //~ ERROR the name `foo` is defined multiple times - //~| NOTE `foo` reimported here - //~| NOTE `foo` must be defined only once in the value namespace of this module fn main() {} diff --git a/src/test/ui/double-import.stderr b/src/test/ui/double-import.stderr new file mode 100644 index 0000000000000..fcd3f2696f200 --- /dev/null +++ b/src/test/ui/double-import.stderr @@ -0,0 +1,16 @@ +error[E0252]: the name `foo` is defined multiple times + --> $DIR/double-import.rs:23:5 + | +22 | use sub1::foo; + | --------- previous import of the value `foo` here +23 | use sub2::foo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^^^^ `foo` reimported here + | + = note: `foo` must be defined only once in the value namespace of this module +help: You can use `as` to change the binding name of the import + | +23 | use sub2::foo as Otherfoo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/duplicate-check-macro-exports.rs b/src/test/ui/duplicate-check-macro-exports.rs similarity index 87% rename from src/test/compile-fail/duplicate-check-macro-exports.rs rename to src/test/ui/duplicate-check-macro-exports.rs index 53d7e54ee5b7b..d874a43d53d79 100644 --- a/src/test/compile-fail/duplicate-check-macro-exports.rs +++ b/src/test/ui/duplicate-check-macro-exports.rs @@ -10,10 +10,9 @@ #![feature(use_extern_macros)] -pub use std::panic; //~ NOTE previous macro export here +pub use std::panic; #[macro_export] macro_rules! panic { () => {} } //~ ERROR a macro named `panic` has already been exported -//~| NOTE `panic` already exported fn main() {} diff --git a/src/test/ui/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate-check-macro-exports.stderr new file mode 100644 index 0000000000000..4e7176f351888 --- /dev/null +++ b/src/test/ui/duplicate-check-macro-exports.stderr @@ -0,0 +1,14 @@ +error: a macro named `panic` has already been exported + --> $DIR/duplicate-check-macro-exports.rs:16:1 + | +16 | macro_rules! panic { () => {} } //~ ERROR a macro named `panic` has already been exported + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `panic` already exported + | +note: previous macro export here + --> $DIR/duplicate-check-macro-exports.rs:13:9 + | +13 | pub use std::panic; + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/empty-struct-unit-expr.rs b/src/test/ui/empty-struct-unit-expr.rs similarity index 90% rename from src/test/compile-fail/empty-struct-unit-expr.rs rename to src/test/ui/empty-struct-unit-expr.rs index 9655007604de6..c33960193b052 100644 --- a/src/test/compile-fail/empty-struct-unit-expr.rs +++ b/src/test/ui/empty-struct-unit-expr.rs @@ -25,9 +25,7 @@ fn main() { let e2 = Empty2(); //~ ERROR expected function, found `Empty2` let e4 = E::Empty4(); //~^ ERROR expected function, found `E::Empty4` [E0618] - //~| HELP did you mean to write `E::Empty4`? let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` let xe4 = XE::XEmpty4(); //~^ ERROR expected function, found `XE::XEmpty4` [E0618] - //~| HELP did you mean to write `XE::XEmpty4`? } diff --git a/src/test/ui/empty-struct-unit-expr.stderr b/src/test/ui/empty-struct-unit-expr.stderr new file mode 100644 index 0000000000000..3ce63ed9f423b --- /dev/null +++ b/src/test/ui/empty-struct-unit-expr.stderr @@ -0,0 +1,41 @@ +error[E0618]: expected function, found `Empty2` + --> $DIR/empty-struct-unit-expr.rs:25:14 + | +25 | let e2 = Empty2(); //~ ERROR expected function, found `Empty2` + | ^^^^^^^^ + | +note: defined here + --> $DIR/empty-struct-unit-expr.rs:18:1 + | +18 | struct Empty2; + | ^^^^^^^^^^^^^^ + +error[E0618]: expected function, found `E::Empty4` + --> $DIR/empty-struct-unit-expr.rs:26:14 + | +26 | let e4 = E::Empty4(); + | ^^^^^^^^^^^ + | + = help: did you mean to write `E::Empty4`? +note: defined here + --> $DIR/empty-struct-unit-expr.rs:21:5 + | +21 | Empty4 + | ^^^^^^ + +error[E0618]: expected function, found `empty_struct::XEmpty2` + --> $DIR/empty-struct-unit-expr.rs:28:15 + | +28 | let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` + | ^^^^^^^^^ + +error[E0618]: expected function, found `XE::XEmpty4` + --> $DIR/empty-struct-unit-expr.rs:29:15 + | +29 | let xe4 = XE::XEmpty4(); + | ^^^^^^^^^^^^^ + | + = help: did you mean to write `XE::XEmpty4`? + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/enum-and-module-in-same-scope.rs b/src/test/ui/enum-and-module-in-same-scope.rs similarity index 77% rename from src/test/compile-fail/enum-and-module-in-same-scope.rs rename to src/test/ui/enum-and-module-in-same-scope.rs index 59b4d715c2dd3..9b6c8712f69b2 100644 --- a/src/test/compile-fail/enum-and-module-in-same-scope.rs +++ b/src/test/ui/enum-and-module-in-same-scope.rs @@ -8,13 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum Foo { //~ NOTE previous definition of the type `Foo` here +enum Foo { X } mod Foo { //~ ERROR the name `Foo` is defined multiple times - //~| NOTE `Foo` redefined here - //~| NOTE `Foo` must be defined only once in the type namespace of this module pub static X: isize = 42; fn f() { f() } // Check that this does not result in a resolution error } diff --git a/src/test/ui/enum-and-module-in-same-scope.stderr b/src/test/ui/enum-and-module-in-same-scope.stderr new file mode 100644 index 0000000000000..723e13f41093c --- /dev/null +++ b/src/test/ui/enum-and-module-in-same-scope.stderr @@ -0,0 +1,18 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/enum-and-module-in-same-scope.rs:15:1 + | +11 | / enum Foo { +12 | | X +13 | | } + | |_- previous definition of the type `Foo` here +14 | +15 | / mod Foo { //~ ERROR the name `Foo` is defined multiple times +16 | | pub static X: isize = 42; +17 | | fn f() { f() } // Check that this does not result in a resolution error +18 | | } + | |_^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error: aborting due to previous error + diff --git a/src/test/compile-fail/fat-ptr-cast.rs b/src/test/ui/fat-ptr-cast.rs similarity index 92% rename from src/test/compile-fail/fat-ptr-cast.rs rename to src/test/ui/fat-ptr-cast.rs index bc2dc1cc5d4c8..0802963ad228f 100644 --- a/src/test/compile-fail/fat-ptr-cast.rs +++ b/src/test/ui/fat-ptr-cast.rs @@ -18,14 +18,12 @@ fn main() { let q = a.as_ptr(); a as usize; //~ ERROR casting - //~^ HELP cast through a raw pointer first a as isize; //~ ERROR casting a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid b as usize; //~ ERROR non-primitive cast p as usize; //~^ ERROR casting - //~^^ HELP cast through a thin pointer // #22955 q as *const [i32]; //~ ERROR cannot cast diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr new file mode 100644 index 0000000000000..35a97749e0024 --- /dev/null +++ b/src/test/ui/fat-ptr-cast.stderr @@ -0,0 +1,62 @@ +error[E0606]: casting `&[i32]` as `usize` is invalid + --> $DIR/fat-ptr-cast.rs:20:5 + | +20 | a as usize; //~ ERROR casting + | ^^^^^^^^^^ + | + = help: cast through a raw pointer first + +error[E0606]: casting `&[i32]` as `isize` is invalid + --> $DIR/fat-ptr-cast.rs:21:5 + | +21 | a as isize; //~ ERROR casting + | ^^^^^^^^^^ + +error[E0606]: casting `&[i32]` as `i16` is invalid + --> $DIR/fat-ptr-cast.rs:22:5 + | +22 | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid + | ^^^^^^^^ + +error[E0606]: casting `&[i32]` as `u32` is invalid + --> $DIR/fat-ptr-cast.rs:23:5 + | +23 | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid + | ^^^^^^^^ + +error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize` + --> $DIR/fat-ptr-cast.rs:24:5 + | +24 | b as usize; //~ ERROR non-primitive cast + | ^^^^^^^^^^ + | + = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait + +error[E0606]: casting `*const [i32]` as `usize` is invalid + --> $DIR/fat-ptr-cast.rs:25:5 + | +25 | p as usize; + | ^^^^^^^^^^ + | + = help: cast through a thin pointer first + +error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]` + --> $DIR/fat-ptr-cast.rs:29:5 + | +29 | q as *const [i32]; //~ ERROR cannot cast + | ^^^^^^^^^^^^^^^^^ + +error[E0606]: casting `usize` as `*mut Trait + 'static` is invalid + --> $DIR/fat-ptr-cast.rs:32:37 + | +32 | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting + | ^^^^^^^^^^^ + +error[E0606]: casting `usize` as `*const str` is invalid + --> $DIR/fat-ptr-cast.rs:33:32 + | +33 | let mut fail: *const str = 0 as *const str; //~ ERROR casting + | ^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/src/test/ui/feature-gate-decl_macro.rs b/src/test/ui/feature-gate-decl_macro.rs index c5c83977c77fd..4cb34c8274d8d 100644 --- a/src/test/ui/feature-gate-decl_macro.rs +++ b/src/test/ui/feature-gate-decl_macro.rs @@ -11,6 +11,5 @@ #![allow(unused_macros)] macro m() {} //~ ERROR `macro` is experimental (see issue #39412) -//~| HELP add #![feature(decl_macro)] to the crate attributes to enable fn main() {} diff --git a/src/test/ui/feature-gate-may-dangle.rs b/src/test/ui/feature-gate-may-dangle.rs index 0bf1e93d9aace..ace9fe9ab2759 100644 --- a/src/test/ui/feature-gate-may-dangle.rs +++ b/src/test/ui/feature-gate-may-dangle.rs @@ -17,6 +17,5 @@ struct Pt(A); impl<#[may_dangle] A> Drop for Pt { //~^ ERROR may_dangle has unstable semantics and may be removed in the future - //~| HELP add #![feature(dropck_eyepatch)] to the crate attributes to enable fn drop(&mut self) { } } diff --git a/src/test/ui/feature-gate-repr128.rs b/src/test/ui/feature-gate-repr128.rs index 96fffa6cdd0dc..f5753f1c7fbe1 100644 --- a/src/test/ui/feature-gate-repr128.rs +++ b/src/test/ui/feature-gate-repr128.rs @@ -10,7 +10,6 @@ #[repr(u128)] enum A { //~ ERROR repr with 128-bit type is unstable - //~| HELP: add #![feature(repr128)] A(u64) } diff --git a/src/test/ui/feature-gate-repr128.stderr b/src/test/ui/feature-gate-repr128.stderr index 2d32eda3b3718..c59964887b58f 100644 --- a/src/test/ui/feature-gate-repr128.stderr +++ b/src/test/ui/feature-gate-repr128.stderr @@ -2,9 +2,8 @@ error: repr with 128-bit type is unstable (see issue #35118) --> $DIR/feature-gate-repr128.rs:12:1 | 12 | / enum A { //~ ERROR repr with 128-bit type is unstable -13 | | //~| HELP: add #![feature(repr128)] -14 | | A(u64) -15 | | } +13 | | A(u64) +14 | | } | |_^ | = help: add #![feature(repr128)] to the crate attributes to enable diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/ui/generic-type-less-params-with-defaults.rs similarity index 93% rename from src/test/compile-fail/generic-type-less-params-with-defaults.rs rename to src/test/ui/generic-type-less-params-with-defaults.rs index 9b19e09eeae76..c873fa676008d 100644 --- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs +++ b/src/test/ui/generic-type-less-params-with-defaults.rs @@ -18,5 +18,4 @@ struct Vec( fn main() { let _: Vec; //~^ ERROR wrong number of type arguments: expected at least 1, found 0 [E0243] - //~| NOTE expected at least 1 type argument } diff --git a/src/test/ui/generic-type-less-params-with-defaults.stderr b/src/test/ui/generic-type-less-params-with-defaults.stderr new file mode 100644 index 0000000000000..0351923eff651 --- /dev/null +++ b/src/test/ui/generic-type-less-params-with-defaults.stderr @@ -0,0 +1,8 @@ +error[E0243]: wrong number of type arguments: expected at least 1, found 0 + --> $DIR/generic-type-less-params-with-defaults.rs:19:12 + | +19 | let _: Vec; + | ^^^ expected at least 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/generic-type-more-params-with-defaults.rs b/src/test/ui/generic-type-more-params-with-defaults.rs similarity index 93% rename from src/test/compile-fail/generic-type-more-params-with-defaults.rs rename to src/test/ui/generic-type-more-params-with-defaults.rs index b5764ef89ab54..0d1b1943ca220 100644 --- a/src/test/compile-fail/generic-type-more-params-with-defaults.rs +++ b/src/test/ui/generic-type-more-params-with-defaults.rs @@ -18,5 +18,4 @@ struct Vec( fn main() { let _: Vec; //~^ ERROR wrong number of type arguments: expected at most 2, found 3 [E0244] - //~| NOTE expected at most 2 type arguments } diff --git a/src/test/ui/generic-type-more-params-with-defaults.stderr b/src/test/ui/generic-type-more-params-with-defaults.stderr new file mode 100644 index 0000000000000..11ce6b1656ded --- /dev/null +++ b/src/test/ui/generic-type-more-params-with-defaults.stderr @@ -0,0 +1,8 @@ +error[E0244]: wrong number of type arguments: expected at most 2, found 3 + --> $DIR/generic-type-more-params-with-defaults.rs:19:12 + | +19 | let _: Vec; + | ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments + +error: aborting due to previous error + diff --git a/src/test/compile-fail/if-let-arm-types.rs b/src/test/ui/if-let-arm-types.rs similarity index 90% rename from src/test/compile-fail/if-let-arm-types.rs rename to src/test/ui/if-let-arm-types.rs index 40013a7ee43bb..331fdc444ca5a 100644 --- a/src/test/compile-fail/if-let-arm-types.rs +++ b/src/test/ui/if-let-arm-types.rs @@ -14,7 +14,7 @@ fn main() { //~| expected type `()` //~| found type `{integer}` () - } else { //~ NOTE: `if let` arm with an incompatible type + } else { 1 }; } diff --git a/src/test/ui/if-let-arm-types.stderr b/src/test/ui/if-let-arm-types.stderr new file mode 100644 index 0000000000000..fb8e00bfa94ea --- /dev/null +++ b/src/test/ui/if-let-arm-types.stderr @@ -0,0 +1,25 @@ +error[E0308]: `if let` arms have incompatible types + --> $DIR/if-let-arm-types.rs:12:5 + | +12 | / if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types +13 | | //~^ expected (), found integral variable +14 | | //~| expected type `()` +15 | | //~| found type `{integer}` +... | +18 | | 1 +19 | | }; + | |_____^ expected (), found integral variable + | + = note: expected type `()` + found type `{integer}` +note: `if let` arm with an incompatible type + --> $DIR/if-let-arm-types.rs:17:12 + | +17 | } else { + | ____________^ +18 | | 1 +19 | | }; + | |_____^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/impl-duplicate-methods.rs b/src/test/ui/impl-duplicate-methods.rs similarity index 84% rename from src/test/compile-fail/impl-duplicate-methods.rs rename to src/test/ui/impl-duplicate-methods.rs index f6e9ab2d614bc..884991407512f 100644 --- a/src/test/compile-fail/impl-duplicate-methods.rs +++ b/src/test/ui/impl-duplicate-methods.rs @@ -11,10 +11,9 @@ struct Foo; impl Foo { - fn orange(&self) {} //~ NOTE previous definition of `orange` here + fn orange(&self) {} fn orange(&self) {} //~^ ERROR duplicate definition - //~| NOTE duplicate definition } fn main() {} diff --git a/src/test/ui/impl-duplicate-methods.stderr b/src/test/ui/impl-duplicate-methods.stderr new file mode 100644 index 0000000000000..73d470cc29e56 --- /dev/null +++ b/src/test/ui/impl-duplicate-methods.stderr @@ -0,0 +1,10 @@ +error[E0201]: duplicate definitions with name `orange`: + --> $DIR/impl-duplicate-methods.rs:15:5 + | +14 | fn orange(&self) {} + | ------------------- previous definition of `orange` here +15 | fn orange(&self) {} + | ^^^^^^^^^^^^^^^^^^^ duplicate definition + +error: aborting due to previous error + diff --git a/src/test/ui/impl-trait/auto-trait-leak.rs b/src/test/ui/impl-trait/auto-trait-leak.rs index 8a5033e76478b..705390e3b969c 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.rs +++ b/src/test/ui/impl-trait/auto-trait-leak.rs @@ -26,17 +26,9 @@ fn send(_: T) {} fn main() { send(before()); //~^ ERROR the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied - //~| NOTE `std::rc::Rc>` cannot be sent between threads safely - //~| NOTE required because it appears within the type `[closure - //~| NOTE required because it appears within the type `impl std::ops::Fn<(i32,)>` - //~| NOTE required by `send` send(after()); //~^ ERROR the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied - //~| NOTE `std::rc::Rc>` cannot be sent between threads safely - //~| NOTE required because it appears within the type `[closure - //~| NOTE required because it appears within the type `impl std::ops::Fn<(i32,)>` - //~| NOTE required by `send` } // Deferred path, main has to wait until typeck finishes, @@ -52,17 +44,12 @@ fn after() -> impl Fn(i32) { fn cycle1() -> impl Clone { //~^ ERROR unsupported cyclic reference between types/traits detected //~| cyclic reference - //~| NOTE the cycle begins when processing `cycle1`... - //~| NOTE ...which then requires processing `cycle1::{{impl-Trait}}`... - //~| NOTE ...which then again requires processing `cycle1`, completing the cycle. send(cycle2().clone()); Rc::new(Cell::new(5)) } fn cycle2() -> impl Clone { - //~^ NOTE ...which then requires processing `cycle2::{{impl-Trait}}`... - //~| NOTE ...which then requires processing `cycle2`... send(cycle1().clone()); Rc::new(String::from("foo")) diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr index 1c03e9d852645..ffd6a3fe4ffb1 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -10,41 +10,41 @@ error[E0277]: the trait bound `std::rc::Rc>: std::marker::S = note: required by `send` error[E0277]: the trait bound `std::rc::Rc>: std::marker::Send` is not satisfied in `impl std::ops::Fn<(i32,)>` - --> $DIR/auto-trait-leak.rs:34:5 + --> $DIR/auto-trait-leak.rs:30:5 | -34 | send(after()); +30 | send(after()); | ^^^^ `std::rc::Rc>` cannot be sent between threads safely | = help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc>` - = note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:46:5: 46:22 p:std::rc::Rc>]` + = note: required because it appears within the type `[closure@$DIR/auto-trait-leak.rs:38:5: 38:22 p:std::rc::Rc>]` = note: required because it appears within the type `impl std::ops::Fn<(i32,)>` = note: required by `send` error[E0391]: unsupported cyclic reference between types/traits detected - --> $DIR/auto-trait-leak.rs:52:1 + --> $DIR/auto-trait-leak.rs:44:1 | -52 | fn cycle1() -> impl Clone { +44 | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference | note: the cycle begins when processing `cycle1`... - --> $DIR/auto-trait-leak.rs:52:1 + --> $DIR/auto-trait-leak.rs:44:1 | -52 | fn cycle1() -> impl Clone { +44 | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which then requires processing `cycle2::{{impl-Trait}}`... - --> $DIR/auto-trait-leak.rs:63:16 + --> $DIR/auto-trait-leak.rs:52:16 | -63 | fn cycle2() -> impl Clone { +52 | fn cycle2() -> impl Clone { | ^^^^^^^^^^ note: ...which then requires processing `cycle2`... - --> $DIR/auto-trait-leak.rs:63:1 + --> $DIR/auto-trait-leak.rs:52:1 | -63 | fn cycle2() -> impl Clone { +52 | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which then requires processing `cycle1::{{impl-Trait}}`... - --> $DIR/auto-trait-leak.rs:52:16 + --> $DIR/auto-trait-leak.rs:44:16 | -52 | fn cycle1() -> impl Clone { +44 | fn cycle1() -> impl Clone { | ^^^^^^^^^^ = note: ...which then again requires processing `cycle1`, completing the cycle. diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs index 9120cdab59861..79d487493e877 100644 --- a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs +++ b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs @@ -29,5 +29,4 @@ fn main() { f1.foo(1usize); //~^ error: method named `foo` found for type `Bar` in the current scope - //~| help: items from traits can only be used if the trait is implemented and in scope } diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs index 15ddadf4c513d..28028922e3286 100644 --- a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs +++ b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs @@ -18,5 +18,4 @@ fn foo(f: F) where F: FnMut(Foo) {} fn main() { foo(|s| s.is_empty()); //~^ ERROR no method named `is_empty` found - //~| HELP items from traits can only be used if the trait is implemented and in scope } diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.rs b/src/test/ui/impl-trait/no-method-suggested-traits.rs index d9866772bdd37..07c0e6f529f3c 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.rs +++ b/src/test/ui/impl-trait/no-method-suggested-traits.rs @@ -11,12 +11,7 @@ // aux-build:no_method_suggested_traits.rs extern crate no_method_suggested_traits; -struct Foo; //~ HELP perhaps add a `use` for it -//~^ HELP perhaps add a `use` for it -//~| HELP perhaps add a `use` for it -//~| HELP perhaps add a `use` for it -//~| HELP perhaps add a `use` for one of them -//~| HELP perhaps add a `use` for one of them +struct Foo; enum Bar { X } mod foo { @@ -44,57 +39,41 @@ fn main() { 'a'.method(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is in scope std::rc::Rc::new(&mut Box::new(&'a')).method(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is in scope 1i32.method(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is in scope std::rc::Rc::new(&mut Box::new(&1i32)).method(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is in scope Foo.method(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope std::rc::Rc::new(&mut Box::new(&Foo)).method(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope 1u64.method2(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope std::rc::Rc::new(&mut Box::new(&1u64)).method2(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope no_method_suggested_traits::Foo.method2(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope no_method_suggested_traits::Bar::X.method2(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope Foo.method3(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope std::rc::Rc::new(&mut Box::new(&Foo)).method3(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope Bar::X.method3(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); //~^ ERROR no method named - //~| HELP items from traits can only be used if the trait is implemented and in scope // should have no help: 1_usize.method3(); //~ ERROR no method named diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index 2d519c11b948e..4517f09d07c32 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `method` found for type `u32` in the current scope - --> $DIR/no-method-suggested-traits.rs:38:10 + --> $DIR/no-method-suggested-traits.rs:33:10 | -38 | 1u32.method(); +33 | 1u32.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -17,9 +17,9 @@ help: the following traits are implemented but not in scope, perhaps add a `use` | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&u32>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:41:44 + --> $DIR/no-method-suggested-traits.rs:36:44 | -41 | std::rc::Rc::new(&mut Box::new(&1u32)).method(); +36 | std::rc::Rc::new(&mut Box::new(&1u32)).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -35,9 +35,9 @@ help: the following traits are implemented but not in scope, perhaps add a `use` | error[E0599]: no method named `method` found for type `char` in the current scope - --> $DIR/no-method-suggested-traits.rs:45:9 + --> $DIR/no-method-suggested-traits.rs:40:9 | -45 | 'a'.method(); +40 | 'a'.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -47,9 +47,9 @@ help: the following trait is implemented but not in scope, perhaps add a `use` f | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&char>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:48:43 + --> $DIR/no-method-suggested-traits.rs:42:43 | -48 | std::rc::Rc::new(&mut Box::new(&'a')).method(); +42 | std::rc::Rc::new(&mut Box::new(&'a')).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -59,9 +59,9 @@ help: the following trait is implemented but not in scope, perhaps add a `use` f | error[E0599]: no method named `method` found for type `i32` in the current scope - --> $DIR/no-method-suggested-traits.rs:52:10 + --> $DIR/no-method-suggested-traits.rs:45:10 | -52 | 1i32.method(); +45 | 1i32.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -71,9 +71,9 @@ help: the following trait is implemented but not in scope, perhaps add a `use` f | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&i32>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:55:44 + --> $DIR/no-method-suggested-traits.rs:47:44 | -55 | std::rc::Rc::new(&mut Box::new(&1i32)).method(); +47 | std::rc::Rc::new(&mut Box::new(&1i32)).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -83,12 +83,12 @@ help: the following trait is implemented but not in scope, perhaps add a `use` f | error[E0599]: no method named `method` found for type `Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:59:9 + --> $DIR/no-method-suggested-traits.rs:50:9 | -14 | struct Foo; //~ HELP perhaps add a `use` for it +14 | struct Foo; | ----------- method `method` not found for this ... -59 | Foo.method(); +50 | Foo.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -101,9 +101,9 @@ error[E0599]: no method named `method` found for type `Foo` in the current scope candidate #6: `no_method_suggested_traits::Reexported` error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:62:43 + --> $DIR/no-method-suggested-traits.rs:52:43 | -62 | std::rc::Rc::new(&mut Box::new(&Foo)).method(); +52 | std::rc::Rc::new(&mut Box::new(&Foo)).method(); | ^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -116,9 +116,9 @@ error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::box candidate #6: `no_method_suggested_traits::Reexported` error[E0599]: no method named `method2` found for type `u64` in the current scope - --> $DIR/no-method-suggested-traits.rs:66:10 + --> $DIR/no-method-suggested-traits.rs:55:10 | -66 | 1u64.method2(); +55 | 1u64.method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -126,9 +126,9 @@ error[E0599]: no method named `method2` found for type `u64` in the current scop candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&u64>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:69:44 + --> $DIR/no-method-suggested-traits.rs:57:44 | -69 | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); +57 | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -136,9 +136,9 @@ error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::bo candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:73:37 + --> $DIR/no-method-suggested-traits.rs:60:37 | -73 | no_method_suggested_traits::Foo.method2(); +60 | no_method_suggested_traits::Foo.method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -146,9 +146,9 @@ error[E0599]: no method named `method2` found for type `no_method_suggested_trai candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:76:71 + --> $DIR/no-method-suggested-traits.rs:62:71 | -76 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); +62 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -156,9 +156,9 @@ error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::bo candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:79:40 + --> $DIR/no-method-suggested-traits.rs:64:40 | -79 | no_method_suggested_traits::Bar::X.method2(); +64 | no_method_suggested_traits::Bar::X.method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -166,9 +166,9 @@ error[E0599]: no method named `method2` found for type `no_method_suggested_trai candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:82:74 + --> $DIR/no-method-suggested-traits.rs:66:74 | -82 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); +66 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -176,12 +176,12 @@ error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::bo candidate #1: `foo::Bar` error[E0599]: no method named `method3` found for type `Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:86:9 + --> $DIR/no-method-suggested-traits.rs:69:9 | -14 | struct Foo; //~ HELP perhaps add a `use` for it +14 | struct Foo; | ----------- method `method3` not found for this ... -86 | Foo.method3(); +69 | Foo.method3(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -189,9 +189,9 @@ error[E0599]: no method named `method3` found for type `Foo` in the current scop candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:89:43 + --> $DIR/no-method-suggested-traits.rs:71:43 | -89 | std::rc::Rc::new(&mut Box::new(&Foo)).method3(); +71 | std::rc::Rc::new(&mut Box::new(&Foo)).method3(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -199,12 +199,12 @@ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::bo candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:92:12 + --> $DIR/no-method-suggested-traits.rs:73:12 | -20 | enum Bar { X } +15 | enum Bar { X } | -------- method `method3` not found for this ... -92 | Bar::X.method3(); +73 | Bar::X.method3(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -212,9 +212,9 @@ error[E0599]: no method named `method3` found for type `Bar` in the current scop candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:95:46 + --> $DIR/no-method-suggested-traits.rs:75:46 | -95 | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); +75 | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); | ^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -222,40 +222,40 @@ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::bo candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `usize` in the current scope - --> $DIR/no-method-suggested-traits.rs:100:13 - | -100 | 1_usize.method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:79:13 + | +79 | 1_usize.method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:101:47 - | -101 | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:80:47 + | +80 | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:102:37 - | -102 | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:81:37 + | +81 | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:103:71 - | -103 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:82:71 + | +82 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); + | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:105:40 - | -105 | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:84:40 + | +84 | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named + | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:106:74 - | -106 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); - | ^^^^^^^ + --> $DIR/no-method-suggested-traits.rs:85:74 + | +85 | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); + | ^^^^^^^ error: aborting due to 24 previous errors diff --git a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs b/src/test/ui/impl-unused-rps-in-assoc-type.rs similarity index 92% rename from src/test/compile-fail/impl-unused-rps-in-assoc-type.rs rename to src/test/ui/impl-unused-rps-in-assoc-type.rs index d48433ee928f1..23401db21d890 100644 --- a/src/test/compile-fail/impl-unused-rps-in-assoc-type.rs +++ b/src/test/ui/impl-unused-rps-in-assoc-type.rs @@ -19,7 +19,6 @@ trait Fun { struct Holder { x: String } impl<'a> Fun for Holder { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter type Output = &'a str; fn call<'b>(&'b self) -> &'b str { &self.x[..] diff --git a/src/test/ui/impl-unused-rps-in-assoc-type.stderr b/src/test/ui/impl-unused-rps-in-assoc-type.stderr new file mode 100644 index 0000000000000..ec261ed63b1e8 --- /dev/null +++ b/src/test/ui/impl-unused-rps-in-assoc-type.stderr @@ -0,0 +1,8 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/impl-unused-rps-in-assoc-type.rs:21:6 + | +21 | impl<'a> Fun for Holder { //~ ERROR E0207 + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + diff --git a/src/test/compile-fail/imports/auxiliary/two_macros.rs b/src/test/ui/imports/auxiliary/two_macros.rs similarity index 100% rename from src/test/compile-fail/imports/auxiliary/two_macros.rs rename to src/test/ui/imports/auxiliary/two_macros.rs diff --git a/src/test/compile-fail/imports/duplicate.rs b/src/test/ui/imports/duplicate.rs similarity index 55% rename from src/test/compile-fail/imports/duplicate.rs rename to src/test/ui/imports/duplicate.rs index 4b2a64155e5d8..dd2dcbe2e6808 100644 --- a/src/test/compile-fail/imports/duplicate.rs +++ b/src/test/ui/imports/duplicate.rs @@ -21,10 +21,8 @@ mod c { } mod d { - use a::foo; //~ NOTE previous import of the value `foo` here + use a::foo; use a::foo; //~ ERROR the name `foo` is defined multiple times - //~| NOTE `foo` reimported here - //~| NOTE `foo` must be defined only once in the value namespace of this module } mod e { @@ -33,37 +31,31 @@ mod e { } mod f { - pub use a::*; //~ NOTE `foo` could refer to the name imported here - pub use b::*; //~ NOTE `foo` could also refer to the name imported here + pub use a::*; + pub use b::*; } mod g { - pub use a::*; //~ NOTE `foo` could refer to the name imported here - pub use f::*; //~ NOTE `foo` could also refer to the name imported here + pub use a::*; + pub use f::*; } fn main() { e::foo(); f::foo(); //~ ERROR `foo` is ambiguous - //~| NOTE consider adding an explicit import of `foo` to disambiguate g::foo(); //~ ERROR `foo` is ambiguous - //~| NOTE consider adding an explicit import of `foo` to disambiguate } mod ambiguous_module_errors { pub mod m1 { pub use super::m1 as foo; } pub mod m2 { pub use super::m2 as foo; } - use self::m1::*; //~ NOTE - //~| NOTE - use self::m2::*; //~ NOTE - //~| NOTE + use self::m1::*; + use self::m2::*; use self::foo::bar; //~ ERROR `foo` is ambiguous - //~| NOTE fn f() { foo::bar(); //~ ERROR `foo` is ambiguous - //~| NOTE } } diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr new file mode 100644 index 0000000000000..30f2f517115f4 --- /dev/null +++ b/src/test/ui/imports/duplicate.stderr @@ -0,0 +1,88 @@ +error[E0252]: the name `foo` is defined multiple times + --> $DIR/duplicate.rs:25:9 + | +24 | use a::foo; + | ------ previous import of the value `foo` here +25 | use a::foo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^ `foo` reimported here + | + = note: `foo` must be defined only once in the value namespace of this module +help: You can use `as` to change the binding name of the import + | +25 | use a::foo as Otherfoo; //~ ERROR the name `foo` is defined multiple times + | ^^^^^^^^^^^^^^^^^^ + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:56:9 + | +56 | use self::foo::bar; //~ ERROR `foo` is ambiguous + | ^^^^^^^^^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:53:9 + | +53 | use self::m1::*; + | ^^^^^^^^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:54:9 + | +54 | use self::m2::*; + | ^^^^^^^^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:45:5 + | +45 | f::foo(); //~ ERROR `foo` is ambiguous + | ^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:34:13 + | +34 | pub use a::*; + | ^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:35:13 + | +35 | pub use b::*; + | ^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:46:5 + | +46 | g::foo(); //~ ERROR `foo` is ambiguous + | ^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:39:13 + | +39 | pub use a::*; + | ^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:40:13 + | +40 | pub use f::*; + | ^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: `foo` is ambiguous + --> $DIR/duplicate.rs:59:9 + | +59 | foo::bar(); //~ ERROR `foo` is ambiguous + | ^^^^^^^^ + | +note: `foo` could refer to the name imported here + --> $DIR/duplicate.rs:53:9 + | +53 | use self::m1::*; + | ^^^^^^^^^^^ +note: `foo` could also refer to the name imported here + --> $DIR/duplicate.rs:54:9 + | +54 | use self::m2::*; + | ^^^^^^^^^^^ + = note: consider adding an explicit import of `foo` to disambiguate + +error: aborting due to 5 previous errors + diff --git a/src/test/compile-fail/imports/macro-paths.rs b/src/test/ui/imports/macro-paths.rs similarity index 59% rename from src/test/compile-fail/imports/macro-paths.rs rename to src/test/ui/imports/macro-paths.rs index 7c19917acc476..88a6e1c0d92e6 100644 --- a/src/test/compile-fail/imports/macro-paths.rs +++ b/src/test/ui/imports/macro-paths.rs @@ -21,20 +21,18 @@ mod foo { } fn f() { - use foo::*; //~ NOTE could also refer to the name imported here + use foo::*; bar::m! { //~ ERROR ambiguous - //~| NOTE macro-expanded items do not shadow when used in a macro invocation path - mod bar { pub use two_macros::m; } //~ NOTE could refer to the name defined here + mod bar { pub use two_macros::m; } } } -pub mod baz { //~ NOTE could also refer to the name defined here +pub mod baz { pub use two_macros::m; } fn g() { baz::m! { //~ ERROR ambiguous - //~| NOTE macro-expanded items do not shadow when used in a macro invocation path - mod baz { pub use two_macros::m; } //~ NOTE could refer to the name defined here + mod baz { pub use two_macros::m; } } } diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr new file mode 100644 index 0000000000000..91b0b9756dad9 --- /dev/null +++ b/src/test/ui/imports/macro-paths.stderr @@ -0,0 +1,42 @@ +error: `bar` is ambiguous + --> $DIR/macro-paths.rs:25:5 + | +25 | bar::m! { //~ ERROR ambiguous + | ^^^^^^ + | +note: `bar` could refer to the name defined here + --> $DIR/macro-paths.rs:26:9 + | +26 | mod bar { pub use two_macros::m; } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `bar` could also refer to the name imported here + --> $DIR/macro-paths.rs:24:9 + | +24 | use foo::*; + | ^^^^^^ + = note: macro-expanded items do not shadow when used in a macro invocation path + +error: `baz` is ambiguous + --> $DIR/macro-paths.rs:35:5 + | +35 | baz::m! { //~ ERROR ambiguous + | ^^^^^^ + | +note: `baz` could refer to the name defined here + --> $DIR/macro-paths.rs:36:9 + | +36 | mod baz { pub use two_macros::m; } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `baz` could also refer to the name defined here + --> $DIR/macro-paths.rs:30:1 + | +30 | / pub mod baz { +31 | | pub use two_macros::m; +32 | | } + | |_^ + = note: macro-expanded items do not shadow when used in a macro invocation path + +error[E0601]: main function not found + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/imports/macros.rs b/src/test/ui/imports/macros.rs similarity index 65% rename from src/test/compile-fail/imports/macros.rs rename to src/test/ui/imports/macros.rs index 06b0964a3b145..98577d73ee0f6 100644 --- a/src/test/compile-fail/imports/macros.rs +++ b/src/test/ui/imports/macros.rs @@ -24,15 +24,14 @@ mod m1 { } mod m2 { - use two_macros::*; //~ NOTE could also refer + use two_macros::*; m! { //~ ERROR ambiguous - //~| NOTE macro-expanded macro imports do not shadow - use foo::m; //~ NOTE could refer to the name imported here + use foo::m; } } mod m3 { - use two_macros::m; //~ NOTE could also refer + use two_macros::m; fn f() { use two_macros::n as m; // This shadows the above import m!(); @@ -40,14 +39,13 @@ mod m3 { fn g() { m! { //~ ERROR ambiguous - //~| NOTE macro-expanded macro imports do not shadow - use two_macros::n as m; //~ NOTE could refer to the name imported here + use two_macros::n as m; } } } mod m4 { - macro_rules! m { () => {} } //~ NOTE could refer to the macro defined here - use two_macros::m; //~ NOTE could also refer to the macro imported here + macro_rules! m { () => {} } + use two_macros::m; m!(); //~ ERROR ambiguous } diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr new file mode 100644 index 0000000000000..0b67613eb14b6 --- /dev/null +++ b/src/test/ui/imports/macros.stderr @@ -0,0 +1,57 @@ +error: `m` is ambiguous + --> $DIR/macros.rs:50:5 + | +50 | m!(); //~ ERROR ambiguous + | ^ + | +note: `m` could refer to the macro defined here + --> $DIR/macros.rs:48:5 + | +48 | macro_rules! m { () => {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `m` could also refer to the macro imported here + --> $DIR/macros.rs:49:9 + | +49 | use two_macros::m; + | ^^^^^^^^^^^^^ + +error: `m` is ambiguous + --> $DIR/macros.rs:28:5 + | +28 | m! { //~ ERROR ambiguous + | ^ + | +note: `m` could refer to the name imported here + --> $DIR/macros.rs:29:13 + | +29 | use foo::m; + | ^^^^^^ +note: `m` could also refer to the name imported here + --> $DIR/macros.rs:27:9 + | +27 | use two_macros::*; + | ^^^^^^^^^^^^^ + = note: macro-expanded macro imports do not shadow + +error: `m` is ambiguous + --> $DIR/macros.rs:41:9 + | +41 | m! { //~ ERROR ambiguous + | ^ + | +note: `m` could refer to the name imported here + --> $DIR/macros.rs:42:17 + | +42 | use two_macros::n as m; + | ^^^^^^^^^^^^^^^^^^ +note: `m` could also refer to the name imported here + --> $DIR/macros.rs:34:9 + | +34 | use two_macros::m; + | ^^^^^^^^^^^^^ + = note: macro-expanded macro imports do not shadow + +error[E0601]: main function not found + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs b/src/test/ui/imports/rfc-1560-warning-cycle.rs similarity index 74% rename from src/test/compile-fail/imports/rfc-1560-warning-cycle.rs rename to src/test/ui/imports/rfc-1560-warning-cycle.rs index 95bdf5e9b1565..f94fc3633e341 100644 --- a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs +++ b/src/test/ui/imports/rfc-1560-warning-cycle.rs @@ -16,13 +16,11 @@ mod bar { struct Foo; mod baz { - use *; //~ NOTE `Foo` could refer to the name imported here - use bar::*; //~ NOTE `Foo` could also refer to the name imported here + use *; + use bar::*; fn f(_: Foo) {} //~^ ERROR `Foo` is ambiguous //~| WARN hard error in a future release - //~| NOTE see issue #38260 - //~| NOTE #[deny(legacy_imports)] on by default } } diff --git a/src/test/ui/imports/rfc-1560-warning-cycle.stderr b/src/test/ui/imports/rfc-1560-warning-cycle.stderr new file mode 100644 index 0000000000000..1fec73112721d --- /dev/null +++ b/src/test/ui/imports/rfc-1560-warning-cycle.stderr @@ -0,0 +1,16 @@ +error: `Foo` is ambiguous + --> $DIR/rfc-1560-warning-cycle.rs:21:17 + | +19 | use *; + | - `Foo` could refer to the name imported here +20 | use bar::*; + | ------ `Foo` could also refer to the name imported here +21 | fn f(_: Foo) {} + | ^^^ + | + = note: #[deny(legacy_imports)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #38260 + +error: aborting due to previous error + diff --git a/src/test/compile-fail/imports/shadow_builtin_macros.rs b/src/test/ui/imports/shadow_builtin_macros.rs similarity index 60% rename from src/test/compile-fail/imports/shadow_builtin_macros.rs rename to src/test/ui/imports/shadow_builtin_macros.rs index a7f1cf3c9d3ef..93de136c4051d 100644 --- a/src/test/compile-fail/imports/shadow_builtin_macros.rs +++ b/src/test/ui/imports/shadow_builtin_macros.rs @@ -23,17 +23,13 @@ mod m1 { } mod m2 { - use foo::*; //~ NOTE `panic` could refer to the name imported here + use foo::*; fn f() { panic!(); } //~ ERROR ambiguous - //~| NOTE `panic` is also a builtin macro - //~| NOTE consider adding an explicit import of `panic` to disambiguate } mod m3 { - ::two_macros::m!(use foo::panic;); //~ NOTE `panic` could refer to the name imported here + ::two_macros::m!(use foo::panic;); fn f() { panic!(); } //~ ERROR ambiguous - //~| NOTE `panic` is also a builtin macro - //~| NOTE macro-expanded macro imports do not shadow } mod m4 { @@ -44,14 +40,12 @@ mod m4 { mod m5 { macro_rules! m { () => { macro_rules! panic { () => {} } //~ ERROR `panic` is already in scope - //~| NOTE macro-expanded `macro_rules!`s may not shadow existing macros } } - m!(); //~ NOTE in this expansion - //~| NOTE in this expansion + m!(); panic!(); } -#[macro_use(n)] //~ NOTE `n` could also refer to the name imported here +#[macro_use(n)] extern crate two_macros; mod bar { pub use two_macros::m as n; @@ -63,9 +57,8 @@ mod m6 { } mod m7 { - use bar::*; //~ NOTE `n` could refer to the name imported here + use bar::*; n!(); //~ ERROR ambiguous - //~| NOTE consider adding an explicit import of `n` to disambiguate } fn main() {} diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr new file mode 100644 index 0000000000000..853ed98c30d4d --- /dev/null +++ b/src/test/ui/imports/shadow_builtin_macros.stderr @@ -0,0 +1,59 @@ +error: `panic` is already in scope + --> $DIR/shadow_builtin_macros.rs:42:9 + | +42 | macro_rules! panic { () => {} } //~ ERROR `panic` is already in scope + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +43 | } } +44 | m!(); + | ----- in this macro invocation + | + = note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560) + +error: `panic` is ambiguous + --> $DIR/shadow_builtin_macros.rs:27:14 + | +27 | fn f() { panic!(); } //~ ERROR ambiguous + | ^^^^^ + | +note: `panic` could refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:26:9 + | +26 | use foo::*; + | ^^^^^^ + = note: `panic` is also a builtin macro + = note: consider adding an explicit import of `panic` to disambiguate + +error: `panic` is ambiguous + --> $DIR/shadow_builtin_macros.rs:32:14 + | +32 | fn f() { panic!(); } //~ ERROR ambiguous + | ^^^^^ + | +note: `panic` could refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:31:26 + | +31 | ::two_macros::m!(use foo::panic;); + | ^^^^^^^^^^ + = note: `panic` is also a builtin macro + = note: macro-expanded macro imports do not shadow + +error: `n` is ambiguous + --> $DIR/shadow_builtin_macros.rs:61:5 + | +61 | n!(); //~ ERROR ambiguous + | ^ + | +note: `n` could refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:60:9 + | +60 | use bar::*; + | ^^^^^^ +note: `n` could also refer to the name imported here + --> $DIR/shadow_builtin_macros.rs:48:13 + | +48 | #[macro_use(n)] + | ^ + = note: consider adding an explicit import of `n` to disambiguate + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/impossible_range.rs b/src/test/ui/impossible_range.rs similarity index 91% rename from src/test/compile-fail/impossible_range.rs rename to src/test/ui/impossible_range.rs index e4465e9f6b611..330a9213bc71d 100644 --- a/src/test/compile-fail/impossible_range.rs +++ b/src/test/ui/impossible_range.rs @@ -19,9 +19,7 @@ pub fn main() { 0..1; ..=; //~ERROR inclusive range with no end - //~^HELP bounded at the end 0..=; //~ERROR inclusive range with no end - //~^HELP bounded at the end ..=1; 0..=1; } diff --git a/src/test/ui/impossible_range.stderr b/src/test/ui/impossible_range.stderr new file mode 100644 index 0000000000000..75c6d859621ab --- /dev/null +++ b/src/test/ui/impossible_range.stderr @@ -0,0 +1,18 @@ +error[E0586]: inclusive range with no end + --> $DIR/impossible_range.rs:21:8 + | +21 | ..=; //~ERROR inclusive range with no end + | ^ + | + = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) + +error[E0586]: inclusive range with no end + --> $DIR/impossible_range.rs:22:9 + | +22 | 0..=; //~ERROR inclusive range with no end + | ^ + | + = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/index-help.rs b/src/test/ui/index-help.rs similarity index 87% rename from src/test/compile-fail/index-help.rs rename to src/test/ui/index-help.rs index 2d37fc7925035..4a64d6c4cc518 100644 --- a/src/test/compile-fail/index-help.rs +++ b/src/test/ui/index-help.rs @@ -11,5 +11,4 @@ fn main() { let x = vec![1]; x[0i32]; //~ ERROR E0277 - //~| NOTE vector indices are of type `usize` or ranges of `usize` } diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr new file mode 100644 index 0000000000000..e1652b6c262c7 --- /dev/null +++ b/src/test/ui/index-help.stderr @@ -0,0 +1,10 @@ +error[E0277]: the trait bound `std::vec::Vec<{integer}>: std::ops::Index` is not satisfied + --> $DIR/index-help.rs:13:5 + | +13 | x[0i32]; //~ ERROR E0277 + | ^^^^^^^ vector indices are of type `usize` or ranges of `usize` + | + = help: the trait `std::ops::Index` is not implemented for `std::vec::Vec<{integer}>` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/invalid-path-in-const.rs b/src/test/ui/invalid-path-in-const.rs similarity index 100% rename from src/test/compile-fail/invalid-path-in-const.rs rename to src/test/ui/invalid-path-in-const.rs diff --git a/src/test/ui/invalid-path-in-const.stderr b/src/test/ui/invalid-path-in-const.stderr new file mode 100644 index 0000000000000..be1de60bca559 --- /dev/null +++ b/src/test/ui/invalid-path-in-const.stderr @@ -0,0 +1,8 @@ +error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in the current scope + --> $DIR/invalid-path-in-const.rs:12:18 + | +12 | fn f(a: [u8; u32::DOESNOTEXIST]) {} + | ^^^^^^^^^^^^^^^^^ associated item not found in `u32` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-10969.rs b/src/test/ui/issue-10969.rs similarity index 88% rename from src/test/compile-fail/issue-10969.rs rename to src/test/ui/issue-10969.rs index 0851020b1f1d8..4ab4a8b579abc 100644 --- a/src/test/compile-fail/issue-10969.rs +++ b/src/test/ui/issue-10969.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn func(i: i32) { //~NOTE defined here +fn func(i: i32) { i(); //~ERROR expected function, found `i32` } fn main() { - let i = 0i32; //~NOTE defined here + let i = 0i32; i(); //~ERROR expected function, found `i32` } diff --git a/src/test/ui/issue-10969.stderr b/src/test/ui/issue-10969.stderr new file mode 100644 index 0000000000000..8aea63e0bbdaa --- /dev/null +++ b/src/test/ui/issue-10969.stderr @@ -0,0 +1,26 @@ +error[E0618]: expected function, found `i32` + --> $DIR/issue-10969.rs:12:5 + | +12 | i(); //~ERROR expected function, found `i32` + | ^^^ + | +note: defined here + --> $DIR/issue-10969.rs:11:9 + | +11 | fn func(i: i32) { + | ^ + +error[E0618]: expected function, found `i32` + --> $DIR/issue-10969.rs:16:5 + | +16 | i(); //~ERROR expected function, found `i32` + | ^^^ + | +note: defined here + --> $DIR/issue-10969.rs:15:9 + | +15 | let i = 0i32; + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-11004.rs b/src/test/ui/issue-11004.rs similarity index 83% rename from src/test/compile-fail/issue-11004.rs rename to src/test/ui/issue-11004.rs index 069883424222e..503fa64751274 100644 --- a/src/test/compile-fail/issue-11004.rs +++ b/src/test/ui/issue-11004.rs @@ -15,9 +15,7 @@ struct A { x: i32, y: f64 } #[cfg(not(works))] unsafe fn access(n:*mut A) -> (i32, f64) { let x : i32 = n.x; //~ no field `x` on type `*mut A` - //~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).x` let y : f64 = n.y; //~ no field `y` on type `*mut A` - //~| NOTE `n` is a native pointer; perhaps you need to deref with `(*n).y` (x, y) } diff --git a/src/test/ui/issue-11004.stderr b/src/test/ui/issue-11004.stderr new file mode 100644 index 0000000000000..9b8c3df7d59c4 --- /dev/null +++ b/src/test/ui/issue-11004.stderr @@ -0,0 +1,18 @@ +error[E0609]: no field `x` on type `*mut A` + --> $DIR/issue-11004.rs:17:21 + | +17 | let x : i32 = n.x; //~ no field `x` on type `*mut A` + | ^ + | + = note: `n` is a native pointer; perhaps you need to deref with `(*n).x` + +error[E0609]: no field `y` on type `*mut A` + --> $DIR/issue-11004.rs:18:21 + | +18 | let y : f64 = n.y; //~ no field `y` on type `*mut A` + | ^ + | + = note: `n` is a native pointer; perhaps you need to deref with `(*n).y` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-11319.rs b/src/test/ui/issue-11319.rs similarity index 91% rename from src/test/compile-fail/issue-11319.rs rename to src/test/ui/issue-11319.rs index 8242fa1c2e979..20636ed1ea9e0 100644 --- a/src/test/compile-fail/issue-11319.rs +++ b/src/test/ui/issue-11319.rs @@ -16,7 +16,7 @@ fn main() { //~| expected bool, found () Some(5) => false, Some(2) => true, - None => (), //~ NOTE match arm with an incompatible type + None => (), _ => true } } diff --git a/src/test/ui/issue-11319.stderr b/src/test/ui/issue-11319.stderr new file mode 100644 index 0000000000000..b5db112797f22 --- /dev/null +++ b/src/test/ui/issue-11319.stderr @@ -0,0 +1,22 @@ +error[E0308]: match arms have incompatible types + --> $DIR/issue-11319.rs:12:5 + | +12 | / match Some(10) { +13 | | //~^ ERROR match arms have incompatible types +14 | | //~| expected type `bool` +15 | | //~| found type `()` +... | +20 | | _ => true +21 | | } + | |_____^ expected bool, found () + | + = note: expected type `bool` + found type `()` +note: match arm with an incompatible type + --> $DIR/issue-11319.rs:19:20 + | +19 | None => (), + | ^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-12187-1.rs b/src/test/ui/issue-12187-1.rs similarity index 87% rename from src/test/compile-fail/issue-12187-1.rs rename to src/test/ui/issue-12187-1.rs index a79021d3cd5d2..c429b73bc9544 100644 --- a/src/test/compile-fail/issue-12187-1.rs +++ b/src/test/ui/issue-12187-1.rs @@ -15,6 +15,4 @@ fn new() -> &'static T { fn main() { let &v = new(); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `_` - //~| NOTE consider giving the pattern a type } diff --git a/src/test/ui/issue-12187-1.stderr b/src/test/ui/issue-12187-1.stderr new file mode 100644 index 0000000000000..e36c278df6e41 --- /dev/null +++ b/src/test/ui/issue-12187-1.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-12187-1.rs:16:10 + | +16 | let &v = new(); + | -^ + | || + | |cannot infer type for `_` + | consider giving the pattern a type + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-12187-2.rs b/src/test/ui/issue-12187-2.rs similarity index 87% rename from src/test/compile-fail/issue-12187-2.rs rename to src/test/ui/issue-12187-2.rs index 38b3c5d4e9a64..733f597e7ac4a 100644 --- a/src/test/compile-fail/issue-12187-2.rs +++ b/src/test/ui/issue-12187-2.rs @@ -15,6 +15,4 @@ fn new<'r, T>() -> &'r T { fn main() { let &v = new(); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `_` - //~| NOTE consider giving the pattern a type } diff --git a/src/test/ui/issue-12187-2.stderr b/src/test/ui/issue-12187-2.stderr new file mode 100644 index 0000000000000..b72c23987ec3c --- /dev/null +++ b/src/test/ui/issue-12187-2.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-12187-2.rs:16:10 + | +16 | let &v = new(); + | -^ + | || + | |cannot infer type for `_` + | consider giving the pattern a type + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-12511.rs b/src/test/ui/issue-12511.rs similarity index 72% rename from src/test/compile-fail/issue-12511.rs rename to src/test/ui/issue-12511.rs index 0c3073a770141..e1335c7d558e1 100644 --- a/src/test/compile-fail/issue-12511.rs +++ b/src/test/ui/issue-12511.rs @@ -9,14 +9,11 @@ // except according to those terms. trait t1 : t2 { -//~^ NOTE the cycle begins when computing the supertraits of `t1`... -//~| NOTE ...which then requires computing the supertraits of `t2`... } trait t2 : t1 { //~^ ERROR unsupported cyclic reference between types/traits detected //~| cyclic reference -//~| NOTE ...which then again requires computing the supertraits of `t1`, completing the cycle } fn main() { } diff --git a/src/test/ui/issue-12511.stderr b/src/test/ui/issue-12511.stderr new file mode 100644 index 0000000000000..cbf005a70b028 --- /dev/null +++ b/src/test/ui/issue-12511.stderr @@ -0,0 +1,20 @@ +error[E0391]: unsupported cyclic reference between types/traits detected + --> $DIR/issue-12511.rs:14:1 + | +14 | trait t2 : t1 { + | ^^^^^^^^^^^^^ cyclic reference + | +note: the cycle begins when computing the supertraits of `t1`... + --> $DIR/issue-12511.rs:11:1 + | +11 | trait t1 : t2 { + | ^^^^^^^^^^^^^ +note: ...which then requires computing the supertraits of `t2`... + --> $DIR/issue-12511.rs:11:1 + | +11 | trait t1 : t2 { + | ^^^^^^^^^^^^^ + = note: ...which then again requires computing the supertraits of `t1`, completing the cycle. + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-13058.rs b/src/test/ui/issue-13058.rs similarity index 97% rename from src/test/compile-fail/issue-13058.rs rename to src/test/ui/issue-13058.rs index 27b23f083217d..dbcf9998ad937 100644 --- a/src/test/compile-fail/issue-13058.rs +++ b/src/test/ui/issue-13058.rs @@ -35,5 +35,4 @@ fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool fn main() { check((3, 5)); //~^ ERROR mismatched types -//~| HELP consider borrowing here } diff --git a/src/test/ui/issue-13058.stderr b/src/test/ui/issue-13058.stderr new file mode 100644 index 0000000000000..fb8fb058daa26 --- /dev/null +++ b/src/test/ui/issue-13058.stderr @@ -0,0 +1,23 @@ +error[E0621]: explicit lifetime required in the type of `cont` + --> $DIR/issue-13058.rs:24:26 + | +22 | fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool + | ---- consider changing the type of `cont` to `&'r T` +23 | { +24 | let cont_iter = cont.iter(); + | ^^^^ lifetime `'r` required + +error[E0308]: mismatched types + --> $DIR/issue-13058.rs:36:11 + | +36 | check((3, 5)); + | ^^^^^^ + | | + | expected reference, found tuple + | help: consider borrowing here: `&(3, 5)` + | + = note: expected type `&_` + found type `({integer}, {integer})` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/ui/issue-14092.rs similarity index 93% rename from src/test/compile-fail/issue-14092.rs rename to src/test/ui/issue-14092.rs index 85dd88e614fd7..449de26769ff3 100644 --- a/src/test/compile-fail/issue-14092.rs +++ b/src/test/ui/issue-14092.rs @@ -10,6 +10,5 @@ fn fn1(0: Box) {} //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0243] - //~| NOTE expected 1 type argument fn main() {} diff --git a/src/test/ui/issue-14092.stderr b/src/test/ui/issue-14092.stderr new file mode 100644 index 0000000000000..e0b5bdb93d80e --- /dev/null +++ b/src/test/ui/issue-14092.stderr @@ -0,0 +1,8 @@ +error[E0243]: wrong number of type arguments: expected 1, found 0 + --> $DIR/issue-14092.rs:11:11 + | +11 | fn fn1(0: Box) {} + | ^^^ expected 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-15260.rs b/src/test/ui/issue-15260.rs similarity index 73% rename from src/test/compile-fail/issue-15260.rs rename to src/test/ui/issue-15260.rs index 5f816d34c8445..6356ea81660df 100644 --- a/src/test/compile-fail/issue-15260.rs +++ b/src/test/ui/issue-15260.rs @@ -14,28 +14,22 @@ struct Foo { fn main() { let Foo { - a: _, //~ NOTE first use of `a` + a: _, a: _ //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern } = Foo { a: 29 }; let Foo { - a, //~ NOTE first use of `a` + a, a: _ //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern } = Foo { a: 29 }; let Foo { a, - //~^ NOTE first use of `a` - //~| NOTE first use of `a` a: _, //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern a: x //~^ ERROR field `a` bound multiple times in the pattern - //~| NOTE multiple uses of `a` in pattern } = Foo { a: 29 }; } diff --git a/src/test/ui/issue-15260.stderr b/src/test/ui/issue-15260.stderr new file mode 100644 index 0000000000000..aca2fa5ed0413 --- /dev/null +++ b/src/test/ui/issue-15260.stderr @@ -0,0 +1,35 @@ +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:18:9 + | +17 | a: _, + | ---- first use of `a` +18 | a: _ + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:24:9 + | +23 | a, + | - first use of `a` +24 | a: _ + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:30:9 + | +29 | a, + | - first use of `a` +30 | a: _, + | ^^^^ multiple uses of `a` in pattern + +error[E0025]: field `a` bound multiple times in the pattern + --> $DIR/issue-15260.rs:32:9 + | +29 | a, + | - first use of `a` +... +32 | a: x + | ^^^^ multiple uses of `a` in pattern + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-15524.rs b/src/test/ui/issue-15524.rs similarity index 76% rename from src/test/compile-fail/issue-15524.rs rename to src/test/ui/issue-15524.rs index 658a0c1546b9f..85214bd86336c 100644 --- a/src/test/compile-fail/issue-15524.rs +++ b/src/test/ui/issue-15524.rs @@ -12,20 +12,14 @@ const N: isize = 1; enum Foo { A = 1, - //~^ NOTE first use of `1isize` - //~| NOTE first use of `1isize` - //~| NOTE first use of `1isize` B = 1, //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` C = 0, D, //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` E = N, //~^ ERROR discriminant value `1isize` already exists - //~| NOTE enum already has `1isize` } diff --git a/src/test/ui/issue-15524.stderr b/src/test/ui/issue-15524.stderr new file mode 100644 index 0000000000000..9c77752be2022 --- /dev/null +++ b/src/test/ui/issue-15524.stderr @@ -0,0 +1,28 @@ +error[E0081]: discriminant value `1isize` already exists + --> $DIR/issue-15524.rs:15:9 + | +14 | A = 1, + | - first use of `1isize` +15 | B = 1, + | ^ enum already has `1isize` + +error[E0081]: discriminant value `1isize` already exists + --> $DIR/issue-15524.rs:18:5 + | +14 | A = 1, + | - first use of `1isize` +... +18 | D, + | ^ enum already has `1isize` + +error[E0081]: discriminant value `1isize` already exists + --> $DIR/issue-15524.rs:21:9 + | +14 | A = 1, + | - first use of `1isize` +... +21 | E = N, + | ^ enum already has `1isize` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-17263.rs b/src/test/ui/issue-17263.rs similarity index 74% rename from src/test/compile-fail/issue-17263.rs rename to src/test/ui/issue-17263.rs index 063afe285fad3..242327e93ce1b 100644 --- a/src/test/compile-fail/issue-17263.rs +++ b/src/test/ui/issue-17263.rs @@ -16,14 +16,8 @@ fn main() { let mut x: Box<_> = box Foo { a: 1, b: 2 }; let (a, b) = (&mut x.a, &mut x.b); //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time - //~| NOTE first mutable borrow occurs here (via `x.a`) - //~| NOTE second mutable borrow occurs here (via `x.b`) let mut foo: Box<_> = box Foo { a: 1, b: 2 }; let (c, d) = (&mut foo.a, &foo.b); //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable - //~| NOTE mutable borrow occurs here (via `foo.a`) - //~| NOTE immutable borrow occurs here (via `foo.b`) } -//~^ NOTE first borrow ends here -//~^^ NOTE mutable borrow ends here diff --git a/src/test/ui/issue-17263.stderr b/src/test/ui/issue-17263.stderr new file mode 100644 index 0000000000000..a762c0876b55a --- /dev/null +++ b/src/test/ui/issue-17263.stderr @@ -0,0 +1,24 @@ +error[E0499]: cannot borrow `x` (via `x.b`) as mutable more than once at a time + --> $DIR/issue-17263.rs:17:34 + | +17 | let (a, b) = (&mut x.a, &mut x.b); + | --- ^^^ second mutable borrow occurs here (via `x.b`) + | | + | first mutable borrow occurs here (via `x.a`) +... +23 | } + | - first borrow ends here + +error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is also borrowed as mutable (via `foo.a`) + --> $DIR/issue-17263.rs:21:32 + | +21 | let (c, d) = (&mut foo.a, &foo.b); + | ----- ^^^^^ immutable borrow occurs here (via `foo.b`) + | | + | mutable borrow occurs here (via `foo.a`) +22 | //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable +23 | } + | - mutable borrow ends here + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-17441.rs b/src/test/ui/issue-17441.rs similarity index 79% rename from src/test/compile-fail/issue-17441.rs rename to src/test/ui/issue-17441.rs index bddc9c13815e7..c7b077014616c 100644 --- a/src/test/compile-fail/issue-17441.rs +++ b/src/test/ui/issue-17441.rs @@ -11,17 +11,13 @@ fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` - //~^^ HELP consider using an implicit coercion to `&[usize]` instead let _bar = Box::new(1_usize) as std::fmt::Debug; //~^ ERROR cast to unsized type: `std::boxed::Box` as `std::fmt::Debug` - //~^^ HELP try casting to a `Box` instead let _baz = 1_usize as std::fmt::Debug; //~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug` - //~^^ HELP consider using a box or reference as appropriate let _quux = [1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]` - //~^^ HELP consider using a box or reference as appropriate } diff --git a/src/test/ui/issue-17441.stderr b/src/test/ui/issue-17441.stderr new file mode 100644 index 0000000000000..593507a5d4510 --- /dev/null +++ b/src/test/ui/issue-17441.stderr @@ -0,0 +1,46 @@ +error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` + --> $DIR/issue-17441.rs:12:16 + | +12 | let _foo = &[1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using an implicit coercion to `&[usize]` instead + --> $DIR/issue-17441.rs:12:16 + | +12 | let _foo = &[1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0620]: cast to unsized type: `std::boxed::Box` as `std::fmt::Debug` + --> $DIR/issue-17441.rs:15:16 + | +15 | let _bar = Box::new(1_usize) as std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^--------------- + | | + | help: try casting to a `Box` instead: `Box` + +error[E0620]: cast to unsized type: `usize` as `std::fmt::Debug` + --> $DIR/issue-17441.rs:18:16 + | +18 | let _baz = 1_usize as std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a box or reference as appropriate + --> $DIR/issue-17441.rs:18:16 + | +18 | let _baz = 1_usize as std::fmt::Debug; + | ^^^^^^^ + +error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` + --> $DIR/issue-17441.rs:21:17 + | +21 | let _quux = [1_usize, 2] as [usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider using a box or reference as appropriate + --> $DIR/issue-17441.rs:21:17 + | +21 | let _quux = [1_usize, 2] as [usize]; + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-18183.rs b/src/test/ui/issue-18183.rs similarity index 85% rename from src/test/compile-fail/issue-18183.rs rename to src/test/ui/issue-18183.rs index feab04531b7e1..2cad4a3175f4d 100644 --- a/src/test/compile-fail/issue-18183.rs +++ b/src/test/ui/issue-18183.rs @@ -9,6 +9,5 @@ // except according to those terms. pub struct Foo(Bar); //~ ERROR E0128 - //~| NOTE defaulted type parameters cannot be forward declared pub struct Baz(Foo); fn main() {} diff --git a/src/test/ui/issue-18183.stderr b/src/test/ui/issue-18183.stderr new file mode 100644 index 0000000000000..3105080226110 --- /dev/null +++ b/src/test/ui/issue-18183.stderr @@ -0,0 +1,8 @@ +error[E0128]: type parameters with a default cannot use forward declared identifiers + --> $DIR/issue-18183.rs:11:20 + | +11 | pub struct Foo(Bar); //~ ERROR E0128 + | ^^^ defaulted type parameters cannot be forward declared + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-18819.rs b/src/test/ui/issue-18819.rs similarity index 91% rename from src/test/compile-fail/issue-18819.rs rename to src/test/ui/issue-18819.rs index 148eea31ec6e3..c6f60f1cbba86 100644 --- a/src/test/compile-fail/issue-18819.rs +++ b/src/test/ui/issue-18819.rs @@ -19,12 +19,10 @@ impl Foo for X { } fn print_x(_: &Foo, extra: &str) { - //~^ NOTE defined here println!("{}", extra); } fn main() { print_x(X); //~^ ERROR E0061 - //~| NOTE expected 2 parameters } diff --git a/src/test/ui/issue-18819.stderr b/src/test/ui/issue-18819.stderr new file mode 100644 index 0000000000000..1cd899925caa5 --- /dev/null +++ b/src/test/ui/issue-18819.stderr @@ -0,0 +1,11 @@ +error[E0061]: this function takes 2 parameters but 1 parameter was supplied + --> $DIR/issue-18819.rs:26:5 + | +21 | fn print_x(_: &Foo, extra: &str) { + | ------------------------------------------- defined here +... +26 | print_x(X); + | ^^^^^^^^^^ expected 2 parameters + +error: aborting due to previous error + diff --git a/src/test/ui/issue-19100.rs b/src/test/ui/issue-19100.rs index bcadd94eb6fba..2032f23e6a30e 100644 --- a/src/test/ui/issue-19100.rs +++ b/src/test/ui/issue-19100.rs @@ -26,12 +26,10 @@ impl Foo { & Bar if true //~^ WARN pattern binding `Bar` is named the same as one of the variants of the type `Foo` -//~^^ HELP to match on a variant, consider making the path in the pattern qualified: `Foo::Bar` => println!("bar"), & Baz if false //~^ WARN pattern binding `Baz` is named the same as one of the variants of the type `Foo` -//~^^ HELP to match on a variant, consider making the path in the pattern qualified: `Foo::Baz` => println!("baz"), _ => () } diff --git a/src/test/ui/issue-19100.stderr b/src/test/ui/issue-19100.stderr index 45e2ef652d5a3..a567e86cfdb86 100644 --- a/src/test/ui/issue-19100.stderr +++ b/src/test/ui/issue-19100.stderr @@ -7,9 +7,9 @@ warning[E0170]: pattern binding `Bar` is named the same as one of the variants o = help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Bar` warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` - --> $DIR/issue-19100.rs:32:1 + --> $DIR/issue-19100.rs:31:1 | -32 | Baz if false +31 | Baz if false | ^^^ | = help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Baz` diff --git a/src/test/compile-fail/issue-19498.rs b/src/test/ui/issue-19498.rs similarity index 64% rename from src/test/compile-fail/issue-19498.rs rename to src/test/ui/issue-19498.rs index 7de16e5ecfeb2..30eea2efd150e 100644 --- a/src/test/compile-fail/issue-19498.rs +++ b/src/test/ui/issue-19498.rs @@ -8,19 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use self::A; //~ NOTE previous import of the module `A` here -use self::B; //~ NOTE previous import of the module `B` here +use self::A; +use self::B; mod A {} //~ ERROR the name `A` is defined multiple times //~| `A` redefined here -//~| NOTE `A` must be defined only once in the type namespace of this module pub mod B {} //~ ERROR the name `B` is defined multiple times //~| `B` redefined here -//~| NOTE `B` must be defined only once in the type namespace of this module mod C { - use C::D; //~ NOTE previous import of the module `D` here + use C::D; mod D {} //~ ERROR the name `D` is defined multiple times //~| `D` redefined here - //~| NOTE `D` must be defined only once in the type namespace of this module } fn main() {} diff --git a/src/test/ui/issue-19498.stderr b/src/test/ui/issue-19498.stderr new file mode 100644 index 0000000000000..e7a308eacfe78 --- /dev/null +++ b/src/test/ui/issue-19498.stderr @@ -0,0 +1,46 @@ +error[E0255]: the name `A` is defined multiple times + --> $DIR/issue-19498.rs:13:1 + | +11 | use self::A; + | ------- previous import of the module `A` here +12 | use self::B; +13 | mod A {} //~ ERROR the name `A` is defined multiple times + | ^^^^^^^^ `A` redefined here + | + = note: `A` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +11 | use self::A as OtherA; + | ^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `B` is defined multiple times + --> $DIR/issue-19498.rs:15:1 + | +12 | use self::B; + | ------- previous import of the module `B` here +... +15 | pub mod B {} //~ ERROR the name `B` is defined multiple times + | ^^^^^^^^^^^^ `B` redefined here + | + = note: `B` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +12 | use self::B as OtherB; + | ^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `D` is defined multiple times + --> $DIR/issue-19498.rs:19:5 + | +18 | use C::D; + | ---- previous import of the module `D` here +19 | mod D {} //~ ERROR the name `D` is defined multiple times + | ^^^^^^^^ `D` redefined here + | + = note: `D` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +18 | use C::D as OtherD; + | ^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-1962.rs b/src/test/ui/issue-1962.rs similarity index 100% rename from src/test/compile-fail/issue-1962.rs rename to src/test/ui/issue-1962.rs diff --git a/src/test/ui/issue-1962.stderr b/src/test/ui/issue-1962.stderr new file mode 100644 index 0000000000000..4e34898bebe69 --- /dev/null +++ b/src/test/ui/issue-1962.stderr @@ -0,0 +1,17 @@ +error: denote infinite loops with `loop { ... }` + --> $DIR/issue-1962.rs:14:3 + | +14 | while true { //~ ERROR denote infinite loops with `loop + | ^--------- + | | + | ___help: use `loop` + | | +15 | | i += 1; +16 | | if i == 5 { break; } +17 | | } + | |___^ + | + = note: requested on the command line with `-D while-true` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-19707.rs b/src/test/ui/issue-19707.rs similarity index 78% rename from src/test/compile-fail/issue-19707.rs rename to src/test/ui/issue-19707.rs index beeb7da6d3899..377aef2f7d7d5 100644 --- a/src/test/compile-fail/issue-19707.rs +++ b/src/test/ui/issue-19707.rs @@ -11,9 +11,7 @@ #![allow(dead_code)] 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 fn bar &u8>(f: &F) {} //~ ERROR missing lifetime specifier -//~^ HELP the signature does not say whether it is borrowed from argument 1 or argument 2 fn main() {} diff --git a/src/test/ui/issue-19707.stderr b/src/test/ui/issue-19707.stderr new file mode 100644 index 0000000000000..b4d4f6f1bbf8b --- /dev/null +++ b/src/test/ui/issue-19707.stderr @@ -0,0 +1,18 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-19707.rs:13:28 + | +13 | type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 + +error[E0106]: missing lifetime specifier + --> $DIR/issue-19707.rs:15:27 + | +15 | fn bar &u8>(f: &F) {} //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-19922.rs b/src/test/ui/issue-19922.rs similarity index 86% rename from src/test/compile-fail/issue-19922.rs rename to src/test/ui/issue-19922.rs index 938ccb343d427..a8350fe0986c0 100644 --- a/src/test/compile-fail/issue-19922.rs +++ b/src/test/ui/issue-19922.rs @@ -15,6 +15,4 @@ enum Homura { fn main() { let homura = Homura::Akemi { kaname: () }; //~^ ERROR variant `Homura::Akemi` has no field named `kaname` - //~| NOTE `Homura::Akemi` does not have this field - //~| NOTE available fields are: `madoka` } diff --git a/src/test/ui/issue-19922.stderr b/src/test/ui/issue-19922.stderr new file mode 100644 index 0000000000000..f96392441967f --- /dev/null +++ b/src/test/ui/issue-19922.stderr @@ -0,0 +1,10 @@ +error[E0559]: variant `Homura::Akemi` has no field named `kaname` + --> $DIR/issue-19922.rs:16:34 + | +16 | let homura = Homura::Akemi { kaname: () }; + | ^^^^^^^ `Homura::Akemi` does not have this field + | + = note: available fields are: `madoka` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-20692.rs b/src/test/ui/issue-20692.rs similarity index 67% rename from src/test/compile-fail/issue-20692.rs rename to src/test/ui/issue-20692.rs index 3e44053875552..0a4e7c8ee6bdd 100644 --- a/src/test/compile-fail/issue-20692.rs +++ b/src/test/ui/issue-20692.rs @@ -13,14 +13,9 @@ trait Array: Sized {} fn f(x: &T) { let _ = x //~^ ERROR `Array` cannot be made into an object - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE requirements on the impl of `std::ops::CoerceUnsized<&Array>` - //~| NOTE the trait `Array` cannot be made into an object as &Array; //~^ ERROR `Array` cannot be made into an object - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE the trait `Array` cannot be made into an object } fn main() {} diff --git a/src/test/ui/issue-20692.stderr b/src/test/ui/issue-20692.stderr new file mode 100644 index 0000000000000..2a5ddd1b6118f --- /dev/null +++ b/src/test/ui/issue-20692.stderr @@ -0,0 +1,19 @@ +error[E0038]: the trait `Array` cannot be made into an object + --> $DIR/issue-20692.rs:17:5 + | +17 | &Array; + | ^^^^^^ the trait `Array` cannot be made into an object + | + = note: the trait cannot require that `Self : Sized` + +error[E0038]: the trait `Array` cannot be made into an object + --> $DIR/issue-20692.rs:14:13 + | +14 | let _ = x + | ^ the trait `Array` cannot be made into an object + | + = note: the trait cannot require that `Self : Sized` + = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&Array>` for `&T` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-21546.rs b/src/test/ui/issue-21546.rs similarity index 56% rename from src/test/compile-fail/issue-21546.rs rename to src/test/ui/issue-21546.rs index b7dbc7c7210cb..da1669bc913f8 100644 --- a/src/test/compile-fail/issue-21546.rs +++ b/src/test/ui/issue-21546.rs @@ -12,66 +12,48 @@ #[allow(non_snake_case)] mod Foo { } -//~^ NOTE previous definition of the module `Foo` here #[allow(dead_code)] struct Foo; //~^ ERROR the name `Foo` is defined multiple times -//~| NOTE `Foo` redefined here -//~| NOTE `Foo` must be defined only once in the type namespace of this module #[allow(non_snake_case)] mod Bar { } -//~^ NOTE previous definition of the module `Bar` here #[allow(dead_code)] struct Bar(i32); //~^ ERROR the name `Bar` is defined multiple times -//~| NOTE `Bar` redefined here -//~| NOTE `Bar` must be defined only once in the type namespace of this module #[allow(dead_code)] struct Baz(i32); -//~^ NOTE previous definition of the type `Baz` here #[allow(non_snake_case)] mod Baz { } //~^ ERROR the name `Baz` is defined multiple times -//~| NOTE `Baz` redefined here -//~| NOTE `Baz` must be defined only once in the type namespace of this module #[allow(dead_code)] struct Qux { x: bool } -//~^ NOTE previous definition of the type `Qux` here #[allow(non_snake_case)] mod Qux { } //~^ ERROR the name `Qux` is defined multiple times -//~| NOTE `Qux` redefined here -//~| NOTE `Qux` must be defined only once in the type namespace of this module #[allow(dead_code)] struct Quux; -//~^ NOTE previous definition of the type `Quux` here #[allow(non_snake_case)] mod Quux { } //~^ ERROR the name `Quux` is defined multiple times -//~| NOTE `Quux` redefined here -//~| NOTE `Quux` must be defined only once in the type namespace of this module #[allow(dead_code)] enum Corge { A, B } -//~^ NOTE previous definition of the type `Corge` here #[allow(non_snake_case)] mod Corge { } //~^ ERROR the name `Corge` is defined multiple times -//~| NOTE `Corge` redefined here -//~| NOTE `Corge` must be defined only once in the type namespace of this module fn main() { } diff --git a/src/test/ui/issue-21546.stderr b/src/test/ui/issue-21546.stderr new file mode 100644 index 0000000000000..9ec8dcdd83a57 --- /dev/null +++ b/src/test/ui/issue-21546.stderr @@ -0,0 +1,68 @@ +error[E0428]: the name `Foo` is defined multiple times + --> $DIR/issue-21546.rs:17:1 + | +14 | mod Foo { } + | ----------- previous definition of the module `Foo` here +... +17 | struct Foo; + | ^^^^^^^^^^^ `Foo` redefined here + | + = note: `Foo` must be defined only once in the type namespace of this module + +error[E0428]: the name `Bar` is defined multiple times + --> $DIR/issue-21546.rs:24:1 + | +21 | mod Bar { } + | ----------- previous definition of the module `Bar` here +... +24 | struct Bar(i32); + | ^^^^^^^^^^^^^^^^ `Bar` redefined here + | + = note: `Bar` must be defined only once in the type namespace of this module + +error[E0428]: the name `Baz` is defined multiple times + --> $DIR/issue-21546.rs:32:1 + | +29 | struct Baz(i32); + | ---------------- previous definition of the type `Baz` here +... +32 | mod Baz { } + | ^^^^^^^^^^^ `Baz` redefined here + | + = note: `Baz` must be defined only once in the type namespace of this module + +error[E0428]: the name `Qux` is defined multiple times + --> $DIR/issue-21546.rs:40:1 + | +37 | struct Qux { x: bool } + | ---------------------- previous definition of the type `Qux` here +... +40 | mod Qux { } + | ^^^^^^^^^^^ `Qux` redefined here + | + = note: `Qux` must be defined only once in the type namespace of this module + +error[E0428]: the name `Quux` is defined multiple times + --> $DIR/issue-21546.rs:48:1 + | +45 | struct Quux; + | ------------ previous definition of the type `Quux` here +... +48 | mod Quux { } + | ^^^^^^^^^^^^ `Quux` redefined here + | + = note: `Quux` must be defined only once in the type namespace of this module + +error[E0428]: the name `Corge` is defined multiple times + --> $DIR/issue-21546.rs:56:1 + | +53 | enum Corge { A, B } + | ------------------- previous definition of the type `Corge` here +... +56 | mod Corge { } + | ^^^^^^^^^^^^^ `Corge` redefined here + | + = note: `Corge` must be defined only once in the type namespace of this module + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/issue-21600.rs b/src/test/ui/issue-21600.rs similarity index 82% rename from src/test/compile-fail/issue-21600.rs rename to src/test/ui/issue-21600.rs index 1d0473ec4b651..e4dfad2433c14 100644 --- a/src/test/compile-fail/issue-21600.rs +++ b/src/test/ui/issue-21600.rs @@ -19,10 +19,9 @@ impl A { fn main() { let mut x = A; - call_it(|| { //~ HELP consider changing this to accept closures that implement `FnMut` + call_it(|| { 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 consider changing this closure to take self by mutable reference }); } diff --git a/src/test/ui/issue-21600.stderr b/src/test/ui/issue-21600.stderr new file mode 100644 index 0000000000000..e177e8ede6263 --- /dev/null +++ b/src/test/ui/issue-21600.stderr @@ -0,0 +1,31 @@ +error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure + --> $DIR/issue-21600.rs:24:17 + | +24 | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + | ^^ + | +help: consider changing this to accept closures that implement `FnMut` + --> $DIR/issue-21600.rs:22:13 + | +22 | call_it(|| { + | _____________^ +23 | | call_it(|| x.gen()); +24 | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +25 | | //~^ ERROR cannot borrow data mutably in a captured outer +26 | | }); + | |_____^ + +error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure + --> $DIR/issue-21600.rs:24:20 + | +24 | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + | ^ + | +help: consider changing this closure to take self by mutable reference + --> $DIR/issue-21600.rs:24:17 + | +24 | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-21950.rs b/src/test/ui/issue-21950.rs similarity index 73% rename from src/test/compile-fail/issue-21950.rs rename to src/test/ui/issue-21950.rs index 935f3480db24a..f9328a58d0935 100644 --- a/src/test/compile-fail/issue-21950.rs +++ b/src/test/ui/issue-21950.rs @@ -16,8 +16,5 @@ fn main() { let x = &10 as &Add; //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types //~| ERROR E0191 - //~| NOTE missing associated type `Output` value } diff --git a/src/test/ui/issue-21950.stderr b/src/test/ui/issue-21950.stderr new file mode 100644 index 0000000000000..123d61a261db1 --- /dev/null +++ b/src/test/ui/issue-21950.stderr @@ -0,0 +1,16 @@ +error[E0393]: the type parameter `RHS` must be explicitly specified + --> $DIR/issue-21950.rs:17:14 + | +17 | &Add; + | ^^^ missing reference to `RHS` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified + --> $DIR/issue-21950.rs:17:14 + | +17 | &Add; + | ^^^ missing associated type `Output` value + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-22370.rs b/src/test/ui/issue-22370.rs similarity index 80% rename from src/test/compile-fail/issue-22370.rs rename to src/test/ui/issue-22370.rs index 51f342e3f0a43..4613c5977fd7f 100644 --- a/src/test/compile-fail/issue-22370.rs +++ b/src/test/ui/issue-22370.rs @@ -14,7 +14,5 @@ trait A {} fn f(a: &A) {} //~^ ERROR E0393 -//~| NOTE missing reference to `T` -//~| NOTE because of the default `Self` reference, type parameters must be specified on object types fn main() {} diff --git a/src/test/ui/issue-22370.stderr b/src/test/ui/issue-22370.stderr new file mode 100644 index 0000000000000..9498000ca56eb --- /dev/null +++ b/src/test/ui/issue-22370.stderr @@ -0,0 +1,10 @@ +error[E0393]: the type parameter `T` must be explicitly specified + --> $DIR/issue-22370.rs:15:10 + | +15 | fn f(a: &A) {} + | ^ missing reference to `T` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-22560.rs b/src/test/ui/issue-22560.rs similarity index 61% rename from src/test/compile-fail/issue-22560.rs rename to src/test/ui/issue-22560.rs index 914a3bd79d460..b1c636f2ef645 100644 --- a/src/test/compile-fail/issue-22560.rs +++ b/src/test/ui/issue-22560.rs @@ -14,15 +14,9 @@ use std::ops::{Add, Sub}; type Test = Add + //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types //~| ERROR E0191 - //~| NOTE missing associated type `Output` value Sub; //~^ ERROR E0393 - //~| NOTE missing reference to `RHS` - //~| NOTE because of the default `Self` reference, type parameters must be specified on object types //~| ERROR E0225 - //~| NOTE non-auto additional trait fn main() { } diff --git a/src/test/ui/issue-22560.stderr b/src/test/ui/issue-22560.stderr new file mode 100644 index 0000000000000..1c594cb6cb858 --- /dev/null +++ b/src/test/ui/issue-22560.stderr @@ -0,0 +1,34 @@ +error[E0393]: the type parameter `RHS` must be explicitly specified + --> $DIR/issue-22560.rs:15:13 + | +15 | type Test = Add + + | ^^^ missing reference to `RHS` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0393]: the type parameter `RHS` must be explicitly specified + --> $DIR/issue-22560.rs:18:13 + | +18 | Sub; + | ^^^ missing reference to `RHS` + | + = note: because of the default `Self` reference, type parameters must be specified on object types + +error[E0225]: only auto traits can be used as additional traits in a trait object + --> $DIR/issue-22560.rs:18:13 + | +18 | Sub; + | ^^^ non-auto additional trait + +error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified + --> $DIR/issue-22560.rs:15:13 + | +15 | type Test = Add + + | _____________^ +16 | | //~^ ERROR E0393 +17 | | //~| ERROR E0191 +18 | | Sub; + | |_______________^ missing associated type `Output` value + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-22886.rs b/src/test/ui/issue-22886.rs similarity index 92% rename from src/test/compile-fail/issue-22886.rs rename to src/test/ui/issue-22886.rs index d258a4a8b3325..4aa2571cad0cc 100644 --- a/src/test/compile-fail/issue-22886.rs +++ b/src/test/ui/issue-22886.rs @@ -21,7 +21,6 @@ fn crash_please() { struct Newtype(Option>); impl<'a> Iterator for Newtype { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter type Item = &'a Box; fn next(&mut self) -> Option<&Box> { diff --git a/src/test/ui/issue-22886.stderr b/src/test/ui/issue-22886.stderr new file mode 100644 index 0000000000000..23d05edc919b3 --- /dev/null +++ b/src/test/ui/issue-22886.stderr @@ -0,0 +1,8 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-22886.rs:23:6 + | +23 | impl<'a> Iterator for Newtype { //~ ERROR E0207 + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-22933-2.rs b/src/test/ui/issue-22933-2.rs similarity index 86% rename from src/test/compile-fail/issue-22933-2.rs rename to src/test/ui/issue-22933-2.rs index 583f2ace4ba05..e887c7760d693 100644 --- a/src/test/compile-fail/issue-22933-2.rs +++ b/src/test/ui/issue-22933-2.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -enum Delicious { //~ NOTE variant `PIE` not found here +enum Delicious { Pie = 0x1, Apple = 0x2, ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, //~^ ERROR no variant named `PIE` found for type `Delicious` - //~| NOTE variant not found in `Delicious` } fn main() {} diff --git a/src/test/ui/issue-22933-2.stderr b/src/test/ui/issue-22933-2.stderr new file mode 100644 index 0000000000000..8853d43408c00 --- /dev/null +++ b/src/test/ui/issue-22933-2.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant named `PIE` found for type `Delicious` in the current scope + --> $DIR/issue-22933-2.rs:14:44 + | +11 | enum Delicious { + | -------------- variant `PIE` not found here +... +14 | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, + | ^^^^^^^^^^^^^^ variant not found in `Delicious` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23041.rs b/src/test/ui/issue-23041.rs similarity index 90% rename from src/test/compile-fail/issue-23041.rs rename to src/test/ui/issue-23041.rs index 4dfad4ee3c385..1a9bb4c29f3e0 100644 --- a/src/test/compile-fail/issue-23041.rs +++ b/src/test/ui/issue-23041.rs @@ -14,5 +14,4 @@ fn main() fn bar(x:i32) ->i32 { 3*x }; let b:Box = Box::new(bar as fn(_)->_); b.downcast_ref::_>(); //~ ERROR E0282 - //~| NOTE cannot infer type for `_` } diff --git a/src/test/ui/issue-23041.stderr b/src/test/ui/issue-23041.stderr new file mode 100644 index 0000000000000..048ae5834e3c4 --- /dev/null +++ b/src/test/ui/issue-23041.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/issue-23041.rs:16:22 + | +16 | b.downcast_ref::_>(); //~ ERROR E0282 + | ^^^^^^^^ cannot infer type for `_` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23173.rs b/src/test/ui/issue-23173.rs similarity index 68% rename from src/test/compile-fail/issue-23173.rs rename to src/test/ui/issue-23173.rs index c0983eb0e5257..17e5317b9fe49 100644 --- a/src/test/compile-fail/issue-23173.rs +++ b/src/test/ui/issue-23173.rs @@ -9,11 +9,7 @@ // except according to those terms. enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } -//~^ NOTE variant `Homura` not found here struct Struct { - //~^ NOTE function or associated item `method` not found for this - //~| NOTE function or associated item `method` not found for this - //~| NOTE associated item `Assoc` not found for this a: usize, } @@ -22,14 +18,10 @@ fn use_token(token: &Token) { unimplemented!() } fn main() { use_token(&Token::Homura); //~^ ERROR no variant named `Homura` - //~| NOTE variant not found in `Token` Struct::method(); //~^ ERROR no function or associated item named `method` found for type - //~| NOTE function or associated item not found in `Struct` Struct::method; //~^ ERROR no function or associated item named `method` found for type - //~| NOTE function or associated item not found in `Struct` Struct::Assoc; //~^ ERROR no associated item named `Assoc` found for type `Struct` in - //~| NOTE associated item not found in `Struct` } diff --git a/src/test/ui/issue-23173.stderr b/src/test/ui/issue-23173.stderr new file mode 100644 index 0000000000000..38a22257ff843 --- /dev/null +++ b/src/test/ui/issue-23173.stderr @@ -0,0 +1,38 @@ +error[E0599]: no variant named `Homura` found for type `Token` in the current scope + --> $DIR/issue-23173.rs:19:16 + | +11 | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } + | ---------- variant `Homura` not found here +... +19 | use_token(&Token::Homura); + | ^^^^^^^^^^^^^ variant not found in `Token` + +error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope + --> $DIR/issue-23173.rs:21:5 + | +12 | struct Struct { + | ------------- function or associated item `method` not found for this +... +21 | Struct::method(); + | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + +error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope + --> $DIR/issue-23173.rs:23:5 + | +12 | struct Struct { + | ------------- function or associated item `method` not found for this +... +23 | Struct::method; + | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + +error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope + --> $DIR/issue-23173.rs:25:5 + | +12 | struct Struct { + | ------------- associated item `Assoc` not found for this +... +25 | Struct::Assoc; + | ^^^^^^^^^^^^^ associated item not found in `Struct` + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-23217.rs b/src/test/ui/issue-23217.rs similarity index 84% rename from src/test/compile-fail/issue-23217.rs rename to src/test/ui/issue-23217.rs index cce0b99c04d79..dc51adf42aad2 100644 --- a/src/test/compile-fail/issue-23217.rs +++ b/src/test/ui/issue-23217.rs @@ -8,10 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub enum SomeEnum { //~ NOTE variant `A` not found here +pub enum SomeEnum { B = SomeEnum::A, //~^ ERROR no variant named `A` found for type `SomeEnum` - //~| NOTE variant not found in `SomeEnum` } fn main() {} diff --git a/src/test/ui/issue-23217.stderr b/src/test/ui/issue-23217.stderr new file mode 100644 index 0000000000000..eae6c2de9c565 --- /dev/null +++ b/src/test/ui/issue-23217.stderr @@ -0,0 +1,10 @@ +error[E0599]: no variant named `A` found for type `SomeEnum` in the current scope + --> $DIR/issue-23217.rs:12:9 + | +11 | pub enum SomeEnum { + | ----------------- variant `A` not found here +12 | B = SomeEnum::A, + | ^^^^^^^^^^^ variant not found in `SomeEnum` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23302.rs b/src/test/ui/issue-23302.rs similarity index 77% rename from src/test/compile-fail/issue-23302.rs rename to src/test/ui/issue-23302.rs index 35f32d16a9a2a..2d93ab0c30c8f 100644 --- a/src/test/compile-fail/issue-23302.rs +++ b/src/test/ui/issue-23302.rs @@ -12,21 +12,17 @@ // the appropriate error (rather than, say, blowing the stack). enum X { A = X::A as isize, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant } // Since `Y::B` here defaults to `Y::A+1`, this is also a // recursive definition. enum Y { A = Y::B as isize, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant B, } const A: i32 = B; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant const B: i32 = A; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant fn main() { } diff --git a/src/test/ui/issue-23302.stderr b/src/test/ui/issue-23302.stderr new file mode 100644 index 0000000000000..4e93809fac374 --- /dev/null +++ b/src/test/ui/issue-23302.stderr @@ -0,0 +1,26 @@ +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:14:9 + | +14 | A = X::A as isize, //~ ERROR E0265 + | ^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:20:9 + | +20 | A = Y::B as isize, //~ ERROR E0265 + | ^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:24:1 + | +24 | const A: i32 = B; //~ ERROR E0265 + | ^^^^^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-23302.rs:26:1 + | +26 | const B: i32 = A; //~ ERROR E0265 + | ^^^^^^^^^^^^^^^^^ recursion not allowed in constant + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-23543.rs b/src/test/ui/issue-23543.rs similarity index 92% rename from src/test/compile-fail/issue-23543.rs rename to src/test/ui/issue-23543.rs index e1acc8eb475ac..4ed44154c4748 100644 --- a/src/test/compile-fail/issue-23543.rs +++ b/src/test/ui/issue-23543.rs @@ -16,7 +16,6 @@ pub trait D { fn f(self) where T: A; //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associated type not allowed here } fn main() {} diff --git a/src/test/ui/issue-23543.stderr b/src/test/ui/issue-23543.stderr new file mode 100644 index 0000000000000..e5181960753bd --- /dev/null +++ b/src/test/ui/issue-23543.stderr @@ -0,0 +1,8 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-23543.rs:17:17 + | +17 | where T: A; + | ^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23544.rs b/src/test/ui/issue-23544.rs similarity index 92% rename from src/test/compile-fail/issue-23544.rs rename to src/test/ui/issue-23544.rs index 3cd6f9ebc7185..1d7c2187045ea 100644 --- a/src/test/compile-fail/issue-23544.rs +++ b/src/test/ui/issue-23544.rs @@ -14,7 +14,6 @@ pub trait D { fn f(self) where T: A; //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associated type not allowed here } fn main() {} diff --git a/src/test/ui/issue-23544.stderr b/src/test/ui/issue-23544.stderr new file mode 100644 index 0000000000000..496a7aff7b731 --- /dev/null +++ b/src/test/ui/issue-23544.stderr @@ -0,0 +1,8 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-23544.rs:15:17 + | +15 | where T: A; + | ^^^^^^^^^^^^^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-23716.rs b/src/test/ui/issue-23716.rs similarity index 90% rename from src/test/compile-fail/issue-23716.rs rename to src/test/ui/issue-23716.rs index 5cf80dd172a3d..7b72e5689ba4d 100644 --- a/src/test/compile-fail/issue-23716.rs +++ b/src/test/ui/issue-23716.rs @@ -9,7 +9,6 @@ // except according to those terms. static foo: i32 = 0; -//~^ NOTE a static `foo` is defined here fn bar(foo: i32) {} //~^ ERROR function parameters cannot shadow statics @@ -20,7 +19,6 @@ mod submod { } use self::submod::answer; -//~^ NOTE a static `answer` is imported here fn question(answer: i32) {} //~^ ERROR function parameters cannot shadow statics diff --git a/src/test/ui/issue-23716.stderr b/src/test/ui/issue-23716.stderr new file mode 100644 index 0000000000000..2db67c7ec00dd --- /dev/null +++ b/src/test/ui/issue-23716.stderr @@ -0,0 +1,20 @@ +error[E0530]: function parameters cannot shadow statics + --> $DIR/issue-23716.rs:13:8 + | +11 | static foo: i32 = 0; + | -------------------- a static `foo` is defined here +12 | +13 | fn bar(foo: i32) {} + | ^^^ cannot be named the same as a static + +error[E0530]: function parameters cannot shadow statics + --> $DIR/issue-23716.rs:23:13 + | +21 | use self::submod::answer; + | -------------------- a static `answer` is imported here +22 | +23 | fn question(answer: i32) {} + | ^^^^^^ cannot be named the same as a static + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-24036.rs b/src/test/ui/issue-24036.rs similarity index 53% rename from src/test/compile-fail/issue-24036.rs rename to src/test/ui/issue-24036.rs index ac7e0f2e9a867..94ac17de4c0d0 100644 --- a/src/test/compile-fail/issue-24036.rs +++ b/src/test/ui/issue-24036.rs @@ -12,26 +12,15 @@ fn closure_to_loc() { let mut x = |c| c + 1; x = |c| c + 1; //~^ 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 - //~| expected closure, found a different closure - //~| expected type `[closure - //~| found type `[closure } fn closure_from_match() { let x = match 1usize { + //~^ ERROR match arms have incompatible types 1 => |c| c + 1, 2 => |c| c - 1, - //~^ NOTE match arm with an incompatible type _ => |c| c - 1 }; - //~^^^^^^ 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 - //~| expected closure, found a different closure - //~| expected type `[closure - //~| found type `[closure } fn main() { } diff --git a/src/test/ui/issue-24036.stderr b/src/test/ui/issue-24036.stderr new file mode 100644 index 0000000000000..1a70e90c0cc15 --- /dev/null +++ b/src/test/ui/issue-24036.stderr @@ -0,0 +1,63 @@ +error[E0308]: mismatched types + --> $DIR/issue-24036.rs:13:9 + | +13 | x = |c| c + 1; + | ^^^^^^^^^ expected closure, found a different closure + | + = note: expected type `[closure@$DIR/issue-24036.rs:12:17: 12:26]` + found type `[closure@$DIR/issue-24036.rs:13:9: 13:18]` +note: no two closures, even if identical, have the same type + --> $DIR/issue-24036.rs:13:9 + | +13 | x = |c| c + 1; + | ^^^^^^^^^ +help: consider boxing your closure and/or using it as a trait object + --> $DIR/issue-24036.rs:13:9 + | +13 | x = |c| c + 1; + | ^^^^^^^^^ + +error[E0308]: match arms have incompatible types + --> $DIR/issue-24036.rs:18:13 + | +18 | let x = match 1usize { + | _____________^ +19 | | //~^ ERROR match arms have incompatible types +20 | | 1 => |c| c + 1, +21 | | 2 => |c| c - 1, +22 | | _ => |c| c - 1 +23 | | }; + | |_____^ expected closure, found a different closure + | + = note: expected type `[closure@$DIR/issue-24036.rs:20:14: 20:23]` + found type `[closure@$DIR/issue-24036.rs:21:14: 21:23]` +note: no two closures, even if identical, have the same type + --> $DIR/issue-24036.rs:18:13 + | +18 | let x = match 1usize { + | _____________^ +19 | | //~^ ERROR match arms have incompatible types +20 | | 1 => |c| c + 1, +21 | | 2 => |c| c - 1, +22 | | _ => |c| c - 1 +23 | | }; + | |_____^ +help: consider boxing your closure and/or using it as a trait object + --> $DIR/issue-24036.rs:18:13 + | +18 | let x = match 1usize { + | _____________^ +19 | | //~^ ERROR match arms have incompatible types +20 | | 1 => |c| c + 1, +21 | | 2 => |c| c - 1, +22 | | _ => |c| c - 1 +23 | | }; + | |_____^ +note: match arm with an incompatible type + --> $DIR/issue-24036.rs:21:14 + | +21 | 2 => |c| c - 1, + | ^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-24081.rs b/src/test/ui/issue-24081.rs similarity index 56% rename from src/test/compile-fail/issue-24081.rs rename to src/test/ui/issue-24081.rs index dc8fc01bbfcfa..16530c509f28c 100644 --- a/src/test/compile-fail/issue-24081.rs +++ b/src/test/ui/issue-24081.rs @@ -8,26 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::ops::Add; //~ NOTE previous import of the trait `Add` here -use std::ops::Sub; //~ NOTE previous import of the trait `Sub` here -use std::ops::Mul; //~ NOTE previous import of the trait `Mul` here -use std::ops::Div; //~ NOTE previous import of the trait `Div` here -use std::ops::Rem; //~ NOTE previous import of the trait `Rem` here +use std::ops::Add; +use std::ops::Sub; +use std::ops::Mul; +use std::ops::Div; +use std::ops::Rem; type Add = bool; //~ ERROR the name `Add` is defined multiple times //~| `Add` redefined here -//~| NOTE `Add` must be defined only once in the type namespace of this module struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times //~| `Sub` redefined here -//~| NOTE `Sub` must be defined only once in the type namespace of this module enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times //~| `Mul` redefined here -//~| NOTE `Mul` must be defined only once in the type namespace of this module mod Div { } //~ ERROR the name `Div` is defined multiple times //~| `Div` redefined here -//~| NOTE `Div` must be defined only once in the type namespace of this module trait Rem { } //~ ERROR the name `Rem` is defined multiple times //~| `Rem` redefined here -//~| NOTE `Rem` must be defined only once in the type namespace of this module fn main() {} diff --git a/src/test/ui/issue-24081.stderr b/src/test/ui/issue-24081.stderr new file mode 100644 index 0000000000000..37a2fba3852c2 --- /dev/null +++ b/src/test/ui/issue-24081.stderr @@ -0,0 +1,77 @@ +error[E0255]: the name `Add` is defined multiple times + --> $DIR/issue-24081.rs:17:1 + | +11 | use std::ops::Add; + | ------------- previous import of the trait `Add` here +... +17 | type Add = bool; //~ ERROR the name `Add` is defined multiple times + | ^^^^^^^^^^^^^^^^ `Add` redefined here + | + = note: `Add` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +11 | use std::ops::Add as OtherAdd; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Sub` is defined multiple times + --> $DIR/issue-24081.rs:19:1 + | +12 | use std::ops::Sub; + | ------------- previous import of the trait `Sub` here +... +19 | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^ `Sub` redefined here + | + = note: `Sub` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +12 | use std::ops::Sub as OtherSub; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Mul` is defined multiple times + --> $DIR/issue-24081.rs:21:1 + | +13 | use std::ops::Mul; + | ------------- previous import of the trait `Mul` here +... +21 | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times + | ^^^^^^^^^^^^^^^^^ `Mul` redefined here + | + = note: `Mul` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +13 | use std::ops::Mul as OtherMul; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Div` is defined multiple times + --> $DIR/issue-24081.rs:23:1 + | +14 | use std::ops::Div; + | ------------- previous import of the trait `Div` here +... +23 | mod Div { } //~ ERROR the name `Div` is defined multiple times + | ^^^^^^^^^^^ `Div` redefined here + | + = note: `Div` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +14 | use std::ops::Div as OtherDiv; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0255]: the name `Rem` is defined multiple times + --> $DIR/issue-24081.rs:25:1 + | +15 | use std::ops::Rem; + | ------------- previous import of the trait `Rem` here +... +25 | trait Rem { } //~ ERROR the name `Rem` is defined multiple times + | ^^^^^^^^^^^^^^ `Rem` redefined here + | + = note: `Rem` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +15 | use std::ops::Rem as OtherRem; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + diff --git a/src/test/compile-fail/issue-24424.rs b/src/test/ui/issue-24424.rs similarity index 95% rename from src/test/compile-fail/issue-24424.rs rename to src/test/ui/issue-24424.rs index 8d4ea66f08197..8e9f675b5752c 100644 --- a/src/test/compile-fail/issue-24424.rs +++ b/src/test/ui/issue-24424.rs @@ -13,6 +13,5 @@ trait Trait0<'l0> {} impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} //~^ ERROR type annotations required: cannot resolve `T0: Trait0<'l0>` -//~^^ NOTE required by `Trait0` fn main() {} diff --git a/src/test/ui/issue-24424.stderr b/src/test/ui/issue-24424.stderr new file mode 100644 index 0000000000000..acdf348791b20 --- /dev/null +++ b/src/test/ui/issue-24424.stderr @@ -0,0 +1,10 @@ +error[E0283]: type annotations required: cannot resolve `T0: Trait0<'l0>` + --> $DIR/issue-24424.rs:14:1 + | +14 | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: required by `Trait0` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-25385.rs b/src/test/ui/issue-25385.rs similarity index 94% rename from src/test/compile-fail/issue-25385.rs rename to src/test/ui/issue-25385.rs index 4aacb6840e9d5..aa941bc569130 100644 --- a/src/test/compile-fail/issue-25385.rs +++ b/src/test/ui/issue-25385.rs @@ -17,7 +17,6 @@ macro_rules! foo { fn main() { let a = 1i32; foo!(a); - //~^ NOTE in this expansion of foo! foo!(1i32.foo()); //~^ ERROR no method named `foo` found for type `i32` in the current scope diff --git a/src/test/ui/issue-25385.stderr b/src/test/ui/issue-25385.stderr new file mode 100644 index 0000000000000..467cfc53388bc --- /dev/null +++ b/src/test/ui/issue-25385.stderr @@ -0,0 +1,17 @@ +error[E0599]: no method named `foo` found for type `i32` in the current scope + --> $DIR/issue-25385.rs:13:23 + | +13 | ($e:expr) => { $e.foo() } + | ^^^ +... +19 | foo!(a); + | -------- in this macro invocation + +error[E0599]: no method named `foo` found for type `i32` in the current scope + --> $DIR/issue-25385.rs:21:15 + | +21 | foo!(1i32.foo()); + | ^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-25793.rs b/src/test/ui/issue-25793.rs similarity index 86% rename from src/test/compile-fail/issue-25793.rs rename to src/test/ui/issue-25793.rs index ceefd583a5ca6..4f3d29216e443 100644 --- a/src/test/compile-fail/issue-25793.rs +++ b/src/test/ui/issue-25793.rs @@ -12,7 +12,6 @@ macro_rules! width( ($this:expr) => { $this.width.unwrap() //~^ ERROR cannot use `self.width` because it was mutably borrowed - //~| NOTE use of borrowed `*self` } ); @@ -27,8 +26,6 @@ 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/ui/issue-25793.stderr b/src/test/ui/issue-25793.stderr new file mode 100644 index 0000000000000..914cc6fc42677 --- /dev/null +++ b/src/test/ui/issue-25793.stderr @@ -0,0 +1,13 @@ +error[E0503]: cannot use `self.width` because it was mutably borrowed + --> $DIR/issue-25793.rs:13:9 + | +13 | $this.width.unwrap() + | ^^^^^^^^^^^ use of borrowed `*self` +... +28 | self.get_size(width!(self)) + | ---- ------------ in this macro invocation + | | + | borrow of `*self` occurs here + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-25826.rs b/src/test/ui/issue-25826.rs similarity index 93% rename from src/test/compile-fail/issue-25826.rs rename to src/test/ui/issue-25826.rs index 468282fa7cca9..00e1279d58a0e 100644 --- a/src/test/compile-fail/issue-25826.rs +++ b/src/test/ui/issue-25826.rs @@ -12,6 +12,5 @@ fn id(t: T) -> T { t } fn main() { const A: bool = id:: as *const () < id:: as *const (); //~^ ERROR raw pointers cannot be compared in constants [E0395] - //~^^ NOTE comparing raw pointers in static println!("{}", A); } diff --git a/src/test/ui/issue-25826.stderr b/src/test/ui/issue-25826.stderr new file mode 100644 index 0000000000000..3b6599ccbd6da --- /dev/null +++ b/src/test/ui/issue-25826.stderr @@ -0,0 +1,8 @@ +error[E0395]: raw pointers cannot be compared in constants + --> $DIR/issue-25826.rs:13:21 + | +13 | const A: bool = id:: as *const () < id:: as *const (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26056.rs b/src/test/ui/issue-26056.rs similarity index 86% rename from src/test/compile-fail/issue-26056.rs rename to src/test/ui/issue-26056.rs index ded685152d49b..2dad23514403b 100644 --- a/src/test/compile-fail/issue-26056.rs +++ b/src/test/ui/issue-26056.rs @@ -29,6 +29,4 @@ fn main() { let _ = &() as &Map; //~^ ERROR E0038 - //~| NOTE the trait cannot use `Self` as a type parameter - //~| NOTE the trait `Map` cannot be made into an object } diff --git a/src/test/ui/issue-26056.stderr b/src/test/ui/issue-26056.stderr new file mode 100644 index 0000000000000..b95438314c398 --- /dev/null +++ b/src/test/ui/issue-26056.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Map` cannot be made into an object + --> $DIR/issue-26056.rs:30:13 + | +30 | as &Map; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object + | + = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26093.rs b/src/test/ui/issue-26093.rs similarity index 86% rename from src/test/compile-fail/issue-26093.rs rename to src/test/ui/issue-26093.rs index 39a53648ccf8a..3489a2ca9be15 100644 --- a/src/test/compile-fail/issue-26093.rs +++ b/src/test/ui/issue-26093.rs @@ -12,11 +12,9 @@ macro_rules! not_an_lvalue { ($thing:expr) => { $thing = 42; //~^ ERROR invalid left-hand side expression - //~^^ NOTE left-hand of expression not valid } } fn main() { not_an_lvalue!(99); - //~^ NOTE in this expansion of not_an_lvalue! } diff --git a/src/test/ui/issue-26093.stderr b/src/test/ui/issue-26093.stderr new file mode 100644 index 0000000000000..c2b81b2ce43fd --- /dev/null +++ b/src/test/ui/issue-26093.stderr @@ -0,0 +1,11 @@ +error[E0070]: invalid left-hand side expression + --> $DIR/issue-26093.rs:13:9 + | +13 | $thing = 42; + | ^^^^^^^^^^^ left-hand of expression not valid +... +19 | not_an_lvalue!(99); + | ------------------- in this macro invocation + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26472.rs b/src/test/ui/issue-26472.rs similarity index 91% rename from src/test/compile-fail/issue-26472.rs rename to src/test/ui/issue-26472.rs index 0d59a897ef1af..9b25eb72f3d46 100644 --- a/src/test/compile-fail/issue-26472.rs +++ b/src/test/ui/issue-26472.rs @@ -20,5 +20,4 @@ fn main() { let s = sub::S::new(); let v = s.len; //~^ ERROR field `len` of struct `sub::S` is private - //~| NOTE a method `len` also exists, perhaps you wish to call it } diff --git a/src/test/ui/issue-26472.stderr b/src/test/ui/issue-26472.stderr new file mode 100644 index 0000000000000..5b61aa98c3f97 --- /dev/null +++ b/src/test/ui/issue-26472.stderr @@ -0,0 +1,10 @@ +error[E0616]: field `len` of struct `sub::S` is private + --> $DIR/issue-26472.rs:21:13 + | +21 | let v = s.len; + | ^^^^^ + | + = note: a method `len` also exists, perhaps you wish to call it + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-26638.rs b/src/test/ui/issue-26638.rs similarity index 77% rename from src/test/compile-fail/issue-26638.rs rename to src/test/ui/issue-26638.rs index 9b8c7b250763e..85a10588975e5 100644 --- a/src/test/compile-fail/issue-26638.rs +++ b/src/test/ui/issue-26638.rs @@ -10,16 +10,11 @@ fn parse_type(iter: Box+'static>) -> &str { iter.next() } //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP 2 lifetimes fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP lifetime cannot be derived -//~^^^ 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 consider giving it a 'static lifetime fn main() {} diff --git a/src/test/ui/issue-26638.stderr b/src/test/ui/issue-26638.stderr new file mode 100644 index 0000000000000..3b124ff406350 --- /dev/null +++ b/src/test/ui/issue-26638.stderr @@ -0,0 +1,28 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:11:58 + | +11 | fn parse_type(iter: Box+'static>) -> &str { iter.next() } + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from + +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:14:40 + | +14 | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/issue-26638.rs:17:22 + | +17 | fn parse_type_3() -> &str { unimplemented!() } + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from + = help: consider giving it a 'static lifetime + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-26886.rs b/src/test/ui/issue-26886.rs similarity index 75% rename from src/test/compile-fail/issue-26886.rs rename to src/test/ui/issue-26886.rs index 9b1950601961f..24ef7cb74c852 100644 --- a/src/test/compile-fail/issue-26886.rs +++ b/src/test/ui/issue-26886.rs @@ -8,13 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::sync::{self, Arc}; //~ NOTE previous import of the type `Arc` here - //~^ NOTE previous import of the module `sync` here +use std::sync::{self, Arc}; use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times - //~| NOTE `Arc` reimported here //~| `Arc` must be defined only once in the type namespace of this module use std::sync; //~ ERROR the name `sync` is defined multiple times - //~| NOTE `sync` reimported here //~| `sync` must be defined only once in the type namespace of this module fn main() { diff --git a/src/test/ui/issue-26886.stderr b/src/test/ui/issue-26886.stderr new file mode 100644 index 0000000000000..cb2eca87068f8 --- /dev/null +++ b/src/test/ui/issue-26886.stderr @@ -0,0 +1,31 @@ +error[E0252]: the name `Arc` is defined multiple times + --> $DIR/issue-26886.rs:12:5 + | +11 | use std::sync::{self, Arc}; + | --- previous import of the type `Arc` here +12 | use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times + | ^^^^^^^^^^^^^^ `Arc` reimported here + | + = note: `Arc` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +12 | use std::sync::Arc as OtherArc; //~ ERROR the name `Arc` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0252]: the name `sync` is defined multiple times + --> $DIR/issue-26886.rs:14:5 + | +11 | use std::sync::{self, Arc}; + | ---- previous import of the module `sync` here +... +14 | use std::sync; //~ ERROR the name `sync` is defined multiple times + | ^^^^^^^^^ `sync` reimported here + | + = note: `sync` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +14 | use std::sync as Othersync; //~ ERROR the name `sync` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-27842.rs b/src/test/ui/issue-27842.rs similarity index 83% rename from src/test/compile-fail/issue-27842.rs rename to src/test/ui/issue-27842.rs index eb28e36dc076e..d9dc3458a4a2c 100644 --- a/src/test/compile-fail/issue-27842.rs +++ b/src/test/ui/issue-27842.rs @@ -13,12 +13,9 @@ fn main() { // the case where we show a suggestion let _ = tup[0]; //~^ ERROR cannot index into a value of type - //~| HELP to access tuple elements, use - //~| SUGGESTION tup.0 // the case where we show just a general hint let i = 0_usize; let _ = tup[i]; //~^ ERROR cannot index into a value of type - //~| HELP to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) } diff --git a/src/test/ui/issue-27842.stderr b/src/test/ui/issue-27842.stderr new file mode 100644 index 0000000000000..2e3b20e43ff04 --- /dev/null +++ b/src/test/ui/issue-27842.stderr @@ -0,0 +1,16 @@ +error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` + --> $DIR/issue-27842.rs:14:13 + | +14 | let _ = tup[0]; + | ^^^^^^ help: to access tuple elements, use: `tup.0` + +error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` + --> $DIR/issue-27842.rs:19:13 + | +19 | let _ = tup[i]; + | ^^^^^^ + | + = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-27942.rs b/src/test/ui/issue-27942.rs similarity index 65% rename from src/test/compile-fail/issue-27942.rs rename to src/test/ui/issue-27942.rs index 0fa4184606e45..2234aede00df4 100644 --- a/src/test/compile-fail/issue-27942.rs +++ b/src/test/ui/issue-27942.rs @@ -11,18 +11,12 @@ pub trait Resources<'a> {} pub trait Buffer<'a, R: Resources<'a>> { - //~^ NOTE the lifetime 'a as defined on the trait at 13:1... - //~| NOTE ...does not necessarily outlive the lifetime 'a as defined on the trait fn select(&self) -> BufferViewHandle; //~^ ERROR mismatched types //~| lifetime mismatch - //~| NOTE expected type `Resources<'_>` - //~| NOTE ...does not necessarily outlive the anonymous lifetime #1 defined on the method body //~| ERROR mismatched types //~| lifetime mismatch - //~| NOTE expected type `Resources<'_>` - //~| NOTE the anonymous lifetime #1 defined on the method body at 17:5... } pub struct BufferViewHandle<'a, R: 'a+Resources<'a>>(&'a R); diff --git a/src/test/ui/issue-27942.stderr b/src/test/ui/issue-27942.stderr new file mode 100644 index 0000000000000..b580b8e73137b --- /dev/null +++ b/src/test/ui/issue-27942.stderr @@ -0,0 +1,52 @@ +error[E0308]: mismatched types + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `Resources<'_>` + found type `Resources<'a>` +note: the anonymous lifetime #1 defined on the method body at 15:5... + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:1 + --> $DIR/issue-27942.rs:13:1 + | +13 | / pub trait Buffer<'a, R: Resources<'a>> { +14 | | +15 | | fn select(&self) -> BufferViewHandle; +16 | | //~^ ERROR mismatched types +... | +19 | | //~| lifetime mismatch +20 | | } + | |_^ + +error[E0308]: mismatched types + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected type `Resources<'_>` + found type `Resources<'a>` +note: the lifetime 'a as defined on the trait at 13:1... + --> $DIR/issue-27942.rs:13:1 + | +13 | / pub trait Buffer<'a, R: Resources<'a>> { +14 | | +15 | | fn select(&self) -> BufferViewHandle; +16 | | //~^ ERROR mismatched types +... | +19 | | //~| lifetime mismatch +20 | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 15:5 + --> $DIR/issue-27942.rs:15:5 + | +15 | fn select(&self) -> BufferViewHandle; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/ui/issue-2848.rs similarity index 84% rename from src/test/compile-fail/issue-2848.rs rename to src/test/ui/issue-2848.rs index 38bd7adefd91f..f3fc94434d3a0 100644 --- a/src/test/compile-fail/issue-2848.rs +++ b/src/test/ui/issue-2848.rs @@ -20,7 +20,6 @@ fn main() { use bar::foo::{alpha, charlie}; match alpha { alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns - charlie => {} //~| NOTE pattern doesn't bind `beta` - //~| NOTE variable not in all patterns + charlie => {} } } diff --git a/src/test/ui/issue-2848.stderr b/src/test/ui/issue-2848.stderr new file mode 100644 index 0000000000000..6d4ed9c01111f --- /dev/null +++ b/src/test/ui/issue-2848.stderr @@ -0,0 +1,10 @@ +error[E0408]: variable `beta` is not bound in all patterns + --> $DIR/issue-2848.rs:22:7 + | +22 | alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns + | ^^^^^ ---- variable not in all patterns + | | + | pattern doesn't bind `beta` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-28568.rs b/src/test/ui/issue-28568.rs similarity index 88% rename from src/test/compile-fail/issue-28568.rs rename to src/test/ui/issue-28568.rs index f03daafc63754..e8c34198852e4 100644 --- a/src/test/compile-fail/issue-28568.rs +++ b/src/test/ui/issue-28568.rs @@ -11,13 +11,11 @@ struct MyStruct; impl Drop for MyStruct { -//~^ NOTE first implementation here fn drop(&mut self) { } } impl Drop for MyStruct { //~^ ERROR conflicting implementations of trait -//~| NOTE conflicting implementation for `MyStruct` fn drop(&mut self) { } } diff --git a/src/test/ui/issue-28568.stderr b/src/test/ui/issue-28568.stderr new file mode 100644 index 0000000000000..2b4025ac12257 --- /dev/null +++ b/src/test/ui/issue-28568.stderr @@ -0,0 +1,16 @@ +error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`: + --> $DIR/issue-28568.rs:17:1 + | +13 | / impl Drop for MyStruct { +14 | | fn drop(&mut self) { } +15 | | } + | |_- first implementation here +16 | +17 | / impl Drop for MyStruct { +18 | | //~^ ERROR conflicting implementations of trait +19 | | fn drop(&mut self) { } +20 | | } + | |_^ conflicting implementation for `MyStruct` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-28776.rs b/src/test/ui/issue-28776.rs similarity index 93% rename from src/test/compile-fail/issue-28776.rs rename to src/test/ui/issue-28776.rs index 4a36bc88fa7d9..196c4bd2728e7 100644 --- a/src/test/compile-fail/issue-28776.rs +++ b/src/test/ui/issue-28776.rs @@ -13,5 +13,4 @@ use std::ptr; fn main() { (&ptr::write)(1 as *mut _, 42); //~^ ERROR E0133 - //~| NOTE call to unsafe function } diff --git a/src/test/ui/issue-28776.stderr b/src/test/ui/issue-28776.stderr new file mode 100644 index 0000000000000..cf24a8312af9b --- /dev/null +++ b/src/test/ui/issue-28776.stderr @@ -0,0 +1,8 @@ +error[E0133]: call to unsafe function requires unsafe function or block + --> $DIR/issue-28776.rs:14:5 + | +14 | (&ptr::write)(1 as *mut _, 42); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-28837.rs b/src/test/ui/issue-28837.rs similarity index 57% rename from src/test/compile-fail/issue-28837.rs rename to src/test/ui/issue-28837.rs index c7cf63bf2c466..91ea18a8c6cf7 100644 --- a/src/test/compile-fail/issue-28837.rs +++ b/src/test/ui/issue-28837.rs @@ -14,47 +14,32 @@ fn main() { let a = A; a + a; //~ ERROR binary operation `+` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Add` might be missing for `A` a - a; //~ ERROR binary operation `-` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Sub` might be missing for `A` a * a; //~ ERROR binary operation `*` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Mul` might be missing for `A` a / a; //~ ERROR binary operation `/` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Div` might be missing for `A` a % a; //~ ERROR binary operation `%` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Rem` might be missing for `A` a & a; //~ ERROR binary operation `&` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::BitAnd` might be missing for `A` a | a; //~ ERROR binary operation `|` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::BitOr` might be missing for `A` a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Shl` might be missing for `A` a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` - //~^ NOTE an implementation of `std::ops::Shr` might be missing for `A` a == a; //~ ERROR binary operation `==` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialEq` might be missing for `A` a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialEq` might be missing for `A` a < a; //~ ERROR binary operation `<` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` a > a; //~ ERROR binary operation `>` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` - //~^ NOTE an implementation of `std::cmp::PartialOrd` might be missing for `A` } diff --git a/src/test/ui/issue-28837.stderr b/src/test/ui/issue-28837.stderr new file mode 100644 index 0000000000000..8d9afb5be792a --- /dev/null +++ b/src/test/ui/issue-28837.stderr @@ -0,0 +1,122 @@ +error[E0369]: binary operation `+` cannot be applied to type `A` + --> $DIR/issue-28837.rs:16:5 + | +16 | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Add` might be missing for `A` + +error[E0369]: binary operation `-` cannot be applied to type `A` + --> $DIR/issue-28837.rs:18:5 + | +18 | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Sub` might be missing for `A` + +error[E0369]: binary operation `*` cannot be applied to type `A` + --> $DIR/issue-28837.rs:20:5 + | +20 | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Mul` might be missing for `A` + +error[E0369]: binary operation `/` cannot be applied to type `A` + --> $DIR/issue-28837.rs:22:5 + | +22 | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Div` might be missing for `A` + +error[E0369]: binary operation `%` cannot be applied to type `A` + --> $DIR/issue-28837.rs:24:5 + | +24 | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::Rem` might be missing for `A` + +error[E0369]: binary operation `&` cannot be applied to type `A` + --> $DIR/issue-28837.rs:26:5 + | +26 | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::BitAnd` might be missing for `A` + +error[E0369]: binary operation `|` cannot be applied to type `A` + --> $DIR/issue-28837.rs:28:5 + | +28 | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::ops::BitOr` might be missing for `A` + +error[E0369]: binary operation `<<` cannot be applied to type `A` + --> $DIR/issue-28837.rs:30:5 + | +30 | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::ops::Shl` might be missing for `A` + +error[E0369]: binary operation `>>` cannot be applied to type `A` + --> $DIR/issue-28837.rs:32:5 + | +32 | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::ops::Shr` might be missing for `A` + +error[E0369]: binary operation `==` cannot be applied to type `A` + --> $DIR/issue-28837.rs:34:5 + | +34 | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialEq` might be missing for `A` + +error[E0369]: binary operation `!=` cannot be applied to type `A` + --> $DIR/issue-28837.rs:36:5 + | +36 | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialEq` might be missing for `A` + +error[E0369]: binary operation `<` cannot be applied to type `A` + --> $DIR/issue-28837.rs:38:5 + | +38 | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error[E0369]: binary operation `<=` cannot be applied to type `A` + --> $DIR/issue-28837.rs:40:5 + | +40 | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error[E0369]: binary operation `>` cannot be applied to type `A` + --> $DIR/issue-28837.rs:42:5 + | +42 | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` + | ^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error[E0369]: binary operation `>=` cannot be applied to type `A` + --> $DIR/issue-28837.rs:44:5 + | +44 | a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` + | ^^^^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` + +error: aborting due to 15 previous errors + diff --git a/src/test/compile-fail/issue-28971.rs b/src/test/ui/issue-28971.rs similarity index 88% rename from src/test/compile-fail/issue-28971.rs rename to src/test/ui/issue-28971.rs index 10be4d6210d7a..e553fee5a62f9 100644 --- a/src/test/compile-fail/issue-28971.rs +++ b/src/test/ui/issue-28971.rs @@ -10,7 +10,7 @@ // This should not cause an ICE -enum Foo { //~ NOTE variant `Baz` not found here +enum Foo { Bar(u8) } fn main(){ @@ -18,7 +18,6 @@ fn main(){ match Foo::Bar(1) { Foo::Baz(..) => (), //~^ ERROR no variant named `Baz` found for type `Foo` - //~| NOTE variant not found in `Foo` _ => (), } }); diff --git a/src/test/ui/issue-28971.stderr b/src/test/ui/issue-28971.stderr new file mode 100644 index 0000000000000..6237aae67be60 --- /dev/null +++ b/src/test/ui/issue-28971.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant named `Baz` found for type `Foo` in the current scope + --> $DIR/issue-28971.rs:19:13 + | +13 | enum Foo { + | -------- variant `Baz` not found here +... +19 | Foo::Baz(..) => (), + | ^^^^^^^^^^^^ variant not found in `Foo` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-29124.rs b/src/test/ui/issue-29124.rs similarity index 86% rename from src/test/compile-fail/issue-29124.rs rename to src/test/ui/issue-29124.rs index a72dac0d5dd68..77fa8192b97b5 100644 --- a/src/test/compile-fail/issue-29124.rs +++ b/src/test/ui/issue-29124.rs @@ -24,8 +24,6 @@ fn func() -> ret { fn main() { obj::func.x(); //~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope - //~^^ NOTE obj::func is a function, perhaps you wish to call it func.x(); //~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope - //~^^ NOTE func is a function, perhaps you wish to call it } diff --git a/src/test/ui/issue-29124.stderr b/src/test/ui/issue-29124.stderr new file mode 100644 index 0000000000000..0b81526d655e0 --- /dev/null +++ b/src/test/ui/issue-29124.stderr @@ -0,0 +1,18 @@ +error[E0599]: no method named `x` found for type `fn() -> ret {obj::func}` in the current scope + --> $DIR/issue-29124.rs:25:15 + | +25 | obj::func.x(); + | ^ + | + = note: obj::func is a function, perhaps you wish to call it + +error[E0599]: no method named `x` found for type `fn() -> ret {func}` in the current scope + --> $DIR/issue-29124.rs:27:10 + | +27 | func.x(); + | ^ + | + = note: func is a function, perhaps you wish to call it + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-30007.rs b/src/test/ui/issue-30007.rs similarity index 88% rename from src/test/compile-fail/issue-30007.rs rename to src/test/ui/issue-30007.rs index fa0b75da999c2..c17833ee83070 100644 --- a/src/test/compile-fail/issue-30007.rs +++ b/src/test/ui/issue-30007.rs @@ -13,5 +13,5 @@ macro_rules! t { } fn main() { - let i: Vec; //~ NOTE caused by the macro expansion here + let i: Vec; } diff --git a/src/test/ui/issue-30007.stderr b/src/test/ui/issue-30007.stderr new file mode 100644 index 0000000000000..24458ef44c4ee --- /dev/null +++ b/src/test/ui/issue-30007.stderr @@ -0,0 +1,14 @@ +error: macro expansion ignores token `;` and any following + --> $DIR/issue-30007.rs:12:20 + | +12 | () => ( String ; ); //~ ERROR macro expansion ignores token `;` + | ^ + | +note: caused by the macro expansion here; the usage of `t!` is likely invalid in type context + --> $DIR/issue-30007.rs:16:16 + | +16 | let i: Vec; + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3008-1.rs b/src/test/ui/issue-3008-1.rs similarity index 85% rename from src/test/compile-fail/issue-3008-1.rs rename to src/test/ui/issue-3008-1.rs index 7ca6d9301a689..89de27326b48a 100644 --- a/src/test/compile-fail/issue-3008-1.rs +++ b/src/test/ui/issue-3008-1.rs @@ -14,9 +14,8 @@ enum Foo { enum Bar { //~^ ERROR recursive type `Bar` has infinite size - //~| NOTE recursive type has infinite size BarNone, - BarSome(Bar) //~ NOTE recursive without indirection + BarSome(Bar) } fn main() { diff --git a/src/test/ui/issue-3008-1.stderr b/src/test/ui/issue-3008-1.stderr new file mode 100644 index 0000000000000..7d8e10a760620 --- /dev/null +++ b/src/test/ui/issue-3008-1.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-1.rs:15:1 + | +15 | enum Bar { + | ^^^^^^^^ recursive type has infinite size +... +18 | BarSome(Bar) + | ---- recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3008-2.rs b/src/test/ui/issue-3008-2.rs similarity index 86% rename from src/test/compile-fail/issue-3008-2.rs rename to src/test/ui/issue-3008-2.rs index 061d1facda0ca..b627656c91a74 100644 --- a/src/test/compile-fail/issue-3008-2.rs +++ b/src/test/ui/issue-3008-2.rs @@ -11,8 +11,6 @@ enum foo { foo_(bar) } struct bar { x: bar } //~^ ERROR E0072 -//~| NOTE recursive type has infinite size -//~| NOTE recursive without indirection fn main() { } diff --git a/src/test/ui/issue-3008-2.stderr b/src/test/ui/issue-3008-2.stderr new file mode 100644 index 0000000000000..2d5e2966df9c6 --- /dev/null +++ b/src/test/ui/issue-3008-2.stderr @@ -0,0 +1,12 @@ +error[E0072]: recursive type `bar` has infinite size + --> $DIR/issue-3008-2.rs:12:1 + | +12 | struct bar { x: bar } + | ^^^^^^^^^^ ------ recursive without indirection + | | + | recursive type has infinite size + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `bar` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-30255.rs b/src/test/ui/issue-30255.rs similarity index 78% rename from src/test/compile-fail/issue-30255.rs rename to src/test/ui/issue-30255.rs index e3f55ae51e8b6..64f70ef2b6fdc 100644 --- a/src/test/compile-fail/issue-30255.rs +++ b/src/test/ui/issue-30255.rs @@ -17,19 +17,17 @@ struct S<'a> { fn f(a: &S, b: i32) -> &i32 { //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say which one of `a`'s 2 lifetimes it is borrowed from panic!(); } fn g(a: &S, b: bool, c: &i32) -> &i32 { //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` panic!(); } fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { //~^ ERROR missing lifetime specifier [E0106] -//~^^ HELP does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` panic!(); } +fn main() {} diff --git a/src/test/ui/issue-30255.stderr b/src/test/ui/issue-30255.stderr new file mode 100644 index 0000000000000..b0c314912cca6 --- /dev/null +++ b/src/test/ui/issue-30255.stderr @@ -0,0 +1,26 @@ +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:18:24 + | +18 | fn f(a: &S, b: i32) -> &i32 { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `a`'s 2 lifetimes it is borrowed from + +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:23:34 + | +23 | fn g(a: &S, b: bool, c: &i32) -> &i32 { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` + +error[E0106]: missing lifetime specifier + --> $DIR/issue-30255.rs:28:44 + | +28 | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-30302.rs b/src/test/ui/issue-30302.rs similarity index 92% rename from src/test/compile-fail/issue-30302.rs rename to src/test/ui/issue-30302.rs index 01150ff13740f..51c76713a766d 100644 --- a/src/test/compile-fail/issue-30302.rs +++ b/src/test/ui/issue-30302.rs @@ -22,7 +22,6 @@ fn is_empty(s: Stack) -> bool { match s { 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` _ => false //~^ ERROR unreachable pattern } diff --git a/src/test/ui/issue-30302.stderr b/src/test/ui/issue-30302.stderr new file mode 100644 index 0000000000000..e86b588aad222 --- /dev/null +++ b/src/test/ui/issue-30302.stderr @@ -0,0 +1,27 @@ +warning[E0170]: pattern binding `Nil` is named the same as one of the variants of the type `Stack` + --> $DIR/issue-30302.rs:23:9 + | +23 | Nil => true, + | ^^^ + | + = help: if you meant to match on a variant, consider making the path in the pattern qualified: `Stack::Nil` + +error: unreachable pattern + --> $DIR/issue-30302.rs:25:9 + | +25 | _ => false + | ^ this is an unreachable pattern + | +note: lint level defined here + --> $DIR/issue-30302.rs:14:9 + | +14 | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ +note: this pattern matches any value + --> $DIR/issue-30302.rs:23:9 + | +23 | Nil => true, + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/ui/issue-3044.rs similarity index 94% rename from src/test/compile-fail/issue-3044.rs rename to src/test/ui/issue-3044.rs index 4c63f7761a6dc..5708f160a41cc 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/ui/issue-3044.rs @@ -14,5 +14,4 @@ fn main() { needlesArr.iter().fold(|x, y| { }); //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied - //~| NOTE expected 2 parameters } diff --git a/src/test/ui/issue-3044.stderr b/src/test/ui/issue-3044.stderr new file mode 100644 index 0000000000000..14f2d5195d60c --- /dev/null +++ b/src/test/ui/issue-3044.stderr @@ -0,0 +1,8 @@ +error[E0061]: this function takes 2 parameters but 1 parameter was supplied + --> $DIR/issue-3044.rs:14:23 + | +14 | needlesArr.iter().fold(|x, y| { + | ^^^^ expected 2 parameters + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-30730.rs b/src/test/ui/issue-30730.rs similarity index 82% rename from src/test/compile-fail/issue-30730.rs rename to src/test/ui/issue-30730.rs index d1af39a6c1872..c57a34a90df78 100644 --- a/src/test/compile-fail/issue-30730.rs +++ b/src/test/ui/issue-30730.rs @@ -9,8 +9,7 @@ // except according to those terms. #![warn(unused)] -#![deny(warnings)] //~ NOTE: lint level defined here +#![deny(warnings)] use std::thread; //~^ ERROR: unused import -//~| NOTE: #[deny(unused_imports)] implied by #[deny(warnings)] fn main() {} diff --git a/src/test/ui/issue-30730.stderr b/src/test/ui/issue-30730.stderr new file mode 100644 index 0000000000000..192c1f542de5f --- /dev/null +++ b/src/test/ui/issue-30730.stderr @@ -0,0 +1,15 @@ +error: unused import: `std::thread` + --> $DIR/issue-30730.rs:13:5 + | +13 | use std::thread; + | ^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-30730.rs:12:9 + | +12 | #![deny(warnings)] + | ^^^^^^^^ + = note: #[deny(unused_imports)] implied by #[deny(warnings)] + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-31221.rs b/src/test/ui/issue-31221.rs similarity index 76% rename from src/test/compile-fail/issue-31221.rs rename to src/test/ui/issue-31221.rs index 8701ca0178fc9..ca15a869a9c20 100644 --- a/src/test/compile-fail/issue-31221.rs +++ b/src/test/ui/issue-31221.rs @@ -12,7 +12,6 @@ #![allow(unused_variables)] #![allow(non_snake_case)] #![deny(unreachable_patterns)] -//~^ NOTE lint level defined here #[derive(Clone, Copy)] enum Enum { @@ -26,26 +25,20 @@ fn main() { match s { Var1 => (), Var3 => (), - //~^ NOTE this pattern matches any value Var2 => (), //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern }; match &s { &Var1 => (), &Var3 => (), - //~^ NOTE this pattern matches any value &Var2 => (), //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern }; let t = (Var1, Var1); match t { (Var1, b) => (), (c, d) => (), - //~^ NOTE this pattern matches any value anything => () //~^ ERROR unreachable pattern - //~^^ NOTE this is an unreachable pattern }; } diff --git a/src/test/ui/issue-31221.stderr b/src/test/ui/issue-31221.stderr new file mode 100644 index 0000000000000..ccc1df04ff7df --- /dev/null +++ b/src/test/ui/issue-31221.stderr @@ -0,0 +1,43 @@ +error: unreachable pattern + --> $DIR/issue-31221.rs:28:9 + | +28 | Var2 => (), + | ^^^^ this is an unreachable pattern + | +note: lint level defined here + --> $DIR/issue-31221.rs:14:9 + | +14 | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ +note: this pattern matches any value + --> $DIR/issue-31221.rs:27:9 + | +27 | Var3 => (), + | ^^^^ + +error: unreachable pattern + --> $DIR/issue-31221.rs:34:9 + | +34 | &Var2 => (), + | ^^^^^ this is an unreachable pattern + | +note: this pattern matches any value + --> $DIR/issue-31221.rs:33:9 + | +33 | &Var3 => (), + | ^^^^^ + +error: unreachable pattern + --> $DIR/issue-31221.rs:41:9 + | +41 | anything => () + | ^^^^^^^^ this is an unreachable pattern + | +note: this pattern matches any value + --> $DIR/issue-31221.rs:40:9 + | +40 | (c, d) => (), + | ^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-32326.rs b/src/test/ui/issue-32326.rs similarity index 83% rename from src/test/compile-fail/issue-32326.rs rename to src/test/ui/issue-32326.rs index 70a7cd8b97021..8af243afc2299 100644 --- a/src/test/compile-fail/issue-32326.rs +++ b/src/test/ui/issue-32326.rs @@ -13,10 +13,7 @@ // too big. enum Expr { //~ ERROR E0072 - //~| NOTE recursive type has infinite size Plus(Expr, Expr), - //~^ NOTE recursive without indirection - //~| NOTE recursive without indirection Literal(i64), } diff --git a/src/test/ui/issue-32326.stderr b/src/test/ui/issue-32326.stderr new file mode 100644 index 0000000000000..f907e3adaf180 --- /dev/null +++ b/src/test/ui/issue-32326.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Expr` has infinite size + --> $DIR/issue-32326.rs:15:1 + | +15 | enum Expr { //~ ERROR E0072 + | ^^^^^^^^^ recursive type has infinite size +16 | Plus(Expr, Expr), + | ----- ----- recursive without indirection + | | + | recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Expr` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-32950.rs b/src/test/ui/issue-32950.rs similarity index 93% rename from src/test/compile-fail/issue-32950.rs rename to src/test/ui/issue-32950.rs index 20e5b1d72d3d7..4e5cdd50b2a95 100644 --- a/src/test/compile-fail/issue-32950.rs +++ b/src/test/ui/issue-32950.rs @@ -10,7 +10,7 @@ #![feature(concat_idents)] -#[derive(Debug)] //~ NOTE in this expansion +#[derive(Debug)] struct Baz( concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros ); diff --git a/src/test/ui/issue-32950.stderr b/src/test/ui/issue-32950.stderr new file mode 100644 index 0000000000000..0933c81d65560 --- /dev/null +++ b/src/test/ui/issue-32950.stderr @@ -0,0 +1,9 @@ +error: `derive` cannot be used on items with type macros + --> $DIR/issue-32950.rs:15:5 + | +15 | / concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros +16 | | ); + | |_^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-34047.rs b/src/test/ui/issue-34047.rs similarity index 83% rename from src/test/compile-fail/issue-34047.rs rename to src/test/ui/issue-34047.rs index 630694d91561d..db28410250311 100644 --- a/src/test/compile-fail/issue-34047.rs +++ b/src/test/ui/issue-34047.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const C: u8 = 0; //~ NOTE a constant `C` is defined here +const C: u8 = 0; fn main() { match 1u8 { mut C => {} //~ ERROR match bindings cannot shadow constants - //~^ NOTE cannot be named the same as a constant _ => {} } } diff --git a/src/test/ui/issue-34047.stderr b/src/test/ui/issue-34047.stderr new file mode 100644 index 0000000000000..0c109bffb247c --- /dev/null +++ b/src/test/ui/issue-34047.stderr @@ -0,0 +1,11 @@ +error[E0530]: match bindings cannot shadow constants + --> $DIR/issue-34047.rs:15:13 + | +11 | const C: u8 = 0; + | ---------------- a constant `C` is defined here +... +15 | mut C => {} //~ ERROR match bindings cannot shadow constants + | ^ cannot be named the same as a constant + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-34209.rs b/src/test/ui/issue-34209.rs similarity index 84% rename from src/test/compile-fail/issue-34209.rs rename to src/test/ui/issue-34209.rs index 5e3b777cc0b62..b3cb7d4cc3053 100644 --- a/src/test/compile-fail/issue-34209.rs +++ b/src/test/ui/issue-34209.rs @@ -16,8 +16,6 @@ fn bug(l: S) { match l { S::B{ } => { }, //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `::B` } } diff --git a/src/test/ui/issue-34209.stderr b/src/test/ui/issue-34209.stderr new file mode 100644 index 0000000000000..a832aab4c2653 --- /dev/null +++ b/src/test/ui/issue-34209.stderr @@ -0,0 +1,10 @@ +error[E0223]: ambiguous associated type + --> $DIR/issue-34209.rs:17:9 + | +17 | S::B{ } => { }, + | ^^^^ ambiguous associated type + | + = note: specify the type using the syntax `::B` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-35139.rs b/src/test/ui/issue-35139.rs similarity index 92% rename from src/test/compile-fail/issue-35139.rs rename to src/test/ui/issue-35139.rs index 5c4f161a5004e..67f0e7aaf9717 100644 --- a/src/test/compile-fail/issue-35139.rs +++ b/src/test/ui/issue-35139.rs @@ -17,7 +17,6 @@ pub trait MethodType { pub struct MTFn; impl<'a> MethodType for MTFn { //~ ERROR E0207 - //~| NOTE unconstrained lifetime parameter type GetProp = fmt::Debug + 'a; } diff --git a/src/test/ui/issue-35139.stderr b/src/test/ui/issue-35139.stderr new file mode 100644 index 0000000000000..19356cad31797 --- /dev/null +++ b/src/test/ui/issue-35139.stderr @@ -0,0 +1,8 @@ +error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-35139.rs:19:6 + | +19 | impl<'a> MethodType for MTFn { //~ ERROR E0207 + | ^^ unconstrained lifetime parameter + +error: aborting due to previous error + diff --git a/src/test/ui/issue-35675.rs b/src/test/ui/issue-35675.rs index ee9d1324cdbb7..f34954681510e 100644 --- a/src/test/ui/issue-35675.rs +++ b/src/test/ui/issue-35675.rs @@ -9,49 +9,34 @@ // except according to those terms. // these two HELPs are actually in a new line between this line and the `enum Fruit` line -enum Fruit { //~ HELP possible candidate is found in another module, you can import it into scope - //~^ HELP possible candidate is found in another module, you can import it into scope +enum Fruit { Apple(i64), Orange(i64), } fn should_return_fruit() -> Apple { //~^ ERROR cannot find type `Apple` in this scope - //~| NOTE not found in this scope - //~| HELP you can try using the variant's enum Apple(5) //~^ ERROR cannot find function `Apple` in this scope - //~| NOTE not found in this scope } fn should_return_fruit_too() -> Fruit::Apple { //~^ ERROR expected type, found variant `Fruit::Apple` - //~| NOTE not a type - //~| HELP you can try using the variant's enum Apple(5) //~^ ERROR cannot find function `Apple` in this scope - //~| NOTE not found in this scope } fn foo() -> Ok { //~^ ERROR expected type, found variant `Ok` - //~| NOTE not a type - //~| HELP there is an enum variant - //~| HELP there is an enum variant Ok(()) } fn bar() -> Variant3 { //~^ ERROR cannot find type `Variant3` in this scope - //~| NOTE not found in this scope - //~| HELP you can try using the variant's enum } fn qux() -> Some { //~^ ERROR expected type, found variant `Some` - //~| NOTE not a type - //~| HELP there is an enum variant - //~| HELP there is an enum variant Some(1) } diff --git a/src/test/ui/issue-35675.stderr b/src/test/ui/issue-35675.stderr index 550e094dc51bb..c4d0e51c07e07 100644 --- a/src/test/ui/issue-35675.stderr +++ b/src/test/ui/issue-35675.stderr @@ -1,16 +1,16 @@ error[E0412]: cannot find type `Apple` in this scope - --> $DIR/issue-35675.rs:18:29 + --> $DIR/issue-35675.rs:17:29 | -18 | fn should_return_fruit() -> Apple { +17 | fn should_return_fruit() -> Apple { | ^^^^^ | | | not found in this scope | help: you can try using the variant's enum: `Fruit` error[E0425]: cannot find function `Apple` in this scope - --> $DIR/issue-35675.rs:22:5 + --> $DIR/issue-35675.rs:19:5 | -22 | Apple(5) +19 | Apple(5) | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -18,18 +18,18 @@ help: possible candidate is found in another module, you can import it into scop | error[E0573]: expected type, found variant `Fruit::Apple` - --> $DIR/issue-35675.rs:27:33 + --> $DIR/issue-35675.rs:23:33 | -27 | fn should_return_fruit_too() -> Fruit::Apple { +23 | fn should_return_fruit_too() -> Fruit::Apple { | ^^^^^^^^^^^^ | | | not a type | help: you can try using the variant's enum: `Fruit` error[E0425]: cannot find function `Apple` in this scope - --> $DIR/issue-35675.rs:31:5 + --> $DIR/issue-35675.rs:25:5 | -31 | Apple(5) +25 | Apple(5) | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -37,27 +37,27 @@ help: possible candidate is found in another module, you can import it into scop | error[E0573]: expected type, found variant `Ok` - --> $DIR/issue-35675.rs:36:13 + --> $DIR/issue-35675.rs:29:13 | -36 | fn foo() -> Ok { +29 | fn foo() -> Ok { | ^^ not a type | = help: there is an enum variant `std::prelude::v1::Ok`, try using `std::prelude::v1`? = help: there is an enum variant `std::result::Result::Ok`, try using `std::result::Result`? error[E0412]: cannot find type `Variant3` in this scope - --> $DIR/issue-35675.rs:44:13 + --> $DIR/issue-35675.rs:34:13 | -44 | fn bar() -> Variant3 { +34 | fn bar() -> Variant3 { | ^^^^^^^^ | | | not found in this scope | help: you can try using the variant's enum: `x::Enum` error[E0573]: expected type, found variant `Some` - --> $DIR/issue-35675.rs:50:13 + --> $DIR/issue-35675.rs:38:13 | -50 | fn qux() -> Some { +38 | fn qux() -> Some { | ^^^^ not a type | = help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`? diff --git a/src/test/compile-fail/issue-35869.rs b/src/test/ui/issue-35869.rs similarity index 66% rename from src/test/compile-fail/issue-35869.rs rename to src/test/ui/issue-35869.rs index 1942fd38d11fa..17ee62aed1b88 100644 --- a/src/test/compile-fail/issue-35869.rs +++ b/src/test/ui/issue-35869.rs @@ -11,10 +11,10 @@ #![feature(conservative_impl_trait)] trait Foo { - fn foo(_: fn(u8) -> ()); //~ NOTE type in trait - fn bar(_: Option); //~ NOTE type in trait - fn baz(_: (u8, u16)); //~ NOTE type in trait - fn qux() -> u8; //~ NOTE type in trait + fn foo(_: fn(u8) -> ()); + fn bar(_: Option); + fn baz(_: (u8, u16)); + fn qux() -> u8; } struct Bar; @@ -22,20 +22,12 @@ struct Bar; impl Foo for Bar { fn foo(_: fn(u16) -> ()) {} //~^ ERROR method `foo` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn(fn(u8))` fn bar(_: Option) {} //~^ ERROR method `bar` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn(std::option::Option)` fn baz(_: (u16, u16)) {} //~^ ERROR method `baz` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn((u8, u16))` fn qux() -> u16 { 5u16 } //~^ ERROR method `qux` has an incompatible type for trait - //~| NOTE expected u8 - //~| NOTE expected type `fn() -> u8` } fn main() {} diff --git a/src/test/ui/issue-35869.stderr b/src/test/ui/issue-35869.stderr new file mode 100644 index 0000000000000..5d2772b06a2ab --- /dev/null +++ b/src/test/ui/issue-35869.stderr @@ -0,0 +1,50 @@ +error[E0053]: method `foo` has an incompatible type for trait + --> $DIR/issue-35869.rs:23:15 + | +14 | fn foo(_: fn(u8) -> ()); + | ------------ type in trait +... +23 | fn foo(_: fn(u16) -> ()) {} + | ^^^^^^^^^^^^^ expected u8, found u16 + | + = note: expected type `fn(fn(u8))` + found type `fn(fn(u16))` + +error[E0053]: method `bar` has an incompatible type for trait + --> $DIR/issue-35869.rs:25:15 + | +15 | fn bar(_: Option); + | ---------- type in trait +... +25 | fn bar(_: Option) {} + | ^^^^^^^^^^^ expected u8, found u16 + | + = note: expected type `fn(std::option::Option)` + found type `fn(std::option::Option)` + +error[E0053]: method `baz` has an incompatible type for trait + --> $DIR/issue-35869.rs:27:15 + | +16 | fn baz(_: (u8, u16)); + | --------- type in trait +... +27 | fn baz(_: (u16, u16)) {} + | ^^^^^^^^^^ expected u8, found u16 + | + = note: expected type `fn((u8, u16))` + found type `fn((u16, u16))` + +error[E0053]: method `qux` has an incompatible type for trait + --> $DIR/issue-35869.rs:29:17 + | +17 | fn qux() -> u8; + | -- type in trait +... +29 | fn qux() -> u16 { 5u16 } + | ^^^ expected u8, found u16 + | + = note: expected type `fn() -> u8` + found type `fn() -> u16` + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/issue-36163.rs b/src/test/ui/issue-36163.rs similarity index 77% rename from src/test/compile-fail/issue-36163.rs rename to src/test/ui/issue-36163.rs index 9dad6ede776c2..2337f82afa49f 100644 --- a/src/test/compile-fail/issue-36163.rs +++ b/src/test/ui/issue-36163.rs @@ -9,16 +9,13 @@ // except according to those terms. const A: i32 = Foo::B; //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant enum Foo { B = A, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant } enum Bar { C = Bar::C, //~ ERROR E0265 - //~^ NOTE recursion not allowed in constant } const D: i32 = A; diff --git a/src/test/ui/issue-36163.stderr b/src/test/ui/issue-36163.stderr new file mode 100644 index 0000000000000..5a107d88f2e4f --- /dev/null +++ b/src/test/ui/issue-36163.stderr @@ -0,0 +1,20 @@ +error[E0265]: recursive constant + --> $DIR/issue-36163.rs:11:1 + | +11 | const A: i32 = Foo::B; //~ ERROR E0265 + | ^^^^^^^^^^^^^^^^^^^^^^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-36163.rs:14:9 + | +14 | B = A, //~ ERROR E0265 + | ^ recursion not allowed in constant + +error[E0265]: recursive constant + --> $DIR/issue-36163.rs:18:9 + | +18 | C = Bar::C, //~ ERROR E0265 + | ^^^^^^ recursion not allowed in constant + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/issue-36708.rs b/src/test/ui/issue-36708.rs similarity index 92% rename from src/test/compile-fail/issue-36708.rs rename to src/test/ui/issue-36708.rs index 6146258fa8d44..92a724a7e966a 100644 --- a/src/test/compile-fail/issue-36708.rs +++ b/src/test/ui/issue-36708.rs @@ -17,7 +17,6 @@ struct Bar; impl lib::Foo for Bar { fn foo() {} //~^ ERROR E0049 - //~| NOTE found 1 type parameter, expected 0 } fn main() {} diff --git a/src/test/ui/issue-36708.stderr b/src/test/ui/issue-36708.stderr new file mode 100644 index 0000000000000..016841de16902 --- /dev/null +++ b/src/test/ui/issue-36708.stderr @@ -0,0 +1,8 @@ +error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters + --> $DIR/issue-36708.rs:18:11 + | +18 | fn foo() {} + | ^^^ found 1 type parameter, expected 0 + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-3779.rs b/src/test/ui/issue-3779.rs similarity index 86% rename from src/test/compile-fail/issue-3779.rs rename to src/test/ui/issue-3779.rs index 10f73dc086288..7490960da3677 100644 --- a/src/test/compile-fail/issue-3779.rs +++ b/src/test/ui/issue-3779.rs @@ -10,9 +10,7 @@ struct S { //~^ ERROR E0072 - //~| NOTE recursive type has infinite size element: Option - //~^ NOTE recursive without indirection } fn main() { diff --git a/src/test/ui/issue-3779.stderr b/src/test/ui/issue-3779.stderr new file mode 100644 index 0000000000000..538304803b440 --- /dev/null +++ b/src/test/ui/issue-3779.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `S` has infinite size + --> $DIR/issue-3779.rs:11:1 + | +11 | struct S { + | ^^^^^^^^ recursive type has infinite size +12 | //~^ ERROR E0072 +13 | element: Option + | ------------------ recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `S` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-37884.rs b/src/test/ui/issue-37884.rs similarity index 76% rename from src/test/compile-fail/issue-37884.rs rename to src/test/ui/issue-37884.rs index 6313293bf2b6a..ea6403a3eef34 100644 --- a/src/test/compile-fail/issue-37884.rs +++ b/src/test/ui/issue-37884.rs @@ -11,14 +11,11 @@ struct RepeatMut<'a, T>(T, &'a ()); impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { - //~^ NOTE ...does not necessarily outlive the lifetime 'a as defined on the impl type Item = &'a mut T; fn next(&'a mut self) -> Option //~^ ERROR method not compatible with trait //~| lifetime mismatch - //~| NOTE expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` - //~| NOTE the anonymous lifetime #1 defined on the method body { Some(&mut self.0) } diff --git a/src/test/ui/issue-37884.stderr b/src/test/ui/issue-37884.stderr new file mode 100644 index 0000000000000..439b123975f82 --- /dev/null +++ b/src/test/ui/issue-37884.stderr @@ -0,0 +1,37 @@ +error[E0308]: method not compatible with trait + --> $DIR/issue-37884.rs:16:5 + | +16 | / fn next(&'a mut self) -> Option +17 | | //~^ ERROR method not compatible with trait +18 | | //~| lifetime mismatch +19 | | { +20 | | Some(&mut self.0) +21 | | } + | |_____^ lifetime mismatch + | + = note: expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` + found type `fn(&'a mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` +note: the anonymous lifetime #1 defined on the method body at 16:5... + --> $DIR/issue-37884.rs:16:5 + | +16 | / fn next(&'a mut self) -> Option +17 | | //~^ ERROR method not compatible with trait +18 | | //~| lifetime mismatch +19 | | { +20 | | Some(&mut self.0) +21 | | } + | |_____^ +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:1 + --> $DIR/issue-37884.rs:13:1 + | +13 | / impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { +14 | | +15 | | type Item = &'a mut T; +16 | | fn next(&'a mut self) -> Option +... | +21 | | } +22 | | } + | |_^ + +error: aborting due to previous error + diff --git a/src/test/ui/issue-41652/issue_41652.rs b/src/test/ui/issue-41652/issue_41652.rs index 1874ee6cd3aa0..f38c682d31974 100644 --- a/src/test/ui/issue-41652/issue_41652.rs +++ b/src/test/ui/issue-41652/issue_41652.rs @@ -18,8 +18,6 @@ impl issue_41652_b::Tr for S { fn f() { 3.f() //~^ ERROR no method named `f` found for type `{integer}` in the current scope - //~| NOTE found the following associated functions - //~| NOTE candidate #1 is defined in the trait `issue_41652_b::Tr` } } diff --git a/src/test/compile-fail/issue-4335.rs b/src/test/ui/issue-4335.rs similarity index 83% rename from src/test/compile-fail/issue-4335.rs rename to src/test/ui/issue-4335.rs index c5aae894c3ecb..540504eb07ec1 100644 --- a/src/test/compile-fail/issue-4335.rs +++ b/src/test/ui/issue-4335.rs @@ -15,10 +15,7 @@ fn id(t: T) -> T { t } fn f<'r, T>(v: &'r T) -> Box T + 'r> { id(Box::new(|| *v)) //~^ ERROR E0373 - //~| NOTE `v` is borrowed here - //~| NOTE may outlive borrowed value `v` //~| ERROR E0507 - //~| NOTE cannot move out of borrowed content } fn main() { diff --git a/src/test/ui/issue-4335.stderr b/src/test/ui/issue-4335.stderr new file mode 100644 index 0000000000000..5840838b823d3 --- /dev/null +++ b/src/test/ui/issue-4335.stderr @@ -0,0 +1,20 @@ +error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function + --> $DIR/issue-4335.rs:16:17 + | +16 | id(Box::new(|| *v)) + | ^^ - `v` is borrowed here + | | + | may outlive borrowed value `v` +help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword + | +16 | id(Box::new(move || *v)) + | ^^^^^^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/issue-4335.rs:16:20 + | +16 | id(Box::new(|| *v)) + | ^^ cannot move out of borrowed content + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/issue-4935.rs b/src/test/ui/issue-4935.rs similarity index 95% rename from src/test/compile-fail/issue-4935.rs rename to src/test/ui/issue-4935.rs index e9f8367378a77..5b6e2c75a1c8f 100644 --- a/src/test/compile-fail/issue-4935.rs +++ b/src/test/ui/issue-4935.rs @@ -14,4 +14,3 @@ fn foo(a: usize) {} //~^ defined here fn main() { foo(5, 6) } //~^ ERROR this function takes 1 parameter but 2 parameters were supplied -//~| NOTE expected 1 parameter diff --git a/src/test/ui/issue-4935.stderr b/src/test/ui/issue-4935.stderr new file mode 100644 index 0000000000000..654fe53c07f10 --- /dev/null +++ b/src/test/ui/issue-4935.stderr @@ -0,0 +1,11 @@ +error[E0061]: this function takes 1 parameter but 2 parameters were supplied + --> $DIR/issue-4935.rs:15:13 + | +13 | fn foo(a: usize) {} + | ---------------- defined here +14 | //~^ defined here +15 | fn main() { foo(5, 6) } + | ^^^^^^^^^ expected 1 parameter + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-5239-1.rs b/src/test/ui/issue-5239-1.rs similarity index 92% rename from src/test/compile-fail/issue-5239-1.rs rename to src/test/ui/issue-5239-1.rs index a77b27150d797..f88b6931344a6 100644 --- a/src/test/compile-fail/issue-5239-1.rs +++ b/src/test/ui/issue-5239-1.rs @@ -13,5 +13,4 @@ fn main() { let x = |ref x: isize| { x += 1; }; //~^ ERROR E0368 - //~| NOTE cannot use `+=` on type `&isize` } diff --git a/src/test/ui/issue-5239-1.stderr b/src/test/ui/issue-5239-1.stderr new file mode 100644 index 0000000000000..b97b58981de62 --- /dev/null +++ b/src/test/ui/issue-5239-1.stderr @@ -0,0 +1,10 @@ +error[E0368]: binary assignment operation `+=` cannot be applied to type `&isize` + --> $DIR/issue-5239-1.rs:14:30 + | +14 | let x = |ref x: isize| { x += 1; }; + | -^^^^^ + | | + | cannot use `+=` on type `&isize` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-6458-3.rs b/src/test/ui/issue-6458-3.rs similarity index 93% rename from src/test/compile-fail/issue-6458-3.rs rename to src/test/ui/issue-6458-3.rs index 1503da2baa73d..038f6043fa667 100644 --- a/src/test/compile-fail/issue-6458-3.rs +++ b/src/test/ui/issue-6458-3.rs @@ -13,5 +13,4 @@ use std::mem; fn main() { mem::transmute(0); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `U` } diff --git a/src/test/ui/issue-6458-3.stderr b/src/test/ui/issue-6458-3.stderr new file mode 100644 index 0000000000000..761a9b38f6f06 --- /dev/null +++ b/src/test/ui/issue-6458-3.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458-3.rs:14:5 + | +14 | mem::transmute(0); + | ^^^^^^^^^^^^^^ cannot infer type for `U` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-6458-4.rs b/src/test/ui/issue-6458-4.rs similarity index 89% rename from src/test/compile-fail/issue-6458-4.rs rename to src/test/ui/issue-6458-4.rs index a078cdea4ac4d..45934d03ed4f9 100644 --- a/src/test/compile-fail/issue-6458-4.rs +++ b/src/test/ui/issue-6458-4.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo(b: bool) -> Result { //~ ERROR mismatched types - Err("bar".to_string()); //~ HELP consider removing this semicolon + Err("bar".to_string()); } fn main() { diff --git a/src/test/ui/issue-6458-4.stderr b/src/test/ui/issue-6458-4.stderr new file mode 100644 index 0000000000000..6cc1edcd9fa6c --- /dev/null +++ b/src/test/ui/issue-6458-4.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/issue-6458-4.rs:11:40 + | +11 | fn foo(b: bool) -> Result { //~ ERROR mismatched types + | ________________________________________^ +12 | | Err("bar".to_string()); + | | - help: consider removing this semicolon +13 | | } + | |_^ expected enum `std::result::Result`, found () + | + = note: expected type `std::result::Result` + found type `()` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/ui/issue-6458.rs similarity index 94% rename from src/test/compile-fail/issue-6458.rs rename to src/test/ui/issue-6458.rs index db4d4e76c11c9..b4e7c0c40cfb7 100644 --- a/src/test/compile-fail/issue-6458.rs +++ b/src/test/ui/issue-6458.rs @@ -18,7 +18,6 @@ pub fn foo(_: TypeWithState) {} pub fn bar() { foo(TypeWithState(marker::PhantomData)); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `State` } fn main() { diff --git a/src/test/ui/issue-6458.stderr b/src/test/ui/issue-6458.stderr new file mode 100644 index 0000000000000..b5d4ac831393f --- /dev/null +++ b/src/test/ui/issue-6458.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/issue-6458.rs:19:4 + | +19 | foo(TypeWithState(marker::PhantomData)); + | ^^^ cannot infer type for `State` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/issue-7813.rs b/src/test/ui/issue-7813.rs similarity index 87% rename from src/test/compile-fail/issue-7813.rs rename to src/test/ui/issue-7813.rs index a5f001b785cc9..39a87bfaf7440 100644 --- a/src/test/compile-fail/issue-7813.rs +++ b/src/test/ui/issue-7813.rs @@ -10,7 +10,5 @@ fn main() { let v = &[]; //~ ERROR type annotations needed - //~| NOTE consider giving `v` a type - //~| NOTE cannot infer type for `_` let it = v.iter(); } diff --git a/src/test/ui/issue-7813.stderr b/src/test/ui/issue-7813.stderr new file mode 100644 index 0000000000000..11f8e4d00fd1d --- /dev/null +++ b/src/test/ui/issue-7813.stderr @@ -0,0 +1,10 @@ +error[E0282]: type annotations needed + --> $DIR/issue-7813.rs:12:13 + | +12 | let v = &[]; //~ ERROR type annotations needed + | - ^^^ cannot infer type for `_` + | | + | consider giving `v` a type + +error: aborting due to previous error + diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs similarity index 71% rename from src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs rename to src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs index 2d9de57a2659f..a5fada7869e86 100644 --- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -10,14 +10,11 @@ // 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 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` panic!() } @@ -28,13 +25,10 @@ struct Foo<'a> { // Lifetime annotation needed because we have two lifetimes: one as a parameter // 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 lifetimes it is borrowed from panic!() } fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime panic!() } @@ -48,8 +42,6 @@ trait WithLifetime<'a> { // This worked because the type of the first argument contains // 'static, although StaticStr doesn't even have parameters. fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier -//~^ HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime panic!() } @@ -57,8 +49,6 @@ fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier // to >::Output which has the hidden 'a. fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { //~^ ERROR missing lifetime specifier -//~| HELP this function's return type contains a borrowed value -//~| HELP consider giving it an explicit bounded or 'static lifetime panic!() } diff --git a/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr new file mode 100644 index 0000000000000..f91b286bc4ac8 --- /dev/null +++ b/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -0,0 +1,54 @@ +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:12:11 + | +12 | fn f() -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from + = help: consider giving it a 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:33 + | +17 | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y` + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:27:19 + | +27 | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:31:20 + | +31 | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:44:24 + | +44 | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error[E0106]: missing lifetime specifier + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:50:49 + | +50 | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { + | ^ expected lifetime parameter + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + = help: consider giving it an explicit bounded or 'static lifetime + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/lint-forbid-attr.rs b/src/test/ui/lint-forbid-attr.rs similarity index 89% rename from src/test/compile-fail/lint-forbid-attr.rs rename to src/test/ui/lint-forbid-attr.rs index a23083b5c8c11..65e01600c1042 100644 --- a/src/test/compile-fail/lint-forbid-attr.rs +++ b/src/test/ui/lint-forbid-attr.rs @@ -9,10 +9,8 @@ // except according to those terms. #![forbid(deprecated)] -//~^ NOTE `forbid` level set here #[allow(deprecated)] //~^ ERROR allow(deprecated) overruled by outer forbid(deprecated) -//~| NOTE overruled by previous forbid fn main() { } diff --git a/src/test/ui/lint-forbid-attr.stderr b/src/test/ui/lint-forbid-attr.stderr new file mode 100644 index 0000000000000..dcef7fb9ac038 --- /dev/null +++ b/src/test/ui/lint-forbid-attr.stderr @@ -0,0 +1,11 @@ +error[E0453]: allow(deprecated) overruled by outer forbid(deprecated) + --> $DIR/lint-forbid-attr.rs:13:9 + | +11 | #![forbid(deprecated)] + | ---------- `forbid` level set here +12 | +13 | #[allow(deprecated)] + | ^^^^^^^^^^ overruled by previous forbid + +error: aborting due to previous error + diff --git a/src/test/compile-fail/lint-output-format-2.rs b/src/test/ui/lint-output-format-2.rs similarity index 95% rename from src/test/compile-fail/lint-output-format-2.rs rename to src/test/ui/lint-output-format-2.rs index 29d7c6caec468..5cd0084901fe3 100644 --- a/src/test/compile-fail/lint-output-format-2.rs +++ b/src/test/ui/lint-output-format-2.rs @@ -19,7 +19,6 @@ extern crate lint_output_format; use lint_output_format::{foo, bar}; //~^ WARNING use of deprecated item 'lint_output_format::foo': text -//~| NOTE #[warn(deprecated)] on by default #[rustc_error] fn main() { //~ ERROR: compilation successful diff --git a/src/test/ui/lint-output-format-2.stderr b/src/test/ui/lint-output-format-2.stderr new file mode 100644 index 0000000000000..d8c67c760db34 --- /dev/null +++ b/src/test/ui/lint-output-format-2.stderr @@ -0,0 +1,24 @@ +warning: use of deprecated item 'lint_output_format::foo': text + --> $DIR/lint-output-format-2.rs:20:5 + | +20 | use lint_output_format::{foo, bar}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(deprecated)] on by default + +warning: use of deprecated item 'lint_output_format::foo': text + --> $DIR/lint-output-format-2.rs:25:14 + | +25 | let _x = foo(); + | ^^^ + +error: compilation successful + --> $DIR/lint-output-format-2.rs:24:1 + | +24 | / fn main() { //~ ERROR: compilation successful +25 | | let _x = foo(); +26 | | //~^ WARNING use of deprecated item 'lint_output_format::foo': text +27 | | let _y = bar(); +28 | | } + | |_^ + diff --git a/src/test/compile-fail/lint-unconditional-recursion.rs b/src/test/ui/lint-unconditional-recursion.rs similarity index 76% rename from src/test/compile-fail/lint-unconditional-recursion.rs rename to src/test/ui/lint-unconditional-recursion.rs index bee5a2c45be6d..bfc144615a2d8 100644 --- a/src/test/compile-fail/lint-unconditional-recursion.rs +++ b/src/test/ui/lint-unconditional-recursion.rs @@ -9,11 +9,10 @@ // except according to those terms. #![deny(unconditional_recursion)] -//~^ NOTE lint level defined here #![allow(dead_code)] fn foo() { //~ ERROR function cannot return without recurring - foo(); //~ NOTE recursive call site + foo(); } fn bar() { @@ -24,9 +23,9 @@ fn bar() { fn baz() { //~ ERROR function cannot return without recurring if true { - baz() //~ NOTE recursive call site + baz() } else { - baz() //~ NOTE recursive call site + baz() } } @@ -36,24 +35,24 @@ fn qux() { fn quz() -> bool { //~ ERROR function cannot return without recurring if true { - while quz() {} //~ NOTE recursive call site + while quz() {} true } else { - loop { quz(); } //~ NOTE recursive call site + loop { quz(); } } } // Trait method calls. trait Foo { fn bar(&self) { //~ ERROR function cannot return without recurring - self.bar() //~ NOTE recursive call site + self.bar() } } impl Foo for Box { fn bar(&self) { //~ ERROR function cannot return without recurring loop { - self.bar() //~ NOTE recursive call site + self.bar() } } } @@ -61,7 +60,7 @@ impl Foo for Box { // Trait method call with integer fallback after method resolution. impl Foo for i32 { fn bar(&self) { //~ ERROR function cannot return without recurring - 0.bar() //~ NOTE recursive call site + 0.bar() } } @@ -74,14 +73,14 @@ impl Foo for u32 { // Trait method calls via paths. trait Foo2 { fn bar(&self) { //~ ERROR function cannot return without recurring - Foo2::bar(self) //~ NOTE recursive call site + Foo2::bar(self) } } impl Foo2 for Box { fn bar(&self) { //~ ERROR function cannot return without recurring loop { - Foo2::bar(self) //~ NOTE recursive call site + Foo2::bar(self) } } } @@ -90,19 +89,19 @@ struct Baz; impl Baz { // Inherent method call. fn qux(&self) { //~ ERROR function cannot return without recurring - self.qux(); //~ NOTE recursive call site + self.qux(); } // Inherent method call via path. fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring - Baz::as_ref(self) //~ NOTE recursive call site + Baz::as_ref(self) } } // Trait method calls to impls via paths. impl Default for Baz { fn default() -> Baz { //~ ERROR function cannot return without recurring - let x = Default::default(); //~ NOTE recursive call site + let x = Default::default(); x } } @@ -111,14 +110,14 @@ impl Default for Baz { impl std::ops::Deref for Baz { type Target = (); fn deref(&self) -> &() { //~ ERROR function cannot return without recurring - &**self //~ NOTE recursive call site + &**self } } impl std::ops::Index for Baz { type Output = Baz; fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring - &self[x] //~ NOTE recursive call site + &self[x] } } @@ -127,7 +126,7 @@ struct Quux; impl std::ops::Deref for Quux { type Target = Baz; fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring - self.as_ref() //~ NOTE recursive call site + self.as_ref() } } diff --git a/src/test/ui/lint-unconditional-recursion.stderr b/src/test/ui/lint-unconditional-recursion.stderr new file mode 100644 index 0000000000000..40eaab1437f11 --- /dev/null +++ b/src/test/ui/lint-unconditional-recursion.stderr @@ -0,0 +1,240 @@ +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:14:1 + | +14 | / fn foo() { //~ ERROR function cannot return without recurring +15 | | foo(); +16 | | } + | |_^ + | +note: lint level defined here + --> $DIR/lint-unconditional-recursion.rs:11:9 + | +11 | #![deny(unconditional_recursion)] + | ^^^^^^^^^^^^^^^^^^^^^^^ +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:15:5 + | +15 | foo(); + | ^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:24:1 + | +24 | / fn baz() { //~ ERROR function cannot return without recurring +25 | | if true { +26 | | baz() +27 | | } else { +28 | | baz() +29 | | } +30 | | } + | |_^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:26:9 + | +26 | baz() + | ^^^^^ +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:28:9 + | +28 | baz() + | ^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:36:1 + | +36 | / fn quz() -> bool { //~ ERROR function cannot return without recurring +37 | | if true { +38 | | while quz() {} +39 | | true +... | +42 | | } +43 | | } + | |_^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:38:15 + | +38 | while quz() {} + | ^^^^^ +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:41:16 + | +41 | loop { quz(); } + | ^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:47:5 + | +47 | / fn bar(&self) { //~ ERROR function cannot return without recurring +48 | | self.bar() +49 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:48:9 + | +48 | self.bar() + | ^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:53:5 + | +53 | / fn bar(&self) { //~ ERROR function cannot return without recurring +54 | | loop { +55 | | self.bar() +56 | | } +57 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:55:13 + | +55 | self.bar() + | ^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:62:5 + | +62 | / fn bar(&self) { //~ ERROR function cannot return without recurring +63 | | 0.bar() +64 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:63:9 + | +63 | 0.bar() + | ^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:75:5 + | +75 | / fn bar(&self) { //~ ERROR function cannot return without recurring +76 | | Foo2::bar(self) +77 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:76:9 + | +76 | Foo2::bar(self) + | ^^^^^^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:81:5 + | +81 | / fn bar(&self) { //~ ERROR function cannot return without recurring +82 | | loop { +83 | | Foo2::bar(self) +84 | | } +85 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:83:13 + | +83 | Foo2::bar(self) + | ^^^^^^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:91:5 + | +91 | / fn qux(&self) { //~ ERROR function cannot return without recurring +92 | | self.qux(); +93 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:92:9 + | +92 | self.qux(); + | ^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:96:5 + | +96 | / fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recurring +97 | | Baz::as_ref(self) +98 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:97:9 + | +97 | Baz::as_ref(self) + | ^^^^^^^^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:103:5 + | +103 | / fn default() -> Baz { //~ ERROR function cannot return without recurring +104 | | let x = Default::default(); +105 | | x +106 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:104:17 + | +104 | let x = Default::default(); + | ^^^^^^^^^^^^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:112:5 + | +112 | / fn deref(&self) -> &() { //~ ERROR function cannot return without recurring +113 | | &**self +114 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:113:10 + | +113 | &**self + | ^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:119:5 + | +119 | / fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recurring +120 | | &self[x] +121 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:120:10 + | +120 | &self[x] + | ^^^^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: function cannot return without recurring + --> $DIR/lint-unconditional-recursion.rs:128:5 + | +128 | / fn deref(&self) -> &Baz { //~ ERROR function cannot return without recurring +129 | | self.as_ref() +130 | | } + | |_____^ + | +note: recursive call site + --> $DIR/lint-unconditional-recursion.rs:129:9 + | +129 | self.as_ref() + | ^^^^ + = help: a `loop` may express intention better if this is on purpose + +error: aborting due to 14 previous errors + diff --git a/src/test/compile-fail/liveness-return-last-stmt-semi.rs b/src/test/ui/liveness-return-last-stmt-semi.rs similarity index 85% rename from src/test/compile-fail/liveness-return-last-stmt-semi.rs rename to src/test/ui/liveness-return-last-stmt-semi.rs index ada91c38d48c3..663c0275b82a7 100644 --- a/src/test/compile-fail/liveness-return-last-stmt-semi.rs +++ b/src/test/ui/liveness-return-last-stmt-semi.rs @@ -12,12 +12,11 @@ macro_rules! test { () => { fn foo() -> i32 { 1; } } } //~^ ERROR mismatched types - //~| HELP consider removing this semicolon fn no_return() -> i32 {} //~ ERROR mismatched types fn bar(x: u32) -> u32 { //~ ERROR mismatched types - x * 2; //~ HELP consider removing this semicolon + x * 2; } fn baz(x: u64) -> u32 { //~ ERROR mismatched types diff --git a/src/test/ui/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness-return-last-stmt-semi.stderr new file mode 100644 index 0000000000000..2057e14d55fd7 --- /dev/null +++ b/src/test/ui/liveness-return-last-stmt-semi.stderr @@ -0,0 +1,51 @@ +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:13:45 + | +13 | macro_rules! test { () => { fn foo() -> i32 { 1; } } } + | ^^^-^^ + | | | + | | help: consider removing this semicolon + | expected i32, found () +... +27 | test!(); + | -------- in this macro invocation + | + = note: expected type `i32` + found type `()` + +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:16:23 + | +16 | fn no_return() -> i32 {} //~ ERROR mismatched types + | ^^ expected i32, found () + | + = note: expected type `i32` + found type `()` + +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:18:23 + | +18 | fn bar(x: u32) -> u32 { //~ ERROR mismatched types + | _______________________^ +19 | | x * 2; + | | - help: consider removing this semicolon +20 | | } + | |_^ expected u32, found () + | + = note: expected type `u32` + found type `()` + +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:22:23 + | +22 | fn baz(x: u64) -> u32 { //~ ERROR mismatched types + | _______________________^ +23 | | x * 2; +24 | | } + | |_^ expected u32, found () + | + = note: expected type `u32` + found type `()` + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/loops-reject-duplicate-labels-2.rs b/src/test/ui/loops-reject-duplicate-labels-2.rs similarity index 65% rename from src/test/compile-fail/loops-reject-duplicate-labels-2.rs rename to src/test/ui/loops-reject-duplicate-labels-2.rs index ca18ca3796a10..598c7370b8906 100644 --- a/src/test/compile-fail/loops-reject-duplicate-labels-2.rs +++ b/src/test/ui/loops-reject-duplicate-labels-2.rs @@ -19,31 +19,23 @@ // https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833 pub fn foo() { - { 'fl: for _ in 0..10 { break; } } //~ NOTE first declared here + { 'fl: for _ in 0..10 { break; } } { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope - //~^ NOTE lifetime 'fl already in scope - { 'lf: loop { break; } } //~ NOTE first declared here + { 'lf: loop { break; } } { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope - //~^ NOTE lifetime 'lf already in scope - { 'wl: while 2 > 1 { break; } } //~ NOTE first declared here + { 'wl: while 2 > 1 { break; } } { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope - //~^ NOTE lifetime 'wl already in scope - { 'lw: loop { break; } } //~ NOTE first declared here + { 'lw: loop { break; } } { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope - //~^ NOTE lifetime 'lw already in scope - { 'fw: for _ in 0..10 { break; } } //~ NOTE first declared here + { 'fw: for _ in 0..10 { break; } } { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope - //~^ NOTE lifetime 'fw already in scope - { 'wf: while 2 > 1 { break; } } //~ NOTE first declared here + { 'wf: while 2 > 1 { break; } } { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope - //~^ NOTE lifetime 'wf already in scope - { 'tl: while let Some(_) = None:: { break; } } //~ NOTE first declared here + { 'tl: while let Some(_) = None:: { break; } } { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope - //~^ NOTE lifetime 'tl already in scope - { 'lt: loop { break; } } //~ NOTE first declared here + { 'lt: loop { break; } } { 'lt: while let Some(_) = None:: { break; } } //~^ WARN label name `'lt` shadows a label name that is already in scope - //~| NOTE lifetime 'lt already in scope } #[rustc_error] diff --git a/src/test/ui/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops-reject-duplicate-labels-2.stderr new file mode 100644 index 0000000000000..488046b71b3b1 --- /dev/null +++ b/src/test/ui/loops-reject-duplicate-labels-2.stderr @@ -0,0 +1,72 @@ +warning: label name `'fl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:23:7 + | +22 | { 'fl: for _ in 0..10 { break; } } + | --- first declared here +23 | { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope + | ^^^ lifetime 'fl already in scope + +warning: label name `'lf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:25:7 + | +24 | { 'lf: loop { break; } } + | --- first declared here +25 | { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope + | ^^^ lifetime 'lf already in scope + +warning: label name `'wl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:27:7 + | +26 | { 'wl: while 2 > 1 { break; } } + | --- first declared here +27 | { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope + | ^^^ lifetime 'wl already in scope + +warning: label name `'lw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:29:7 + | +28 | { 'lw: loop { break; } } + | --- first declared here +29 | { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope + | ^^^ lifetime 'lw already in scope + +warning: label name `'fw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:31:7 + | +30 | { 'fw: for _ in 0..10 { break; } } + | --- first declared here +31 | { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope + | ^^^ lifetime 'fw already in scope + +warning: label name `'wf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:33:7 + | +32 | { 'wf: while 2 > 1 { break; } } + | --- first declared here +33 | { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope + | ^^^ lifetime 'wf already in scope + +warning: label name `'tl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:35:7 + | +34 | { 'tl: while let Some(_) = None:: { break; } } + | --- first declared here +35 | { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope + | ^^^ lifetime 'tl already in scope + +warning: label name `'lt` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels-2.rs:37:7 + | +36 | { 'lt: loop { break; } } + | --- first declared here +37 | { 'lt: while let Some(_) = None:: { break; } } + | ^^^ lifetime 'lt already in scope + +error: compilation successful + --> $DIR/loops-reject-duplicate-labels-2.rs:42:1 + | +42 | / pub fn main() { //~ ERROR compilation successful +43 | | foo(); +44 | | } + | |_^ + diff --git a/src/test/compile-fail/loops-reject-duplicate-labels.rs b/src/test/ui/loops-reject-duplicate-labels.rs similarity index 63% rename from src/test/compile-fail/loops-reject-duplicate-labels.rs rename to src/test/ui/loops-reject-duplicate-labels.rs index 31f89493896d8..d768b002ab10c 100644 --- a/src/test/compile-fail/loops-reject-duplicate-labels.rs +++ b/src/test/ui/loops-reject-duplicate-labels.rs @@ -16,32 +16,24 @@ // This is testing the exact cases that are in the issue description. fn foo() { - 'fl: for _ in 0..10 { break; } //~ NOTE first declared here + 'fl: for _ in 0..10 { break; } 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope - //~^ NOTE lifetime 'fl already in scope - 'lf: loop { break; } //~ NOTE first declared here + 'lf: loop { break; } 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope - //~^ NOTE lifetime 'lf already in scope - 'wl: while 2 > 1 { break; } //~ NOTE first declared here + 'wl: while 2 > 1 { break; } 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope - //~^ NOTE lifetime 'wl already in scope - 'lw: loop { break; } //~ NOTE first declared here + 'lw: loop { break; } 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope - //~^ NOTE lifetime 'lw already in scope - 'fw: for _ in 0..10 { break; } //~ NOTE first declared here + 'fw: for _ in 0..10 { break; } 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope - //~^ NOTE lifetime 'fw already in scope - 'wf: while 2 > 1 { break; } //~ NOTE first declared here + 'wf: while 2 > 1 { break; } 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope - //~^ NOTE lifetime 'wf already in scope - 'tl: while let Some(_) = None:: { break; } //~ NOTE first declared here + 'tl: while let Some(_) = None:: { break; } 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope - //~^ NOTE lifetime 'tl already in scope - 'lt: loop { break; } //~ NOTE first declared here + 'lt: loop { break; } 'lt: while let Some(_) = None:: { break; } //~^ WARN label name `'lt` shadows a label name that is already in scope - //~| NOTE lifetime 'lt already in scope } // Note however that it is okay for the same label to be reused in diff --git a/src/test/ui/loops-reject-duplicate-labels.stderr b/src/test/ui/loops-reject-duplicate-labels.stderr new file mode 100644 index 0000000000000..3c287138c925c --- /dev/null +++ b/src/test/ui/loops-reject-duplicate-labels.stderr @@ -0,0 +1,75 @@ +warning: label name `'fl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:20:5 + | +19 | 'fl: for _ in 0..10 { break; } + | --- first declared here +20 | 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope + | ^^^ lifetime 'fl already in scope + +warning: label name `'lf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:23:5 + | +22 | 'lf: loop { break; } + | --- first declared here +23 | 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope + | ^^^ lifetime 'lf already in scope + +warning: label name `'wl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:25:5 + | +24 | 'wl: while 2 > 1 { break; } + | --- first declared here +25 | 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope + | ^^^ lifetime 'wl already in scope + +warning: label name `'lw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:27:5 + | +26 | 'lw: loop { break; } + | --- first declared here +27 | 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope + | ^^^ lifetime 'lw already in scope + +warning: label name `'fw` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:29:5 + | +28 | 'fw: for _ in 0..10 { break; } + | --- first declared here +29 | 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope + | ^^^ lifetime 'fw already in scope + +warning: label name `'wf` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:31:5 + | +30 | 'wf: while 2 > 1 { break; } + | --- first declared here +31 | 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope + | ^^^ lifetime 'wf already in scope + +warning: label name `'tl` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:33:5 + | +32 | 'tl: while let Some(_) = None:: { break; } + | --- first declared here +33 | 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope + | ^^^ lifetime 'tl already in scope + +warning: label name `'lt` shadows a label name that is already in scope + --> $DIR/loops-reject-duplicate-labels.rs:35:5 + | +34 | 'lt: loop { break; } + | --- first declared here +35 | 'lt: while let Some(_) = None:: { break; } + | ^^^ lifetime 'lt already in scope + +error: compilation successful + --> $DIR/loops-reject-duplicate-labels.rs:49:1 + | +49 | / pub fn main() { //~ ERROR compilation successful +50 | | let s = S; +51 | | s.m1(); +52 | | s.m2(); +53 | | foo(); +54 | | } + | |_^ + diff --git a/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs b/src/test/ui/loops-reject-labels-shadowing-lifetimes.rs similarity index 70% rename from src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs rename to src/test/ui/loops-reject-labels-shadowing-lifetimes.rs index 9a735f9c97c96..74da125d575a0 100644 --- a/src/test/compile-fail/loops-reject-labels-shadowing-lifetimes.rs +++ b/src/test/ui/loops-reject-labels-shadowing-lifetimes.rs @@ -16,10 +16,9 @@ #![allow(dead_code, unused_variables)] fn foo() { - fn foo<'a>() { //~ NOTE first declared here + fn foo<'a>() { 'a: loop { break 'a; } //~^ WARN label name `'a` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'a already in scope } struct Struct<'b, 'c> { _f: &'b i8, _g: &'c i8 } @@ -41,87 +40,75 @@ fn foo() { } } - impl<'bad, 'c> Struct<'bad, 'c> { //~ NOTE first declared here + impl<'bad, 'c> Struct<'bad, 'c> { fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - impl<'b, 'bad> Struct<'b, 'bad> { //~ NOTE first declared here + impl<'b, 'bad> Struct<'b, 'bad> { fn meth_bad2(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } impl<'b, 'c> Struct<'b, 'c> { - fn meth_bad3<'bad>(x: &'bad i8) { //~ NOTE first declared here + fn meth_bad3<'bad>(x: &'bad i8) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { - //~^ NOTE first declared here 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - impl <'bad, 'e> Enum<'bad, 'e> { //~ NOTE first declared here + impl <'bad, 'e> Enum<'bad, 'e> { fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - impl <'d, 'bad> Enum<'d, 'bad> { //~ NOTE first declared here + impl <'d, 'bad> Enum<'d, 'bad> { fn meth_bad2(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } impl <'d, 'e> Enum<'d, 'e> { - fn meth_bad3<'bad>(x: &'bad i8) { //~ NOTE first declared here + fn meth_bad3<'bad>(x: &'bad i8) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } - fn meth_bad4<'a,'bad>(x: &'bad i8) { //~ NOTE first declared here + fn meth_bad4<'a,'bad>(x: &'bad i8) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - trait HasDefaultMethod1<'bad> { //~ NOTE first declared here + trait HasDefaultMethod1<'bad> { fn meth_okay() { 'c: loop { break 'c; } } fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } - trait HasDefaultMethod2<'a,'bad> { //~ NOTE first declared here + trait HasDefaultMethod2<'a,'bad> { fn meth_bad(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } trait HasDefaultMethod3<'a,'b> { - fn meth_bad<'bad>(&self) { //~ NOTE first declared here + fn meth_bad<'bad>(&self) { 'bad: loop { break 'bad; } //~^ WARN label name `'bad` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'bad already in scope } } } diff --git a/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr new file mode 100644 index 0000000000000..07dbb68725dcc --- /dev/null +++ b/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr @@ -0,0 +1,110 @@ +warning: label name `'a` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:20:9 + | +19 | fn foo<'a>() { + | -- first declared here +20 | 'a: loop { break 'a; } + | ^^ lifetime 'a already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:45:13 + | +43 | impl<'bad, 'c> Struct<'bad, 'c> { + | ---- first declared here +44 | fn meth_bad(&self) { +45 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:52:13 + | +50 | impl<'b, 'bad> Struct<'b, 'bad> { + | ---- first declared here +51 | fn meth_bad2(&self) { +52 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:59:13 + | +58 | fn meth_bad3<'bad>(x: &'bad i8) { + | ---- first declared here +59 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:64:13 + | +63 | fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { + | ---- first declared here +64 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:71:13 + | +69 | impl <'bad, 'e> Enum<'bad, 'e> { + | ---- first declared here +70 | fn meth_bad(&self) { +71 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:77:13 + | +75 | impl <'d, 'bad> Enum<'d, 'bad> { + | ---- first declared here +76 | fn meth_bad2(&self) { +77 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:83:13 + | +82 | fn meth_bad3<'bad>(x: &'bad i8) { + | ---- first declared here +83 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:88:13 + | +87 | fn meth_bad4<'a,'bad>(x: &'bad i8) { + | ---- first declared here +88 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:98:13 + | +93 | trait HasDefaultMethod1<'bad> { + | ---- first declared here +... +98 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:104:13 + | +102 | trait HasDefaultMethod2<'a,'bad> { + | ---- first declared here +103 | fn meth_bad(&self) { +104 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +warning: label name `'bad` shadows a lifetime name that is already in scope + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:110:13 + | +109 | fn meth_bad<'bad>(&self) { + | ---- first declared here +110 | 'bad: loop { break 'bad; } + | ^^^^ lifetime 'bad already in scope + +error: compilation successful + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:117:1 + | +117 | / pub fn main() { //~ ERROR compilation successful +118 | | foo(); +119 | | } + | |_^ + diff --git a/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops-reject-lifetime-shadowing-label.rs similarity index 93% rename from src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs rename to src/test/ui/loops-reject-lifetime-shadowing-label.rs index 0a90917d975e5..077e57c9579e3 100644 --- a/src/test/compile-fail/loops-reject-lifetime-shadowing-label.rs +++ b/src/test/ui/loops-reject-lifetime-shadowing-label.rs @@ -27,10 +27,9 @@ fn foo() { let z = 3_i8; - 'a: loop { //~ NOTE first declared here + 'a: loop { let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; //~^ WARN lifetime name `'a` shadows a label name that is already in scope - //~| NOTE lifetime 'a already in scope assert_eq!((*b)(&z), z); break 'a; } diff --git a/src/test/ui/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops-reject-lifetime-shadowing-label.stderr new file mode 100644 index 0000000000000..d44b1b7b62351 --- /dev/null +++ b/src/test/ui/loops-reject-lifetime-shadowing-label.stderr @@ -0,0 +1,16 @@ +warning: lifetime name `'a` shadows a label name that is already in scope + --> $DIR/loops-reject-lifetime-shadowing-label.rs:31:51 + | +30 | 'a: loop { + | -- first declared here +31 | let b = Box::new(|x: &i8| *x) as Box Fn(&'a i8) -> i8>; + | ^^ lifetime 'a already in scope + +error: compilation successful + --> $DIR/loops-reject-lifetime-shadowing-label.rs:39:1 + | +39 | / pub fn main() { //~ ERROR compilation successful +40 | | foo(); +41 | | } + | |_^ + diff --git a/src/test/compile-fail/macro-context.rs b/src/test/ui/macro-context.rs similarity index 76% rename from src/test/compile-fail/macro-context.rs rename to src/test/ui/macro-context.rs index cc714a6e43141..56b3d5d0defb0 100644 --- a/src/test/compile-fail/macro-context.rs +++ b/src/test/ui/macro-context.rs @@ -17,11 +17,11 @@ macro_rules! m { } fn main() { - let a: m!(); //~ NOTE the usage of `m!` is likely invalid in type context - let i = m!(); //~ NOTE the usage of `m!` is likely invalid in expression context + let a: m!(); + let i = m!(); match 0 { - m!() => {} //~ NOTE the usage of `m!` is likely invalid in pattern context + m!() => {} } - m!(); //~ NOTE in this expansion + m!(); } diff --git a/src/test/ui/macro-context.stderr b/src/test/ui/macro-context.stderr new file mode 100644 index 0000000000000..37d99913d9795 --- /dev/null +++ b/src/test/ui/macro-context.stderr @@ -0,0 +1,47 @@ +error: macro expansion ignores token `;` and any following + --> $DIR/macro-context.rs:13:15 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^ + | +note: caused by the macro expansion here; the usage of `m!` is likely invalid in type context + --> $DIR/macro-context.rs:20:12 + | +20 | let a: m!(); + | ^^^^ + +error: macro expansion ignores token `typeof` and any following + --> $DIR/macro-context.rs:13:17 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^^^^^^ + | +note: caused by the macro expansion here; the usage of `m!` is likely invalid in expression context + --> $DIR/macro-context.rs:21:13 + | +21 | let i = m!(); + | ^^^^ + +error: macro expansion ignores token `;` and any following + --> $DIR/macro-context.rs:13:15 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^ + | +note: caused by the macro expansion here; the usage of `m!` is likely invalid in pattern context + --> $DIR/macro-context.rs:23:9 + | +23 | m!() => {} + | ^^^^ + +error: expected expression, found reserved keyword `typeof` + --> $DIR/macro-context.rs:13:17 + | +13 | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` + | ^^^^^^ +... +26 | m!(); + | ----- in this macro invocation + +error: aborting due to 4 previous errors + diff --git a/src/test/compile-fail/macro-invalid-fragment-spec.rs b/src/test/ui/macro-invalid-fragment-spec.rs similarity index 92% rename from src/test/compile-fail/macro-invalid-fragment-spec.rs rename to src/test/ui/macro-invalid-fragment-spec.rs index ca6cd664e7385..630e481f75ed0 100644 --- a/src/test/compile-fail/macro-invalid-fragment-spec.rs +++ b/src/test/ui/macro-invalid-fragment-spec.rs @@ -11,7 +11,6 @@ macro_rules! foo( ($x:foo) => () //~^ ERROR invalid fragment specifier - //~| HELP valid fragment specifiers are ); fn main() { diff --git a/src/test/ui/macro-invalid-fragment-spec.stderr b/src/test/ui/macro-invalid-fragment-spec.stderr new file mode 100644 index 0000000000000..b279933bd0512 --- /dev/null +++ b/src/test/ui/macro-invalid-fragment-spec.stderr @@ -0,0 +1,10 @@ +error: invalid fragment specifier `foo` + --> $DIR/macro-invalid-fragment-spec.rs:12:6 + | +12 | ($x:foo) => () + | ^^^^^^ + | + = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt`, `item` and `vis` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/macro-shadowing.rs b/src/test/ui/macro-shadowing.rs similarity index 77% rename from src/test/compile-fail/macro-shadowing.rs rename to src/test/ui/macro-shadowing.rs index f5e7305e4ea9e..61abaf8a2ddf8 100644 --- a/src/test/compile-fail/macro-shadowing.rs +++ b/src/test/ui/macro-shadowing.rs @@ -18,16 +18,11 @@ macro_rules! macro_one { () => {} } macro_rules! m1 { () => { macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope - //~^ NOTE macro-expanded `macro_rules!`s may not shadow existing macros #[macro_use] //~ ERROR `macro_two` is already in scope - //~^ NOTE macro-expanded `#[macro_use]`s may not shadow existing macros extern crate two_macros as __; }} -m1!(); //~ NOTE in this expansion - //~| NOTE in this expansion - //~| NOTE in this expansion - //~| NOTE in this expansion +m1!(); foo!(); diff --git a/src/test/ui/macro-shadowing.stderr b/src/test/ui/macro-shadowing.stderr new file mode 100644 index 0000000000000..9ed372f275de2 --- /dev/null +++ b/src/test/ui/macro-shadowing.stderr @@ -0,0 +1,24 @@ +error: `macro_two` is already in scope + --> $DIR/macro-shadowing.rs:22:5 + | +22 | #[macro_use] //~ ERROR `macro_two` is already in scope + | ^^^^^^^^^^^^ +... +25 | m1!(); + | ------ in this macro invocation + | + = note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560) + +error: `foo` is already in scope + --> $DIR/macro-shadowing.rs:20:5 + | +20 | macro_rules! foo { () => {} } //~ ERROR `foo` is already in scope + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +25 | m1!(); + | ------ in this macro invocation + | + = note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560) + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/main-wrong-location.rs b/src/test/ui/main-wrong-location.rs similarity index 90% rename from src/test/compile-fail/main-wrong-location.rs rename to src/test/ui/main-wrong-location.rs index ef3f8140c68a0..45be5f1478718 100644 --- a/src/test/compile-fail/main-wrong-location.rs +++ b/src/test/ui/main-wrong-location.rs @@ -11,5 +11,5 @@ mod m { // An inferred main entry point (that doesn't use #[main]) // must appear at the top of the crate - fn main() { } //~ NOTE here is a function named 'main' + fn main() { } } diff --git a/src/test/ui/main-wrong-location.stderr b/src/test/ui/main-wrong-location.stderr new file mode 100644 index 0000000000000..cb9740b87792f --- /dev/null +++ b/src/test/ui/main-wrong-location.stderr @@ -0,0 +1,11 @@ +error[E0601]: main function not found + | + = note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior. +note: here is a function named 'main' + --> $DIR/main-wrong-location.rs:14:5 + | +14| fn main() { } + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/maybe-bounds.rs b/src/test/ui/maybe-bounds.rs similarity index 92% rename from src/test/compile-fail/maybe-bounds.rs rename to src/test/ui/maybe-bounds.rs index b0b412bbf89ec..1dc198dee8345 100644 --- a/src/test/compile-fail/maybe-bounds.rs +++ b/src/test/ui/maybe-bounds.rs @@ -9,7 +9,6 @@ // except according to those terms. trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits - //~^ NOTE traits are `?Sized` by default type A1 = Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types type A2 = for<'a> Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types diff --git a/src/test/ui/maybe-bounds.stderr b/src/test/ui/maybe-bounds.stderr new file mode 100644 index 0000000000000..df9c3bca36429 --- /dev/null +++ b/src/test/ui/maybe-bounds.stderr @@ -0,0 +1,22 @@ +error: `?Trait` is not permitted in supertraits + --> $DIR/maybe-bounds.rs:11:12 + | +11 | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits + | ^^^^^ + | + = note: traits are `?Sized` by default + +error: `?Trait` is not permitted in trait object types + --> $DIR/maybe-bounds.rs:13:17 + | +13 | type A1 = Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types + | ^^^^^ + +error: `?Trait` is not permitted in trait object types + --> $DIR/maybe-bounds.rs:14:25 + | +14 | type A2 = for<'a> Tr + ?Sized; //~ ERROR `?Trait` is not permitted in trait object types + | ^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/method-call-err-msg.rs b/src/test/ui/method-call-err-msg.rs index 37806e43a9d1c..3434cf96fce94 100644 --- a/src/test/ui/method-call-err-msg.rs +++ b/src/test/ui/method-call-err-msg.rs @@ -10,29 +10,21 @@ // Test that parameter cardinality or missing method error gets span exactly. -pub struct Foo; //~ NOTE not found for this +pub struct Foo; impl Foo { fn zero(self) -> Foo { self } - //~^ NOTE defined here fn one(self, _: isize) -> Foo { self } - //~^ NOTE defined here fn two(self, _: isize, _: isize) -> Foo { self } - //~^ NOTE defined here } fn main() { let x = Foo; x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied - //~^ NOTE expected 0 parameters .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied - //~^ NOTE expected 1 parameter .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied - //~^ NOTE expected 2 parameters let y = Foo; y.zero() .take() //~ ERROR no method named `take` found for type `Foo` in the current scope - //~^ NOTE the method `take` exists but the following trait bounds were not satisfied - //~| NOTE the following traits define an item `take`, perhaps you need to implement one of them .one(0); } diff --git a/src/test/ui/method-call-err-msg.stderr b/src/test/ui/method-call-err-msg.stderr index 2aa654ff6243d..8685d0fc9c134 100644 --- a/src/test/ui/method-call-err-msg.stderr +++ b/src/test/ui/method-call-err-msg.stderr @@ -1,37 +1,37 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:25:7 + --> $DIR/method-call-err-msg.rs:22:7 | 15 | fn zero(self) -> Foo { self } | -------------------- defined here ... -25 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied +22 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied | ^^^^ expected 0 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/method-call-err-msg.rs:27:7 + --> $DIR/method-call-err-msg.rs:23:7 | -17 | fn one(self, _: isize) -> Foo { self } +16 | fn one(self, _: isize) -> Foo { self } | ----------------------------- defined here ... -27 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied +23 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied | ^^^ expected 1 parameter error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:29:7 + --> $DIR/method-call-err-msg.rs:24:7 | -19 | fn two(self, _: isize, _: isize) -> Foo { self } +17 | fn two(self, _: isize, _: isize) -> Foo { self } | --------------------------------------- defined here ... -29 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied +24 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied | ^^^ expected 2 parameters error[E0599]: no method named `take` found for type `Foo` in the current scope - --> $DIR/method-call-err-msg.rs:34:7 + --> $DIR/method-call-err-msg.rs:28:7 | -13 | pub struct Foo; //~ NOTE not found for this +13 | pub struct Foo; | --------------- method `take` not found for this ... -34 | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope +28 | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope | ^^^^ | = note: the method `take` exists but the following trait bounds were not satisfied: diff --git a/src/test/compile-fail/method-missing-call.rs b/src/test/ui/method-missing-call.rs similarity index 90% rename from src/test/compile-fail/method-missing-call.rs rename to src/test/ui/method-missing-call.rs index b13d4250ee958..7a6ea94d977d4 100644 --- a/src/test/compile-fail/method-missing-call.rs +++ b/src/test/ui/method-missing-call.rs @@ -30,7 +30,6 @@ fn main() { let point: Point = Point::new(); let px: isize = point .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` - //~^ HELP maybe a `()` to call it is missing // Ensure the span is useful let ys = &[1,2,3,4,5,6,7]; @@ -38,5 +37,4 @@ fn main() { .map(|x| x) .filter(|&&x| x == 1) .filter_map; //~ ERROR attempted to take value of method `filter_map` on type - //~^ HELP maybe a `()` to call it is missing } diff --git a/src/test/ui/method-missing-call.stderr b/src/test/ui/method-missing-call.stderr new file mode 100644 index 0000000000000..d4cffbff4ef76 --- /dev/null +++ b/src/test/ui/method-missing-call.stderr @@ -0,0 +1,18 @@ +error[E0615]: attempted to take value of method `get_x` on type `Point` + --> $DIR/method-missing-call.rs:32:26 + | +32 | .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` + | ^^^^^ + | + = help: maybe a `()` to call it is missing? + +error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter, [closure@$DIR/method-missing-call.rs:37:20: 37:25]>, [closure@$DIR/method-missing-call.rs:38:23: 38:35]>` + --> $DIR/method-missing-call.rs:39:16 + | +39 | .filter_map; //~ ERROR attempted to take value of method `filter_map` on type + | ^^^^^^^^^^ + | + = help: maybe a `()` to call it is missing? + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/mismatched_types/E0053.rs b/src/test/ui/mismatched_types/E0053.rs index f82f3fb0fa4f7..c09d6673aebcc 100644 --- a/src/test/ui/mismatched_types/E0053.rs +++ b/src/test/ui/mismatched_types/E0053.rs @@ -9,8 +9,8 @@ // except according to those terms. trait Foo { - fn foo(x: u16); //~ NOTE type in trait - fn bar(&self); //~ NOTE type in trait + fn foo(x: u16); + fn bar(&self); } struct Bar; @@ -18,12 +18,8 @@ struct Bar; impl Foo for Bar { fn foo(x: i16) { } //~^ ERROR method `foo` has an incompatible type for trait - //~| NOTE expected u16 - //~| NOTE expected type `fn(u16)` fn bar(&mut self) { } //~^ ERROR method `bar` has an incompatible type for trait - //~| NOTE types differ in mutability - //~| NOTE expected type `fn(&Bar)` } fn main() { diff --git a/src/test/ui/mismatched_types/E0053.stderr b/src/test/ui/mismatched_types/E0053.stderr index b80363e3d3e1a..226cb473e7789 100644 --- a/src/test/ui/mismatched_types/E0053.stderr +++ b/src/test/ui/mismatched_types/E0053.stderr @@ -1,7 +1,7 @@ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/E0053.rs:19:15 | -12 | fn foo(x: u16); //~ NOTE type in trait +12 | fn foo(x: u16); | --- type in trait ... 19 | fn foo(x: i16) { } @@ -11,12 +11,12 @@ error[E0053]: method `foo` has an incompatible type for trait found type `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/E0053.rs:23:12 + --> $DIR/E0053.rs:21:12 | -13 | fn bar(&self); //~ NOTE type in trait +13 | fn bar(&self); | ----- type in trait ... -23 | fn bar(&mut self) { } +21 | fn bar(&mut self) { } | ^^^^^^^^^ types differ in mutability | = note: expected type `fn(&Bar)` diff --git a/src/test/ui/mismatched_types/E0409.rs b/src/test/ui/mismatched_types/E0409.rs index 17bbc3f24336f..345020f2eae10 100644 --- a/src/test/ui/mismatched_types/E0409.rs +++ b/src/test/ui/mismatched_types/E0409.rs @@ -13,11 +13,7 @@ fn main() { match x { (0, ref y) | (y, 0) => {} //~ ERROR E0409 - //~^ NOTE bound in different ways - //~| NOTE first binding //~| ERROR E0308 - //~| NOTE expected &{integer}, found integral variable - //~| NOTE expected type `&{integer}` _ => () } } diff --git a/src/test/ui/mismatched_types/fn-variance-1.rs b/src/test/ui/mismatched_types/fn-variance-1.rs index af691663411fa..2b797ef7681c4 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.rs +++ b/src/test/ui/mismatched_types/fn-variance-1.rs @@ -9,10 +9,8 @@ // except according to those terms. fn takes_imm(x: &isize) { } -//~^ NOTE found signature fn takes_mut(x: &mut isize) { } -//~^ NOTE found signature fn apply(t: T, f: F) where F: FnOnce(T) { f(t) @@ -22,12 +20,8 @@ fn main() { apply(&3, takes_imm); apply(&3, takes_mut); //~^ ERROR type mismatch - //~| NOTE required by `apply` - //~| NOTE expected signature apply(&mut 3, takes_mut); apply(&mut 3, takes_imm); //~^ ERROR type mismatch - //~| NOTE required by `apply` - //~| NOTE expected signature } diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index 856efcd42181c..2a27ffd106247 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -1,21 +1,21 @@ error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:23:5 + --> $DIR/fn-variance-1.rs:21:5 | -14 | fn takes_mut(x: &mut isize) { } +13 | fn takes_mut(x: &mut isize) { } | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` ... -23 | apply(&3, takes_mut); +21 | apply(&3, takes_mut); | ^^^^^ expected signature of `fn(&{integer}) -> _` | = note: required by `apply` error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:29:5 + --> $DIR/fn-variance-1.rs:25:5 | 11 | fn takes_imm(x: &isize) { } | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` ... -29 | apply(&mut 3, takes_imm); +25 | apply(&mut 3, takes_imm); | ^^^^^ expected signature of `fn(&mut {integer}) -> _` | = note: required by `apply` diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.rs b/src/test/ui/mismatched_types/for-loop-has-unit-body.rs index 8c61fc602e09e..4ffee75348a8d 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.rs +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.rs @@ -11,7 +11,5 @@ fn main() { for x in 0..3 { x //~ ERROR mismatched types - //~| NOTE expected () - //~| NOTE expected type `()` } } diff --git a/src/test/ui/mismatched_types/issue-19109.rs b/src/test/ui/mismatched_types/issue-19109.rs index 59127c10cd1e6..0f85218fcb8e0 100644 --- a/src/test/ui/mismatched_types/issue-19109.rs +++ b/src/test/ui/mismatched_types/issue-19109.rs @@ -13,8 +13,6 @@ trait Trait { } fn function(t: &mut Trait) { t as *mut Trait //~^ ERROR: mismatched types - //~| NOTE: expected type `()` - //~| NOTE: expected (), found *-ptr } fn main() { } diff --git a/src/test/ui/mismatched_types/issue-36053-2.rs b/src/test/ui/mismatched_types/issue-36053-2.rs index 76885651c5b53..bf72e584b562b 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.rs +++ b/src/test/ui/mismatched_types/issue-36053-2.rs @@ -17,7 +17,4 @@ fn main() { once::<&str>("str").fuse().filter(|a: &str| true).count(); //~^ ERROR no method named `count` //~| ERROR type mismatch in closure arguments - //~| NOTE the method `count` exists but the following trait bounds - //~| NOTE expected signature - //~| NOTE found signature } diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs index a4eb445555112..2c7b8218de081 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs @@ -14,5 +14,4 @@ fn main() { let a: Result<(), Foo> = Ok(()); a.unwrap(); //~^ ERROR no method named `unwrap` found for type `std::result::Result<(), Foo>` - //~| NOTE the method `unwrap` exists but the following trait bounds were not satisfied } diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.rs b/src/test/ui/mismatched_types/overloaded-calls-bad.rs index da1265dfeff7e..00edc07db81b1 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.rs +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.rs @@ -36,12 +36,8 @@ fn main() { y: 3, }; let ans = s("what"); //~ ERROR mismatched types - //~^ NOTE expected isize, found reference - //~| NOTE expected type let ans = s(); //~^ ERROR this function takes 1 parameter but 0 parameters were supplied - //~| NOTE expected 1 parameter let ans = s("burma", "shave"); //~^ ERROR this function takes 1 parameter but 2 parameters were supplied - //~| NOTE expected 1 parameter } diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 66642466de37b..1d4adc7d6d5fd 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -8,15 +8,15 @@ error[E0308]: mismatched types found type `&'static str` error[E0057]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:41:15 + --> $DIR/overloaded-calls-bad.rs:39:15 | -41 | let ans = s(); +39 | let ans = s(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:44:15 + --> $DIR/overloaded-calls-bad.rs:41:15 | -44 | let ans = s("burma", "shave"); +41 | let ans = s("burma", "shave"); | ^^^^^^^^^^^^^^^^^^^ expected 1 parameter error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index 115be1bf4de55..b2aeabdc1e1cf 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs @@ -22,8 +22,6 @@ fn c(x: Box) { fn d(x: Box) { a(x); //~ ERROR mismatched types [E0308] - //~| NOTE expected type `std::boxed::Box` - //~| NOTE expected trait `Foo + std::marker::Send`, found trait `Foo` } fn main() { } diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs index 814f2c4d187cd..10f4b3229f0da 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs @@ -20,10 +20,8 @@ fn call_itisize>(y: isize, mut f: F) -> isize { pub fn main() { let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); - //~^ NOTE found signature of `fn(usize, isize) let z = call_it(3, f); //~^ ERROR type mismatch - //~| NOTE expected signature of `fn(isize, isize) //~| required by `call_it` println!("{}", z); } diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 8fa430ffff9d9..8539c8818c025 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,10 +1,9 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/unboxed-closures-vtable-mismatch.rs:24:13 + --> $DIR/unboxed-closures-vtable-mismatch.rs:23:13 | 22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` -23 | //~^ NOTE found signature of `fn(usize, isize) -24 | let z = call_it(3, f); +23 | let z = call_it(3, f); | ^^^^^^^ expected signature of `fn(isize, isize) -> _` | = note: required by `call_it` diff --git a/src/test/compile-fail/missing-block-hint.rs b/src/test/ui/missing-block-hint.rs similarity index 85% rename from src/test/compile-fail/missing-block-hint.rs rename to src/test/ui/missing-block-hint.rs index 6a140e6f21c19..777ff5b9b2650 100644 --- a/src/test/compile-fail/missing-block-hint.rs +++ b/src/test/ui/missing-block-hint.rs @@ -15,7 +15,5 @@ fn main() { { if (foo) bar; //~ ERROR expected `{`, found `bar` - //~^ HELP try placing this code inside a block - //~| SUGGESTION { bar; } } } diff --git a/src/test/ui/missing-block-hint.stderr b/src/test/ui/missing-block-hint.stderr new file mode 100644 index 0000000000000..3f50fdd4613eb --- /dev/null +++ b/src/test/ui/missing-block-hint.stderr @@ -0,0 +1,16 @@ +error: expected `{`, found `=>` + --> $DIR/missing-block-hint.rs:13:18 + | +13 | if (foo) => {} //~ ERROR expected `{`, found `=>` + | ^^ + +error: expected `{`, found `bar` + --> $DIR/missing-block-hint.rs:17:13 + | +17 | bar; //~ ERROR expected `{`, found `bar` + | ^^^- + | | + | help: try placing this code inside a block: `{ bar; }` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/ui/moves-based-on-type-block-bad.rs similarity index 96% rename from src/test/compile-fail/moves-based-on-type-block-bad.rs rename to src/test/ui/moves-based-on-type-block-bad.rs index deaff3c352111..dd4c4c843ab8a 100644 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ b/src/test/ui/moves-based-on-type-block-bad.rs @@ -35,7 +35,6 @@ fn main() { //~| cannot move out of borrowed content box E::Foo(_) => {} box E::Bar(x) => println!("{}", x.to_string()), - //~^ NOTE to prevent move box E::Baz => {} } }) diff --git a/src/test/ui/moves-based-on-type-block-bad.stderr b/src/test/ui/moves-based-on-type-block-bad.stderr new file mode 100644 index 0000000000000..5fc26a8ad68fa --- /dev/null +++ b/src/test/ui/moves-based-on-type-block-bad.stderr @@ -0,0 +1,11 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/moves-based-on-type-block-bad.rs:34:19 + | +34 | match hellothere.x { //~ ERROR cannot move out + | ^^^^^^^^^^ cannot move out of borrowed content +... +37 | box E::Bar(x) => println!("{}", x.to_string()), + | - hint: to prevent move, use `ref x` or `ref mut x` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/moves-based-on-type-match-bindings.rs b/src/test/ui/moves-based-on-type-match-bindings.rs similarity index 95% rename from src/test/compile-fail/moves-based-on-type-match-bindings.rs rename to src/test/ui/moves-based-on-type-match-bindings.rs index bcbb8dbfad121..1fd3d03570a69 100644 --- a/src/test/compile-fail/moves-based-on-type-match-bindings.rs +++ b/src/test/ui/moves-based-on-type-match-bindings.rs @@ -20,7 +20,7 @@ fn f10() { let x = Foo {f: "hi".to_string()}; let y = match x { - Foo {f} => {} //~ NOTE moved here + Foo {f} => {} }; touch(&x); //~ ERROR use of partially moved value: `x` diff --git a/src/test/ui/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves-based-on-type-match-bindings.stderr new file mode 100644 index 0000000000000..5256b55f01c6e --- /dev/null +++ b/src/test/ui/moves-based-on-type-match-bindings.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of partially moved value: `x` + --> $DIR/moves-based-on-type-match-bindings.rs:26:12 + | +23 | Foo {f} => {} + | - value moved here +... +26 | touch(&x); //~ ERROR use of partially moved value: `x` + | ^ value used here after move + | + = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait + +error: aborting due to previous error + diff --git a/src/test/compile-fail/no-patterns-in-args.rs b/src/test/ui/no-patterns-in-args.rs similarity index 83% rename from src/test/compile-fail/no-patterns-in-args.rs rename to src/test/ui/no-patterns-in-args.rs index 081d6caaa13c9..757bd2cb52b77 100644 --- a/src/test/compile-fail/no-patterns-in-args.rs +++ b/src/test/ui/no-patterns-in-args.rs @@ -10,11 +10,8 @@ extern { fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations - //~^ NOTE pattern not allowed in foreign function fn g1(arg: u8); // OK fn g2(_: u8); // OK // fn g3(u8); // Not yet diff --git a/src/test/ui/no-patterns-in-args.stderr b/src/test/ui/no-patterns-in-args.stderr new file mode 100644 index 0000000000000..0db9eb9ded3b2 --- /dev/null +++ b/src/test/ui/no-patterns-in-args.stderr @@ -0,0 +1,32 @@ +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/no-patterns-in-args.rs:12:11 + | +12 | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations + | ^^^^^^^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/no-patterns-in-args.rs:13:11 + | +13 | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations + | ^^^^ pattern not allowed in foreign function + +error[E0130]: patterns aren't allowed in foreign function declarations + --> $DIR/no-patterns-in-args.rs:14:11 + | +14 | fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations + | ^^^^^^^ pattern not allowed in foreign function + +error[E0561]: patterns aren't allowed in function pointer types + --> $DIR/no-patterns-in-args.rs:20:14 + | +20 | type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types + | ^^^^^^^ + +error[E0561]: patterns aren't allowed in function pointer types + --> $DIR/no-patterns-in-args.rs:21:14 + | +21 | type A2 = fn(&arg: u8); //~ ERROR patterns aren't allowed in function pointer types + | ^^^^ + +error: aborting due to 5 previous errors + diff --git a/src/test/compile-fail/non-constant-expr-for-arr-len.rs b/src/test/ui/non-constant-expr-for-arr-len.rs similarity index 94% rename from src/test/compile-fail/non-constant-expr-for-arr-len.rs rename to src/test/ui/non-constant-expr-for-arr-len.rs index 17df7ae2347f2..f8f46f30f8d92 100644 --- a/src/test/compile-fail/non-constant-expr-for-arr-len.rs +++ b/src/test/ui/non-constant-expr-for-arr-len.rs @@ -14,6 +14,5 @@ fn main() { fn bar(n: usize) { let _x = [0; n]; //~^ ERROR attempt to use a non-constant value in a constant [E0435] - //~| NOTE non-constant value } } diff --git a/src/test/ui/non-constant-expr-for-arr-len.stderr b/src/test/ui/non-constant-expr-for-arr-len.stderr new file mode 100644 index 0000000000000..be7e8583824a5 --- /dev/null +++ b/src/test/ui/non-constant-expr-for-arr-len.stderr @@ -0,0 +1,8 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/non-constant-expr-for-arr-len.rs:15:22 + | +15 | let _x = [0; n]; + | ^ non-constant value + +error: aborting due to previous error + diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/ui/non-exhaustive-pattern-witness.rs similarity index 86% rename from src/test/compile-fail/non-exhaustive-pattern-witness.rs rename to src/test/ui/non-exhaustive-pattern-witness.rs index eba61ede8cb20..0b12a9acbcb9e 100644 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ b/src/test/ui/non-exhaustive-pattern-witness.rs @@ -19,7 +19,6 @@ struct Foo { fn struct_with_a_nested_enum_and_vector() { match (Foo { first: true, second: None }) { //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered -//~| NOTE pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered Foo { first: true, second: None } => (), Foo { first: true, second: Some(_) } => (), Foo { first: false, second: None } => (), @@ -36,7 +35,6 @@ enum Color { fn enum_with_single_missing_variant() { match Color::Red { //~^ ERROR non-exhaustive patterns: `Red` not covered - //~| NOTE pattern `Red` not covered Color::CustomRGBA { .. } => (), Color::Green => () } @@ -49,7 +47,6 @@ enum Direction { fn enum_with_multiple_missing_variants() { match Direction::North { //~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered - //~| NOTE patterns `East`, `South` and `West` not covered Direction::North => () } } @@ -61,7 +58,6 @@ enum ExcessiveEnum { fn enum_with_excessive_missing_variants() { match ExcessiveEnum::First { //~^ ERROR `Second`, `Third`, `Fourth` and 8 more not covered - //~| NOTE patterns `Second`, `Third`, `Fourth` and 8 more not covered ExcessiveEnum::First => () } @@ -70,7 +66,6 @@ fn enum_with_excessive_missing_variants() { fn enum_struct_variant() { match Color::Red { //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - //~| NOTE pattern `CustomRGBA { a: true, .. }` not covered Color::Red => (), Color::Green => (), Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), @@ -87,7 +82,6 @@ fn vectors_with_nested_enums() { let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; match *x { //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered - //~| NOTE pattern `[Second(true), Second(false)]` not covered [] => (), [_] => (), [Enum::First, _] => (), @@ -101,7 +95,6 @@ fn vectors_with_nested_enums() { fn missing_nil() { match ((), false) { //~^ ERROR non-exhaustive patterns: `((), false)` not covered - //~| NOTE pattern `((), false)` not covered ((), true) => () } } diff --git a/src/test/ui/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive-pattern-witness.stderr new file mode 100644 index 0000000000000..f012dfed0b852 --- /dev/null +++ b/src/test/ui/non-exhaustive-pattern-witness.stderr @@ -0,0 +1,44 @@ +error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:20:11 + | +20 | match (Foo { first: true, second: None }) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered + +error[E0004]: non-exhaustive patterns: `Red` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:36:11 + | +36 | match Color::Red { + | ^^^^^^^^^^ pattern `Red` not covered + +error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:48:11 + | +48 | match Direction::North { + | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered + +error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered + --> $DIR/non-exhaustive-pattern-witness.rs:59:11 + | +59 | match ExcessiveEnum::First { + | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered + +error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:67:11 + | +67 | match Color::Red { + | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered + +error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:83:11 + | +83 | match *x { + | ^^ pattern `[Second(true), Second(false)]` not covered + +error[E0004]: non-exhaustive patterns: `((), false)` not covered + --> $DIR/non-exhaustive-pattern-witness.rs:96:11 + | +96 | match ((), false) { + | ^^^^^^^^^^^ pattern `((), false)` not covered + +error: aborting due to 7 previous errors + diff --git a/src/test/compile-fail/not-enough-arguments.rs b/src/test/ui/not-enough-arguments.rs similarity index 92% rename from src/test/compile-fail/not-enough-arguments.rs rename to src/test/ui/not-enough-arguments.rs index e13008df0d9b8..c952906e5e89a 100644 --- a/src/test/compile-fail/not-enough-arguments.rs +++ b/src/test/ui/not-enough-arguments.rs @@ -13,12 +13,10 @@ // unrelated errors. fn foo(a: isize, b: isize, c: isize, d:isize) { - //~^ NOTE defined here panic!(); } fn main() { foo(1, 2, 3); //~^ ERROR this function takes 4 parameters but 3 - //~| NOTE expected 4 parameters } diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr new file mode 100644 index 0000000000000..291aa6ec4c114 --- /dev/null +++ b/src/test/ui/not-enough-arguments.stderr @@ -0,0 +1,11 @@ +error[E0061]: this function takes 4 parameters but 3 parameters were supplied + --> $DIR/not-enough-arguments.rs:20:3 + | +15 | fn foo(a: isize, b: isize, c: isize, d:isize) { + | --------------------------------------------- defined here +... +20 | foo(1, 2, 3); + | ^^^^^^^^^^^^ expected 4 parameters + +error: aborting due to previous error + diff --git a/src/test/compile-fail/numeric-fields.rs b/src/test/ui/numeric-fields.rs similarity index 82% rename from src/test/compile-fail/numeric-fields.rs rename to src/test/ui/numeric-fields.rs index d6e091a1472cd..89d09560369fe 100644 --- a/src/test/compile-fail/numeric-fields.rs +++ b/src/test/ui/numeric-fields.rs @@ -13,11 +13,8 @@ struct S(u8, u16); fn main() { let s = S{0b1: 10, 0: 11}; //~^ ERROR struct `S` has no field named `0b1` - //~| NOTE `S` does not have this field - //~| NOTE available fields are: `0`, `1` match s { S{0: a, 0x1: b, ..} => {} //~^ ERROR does not have a field named `0x1` - //~| NOTE struct `S` does not have field `0x1` } } diff --git a/src/test/ui/numeric-fields.stderr b/src/test/ui/numeric-fields.stderr new file mode 100644 index 0000000000000..cdf85d4f9718e --- /dev/null +++ b/src/test/ui/numeric-fields.stderr @@ -0,0 +1,16 @@ +error[E0560]: struct `S` has no field named `0b1` + --> $DIR/numeric-fields.rs:14:15 + | +14 | let s = S{0b1: 10, 0: 11}; + | ^^^^ `S` does not have this field + | + = note: available fields are: `0`, `1` + +error[E0026]: struct `S` does not have a field named `0x1` + --> $DIR/numeric-fields.rs:17:17 + | +17 | S{0: a, 0x1: b, ..} => {} + | ^^^^^^ struct `S` does not have field `0x1` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/object-safety-associated-consts.rs b/src/test/ui/object-safety-associated-consts.rs similarity index 84% rename from src/test/compile-fail/object-safety-associated-consts.rs rename to src/test/ui/object-safety-associated-consts.rs index ebb52face06ac..4bce2c5982a12 100644 --- a/src/test/compile-fail/object-safety-associated-consts.rs +++ b/src/test/ui/object-safety-associated-consts.rs @@ -18,8 +18,6 @@ trait Bar { fn make_bar(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE the trait cannot contain associated consts like `X` - //~| NOTE the trait `Bar` cannot be made into an object t } diff --git a/src/test/ui/object-safety-associated-consts.stderr b/src/test/ui/object-safety-associated-consts.stderr new file mode 100644 index 0000000000000..f63ded9a8b108 --- /dev/null +++ b/src/test/ui/object-safety-associated-consts.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-associated-consts.rs:19:1 + | +19 | fn make_bar(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: the trait cannot contain associated consts like `X` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/object-safety-generics.rs b/src/test/ui/object-safety-generics.rs similarity index 80% rename from src/test/compile-fail/object-safety-generics.rs rename to src/test/ui/object-safety-generics.rs index 6174d45b898d6..969ceeec276f1 100644 --- a/src/test/compile-fail/object-safety-generics.rs +++ b/src/test/ui/object-safety-generics.rs @@ -23,15 +23,11 @@ trait Quux { fn make_bar(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE method `bar` has generic type parameters - //~| NOTE the trait `Bar` cannot be made into an object t } fn make_bar_explicit(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE method `bar` has generic type parameters - //~| NOTE the trait `Bar` cannot be made into an object t as &Bar } diff --git a/src/test/ui/object-safety-generics.stderr b/src/test/ui/object-safety-generics.stderr new file mode 100644 index 0000000000000..7bc714163c7fa --- /dev/null +++ b/src/test/ui/object-safety-generics.stderr @@ -0,0 +1,18 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:24:1 + | +24 | fn make_bar(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: method `bar` has generic type parameters + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:29:1 + | +29 | fn make_bar_explicit(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: method `bar` has generic type parameters + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/object-safety-mentions-Self.rs b/src/test/ui/object-safety-mentions-Self.rs similarity index 77% rename from src/test/compile-fail/object-safety-mentions-Self.rs rename to src/test/ui/object-safety-mentions-Self.rs index d85614fa5b538..0f59a928feff8 100644 --- a/src/test/compile-fail/object-safety-mentions-Self.rs +++ b/src/test/ui/object-safety-mentions-Self.rs @@ -26,15 +26,11 @@ trait Quux { fn make_bar(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE method `bar` references the `Self` type in its arguments or return type - //~| NOTE the trait `Bar` cannot be made into an object loop { } } fn make_baz(t: &T) -> &Baz { //~^ ERROR E0038 - //~| NOTE method `bar` references the `Self` type in its arguments or return type - //~| NOTE the trait `Baz` cannot be made into an object t } diff --git a/src/test/ui/object-safety-mentions-Self.stderr b/src/test/ui/object-safety-mentions-Self.stderr new file mode 100644 index 0000000000000..8ed8dcc803154 --- /dev/null +++ b/src/test/ui/object-safety-mentions-Self.stderr @@ -0,0 +1,18 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-mentions-Self.rs:27:1 + | +27 | fn make_bar(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: method `bar` references the `Self` type in its arguments or return type + +error[E0038]: the trait `Baz` cannot be made into an object + --> $DIR/object-safety-mentions-Self.rs:32:1 + | +32 | fn make_baz(t: &T) -> &Baz { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object + | + = note: method `bar` references the `Self` type in its arguments or return type + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/object-safety-sized.rs b/src/test/ui/object-safety-sized.rs similarity index 84% rename from src/test/compile-fail/object-safety-sized.rs rename to src/test/ui/object-safety-sized.rs index accd7fa87ac29..7c58609c7e91f 100644 --- a/src/test/compile-fail/object-safety-sized.rs +++ b/src/test/ui/object-safety-sized.rs @@ -17,8 +17,6 @@ trait Bar : Sized { fn make_bar(t: &T) -> &Bar { //~^ ERROR E0038 - //~| NOTE the trait cannot require that `Self : Sized` - //~| NOTE the trait `Bar` cannot be made into an object t } diff --git a/src/test/ui/object-safety-sized.stderr b/src/test/ui/object-safety-sized.stderr new file mode 100644 index 0000000000000..a733416ef6ccf --- /dev/null +++ b/src/test/ui/object-safety-sized.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-sized.rs:18:1 + | +18 | fn make_bar(t: &T) -> &Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object + | + = note: the trait cannot require that `Self : Sized` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs b/src/test/ui/object-safety-supertrait-mentions-Self.rs similarity index 83% rename from src/test/compile-fail/object-safety-supertrait-mentions-Self.rs rename to src/test/ui/object-safety-supertrait-mentions-Self.rs index a93c056c410c6..53b4fc2de9e18 100644 --- a/src/test/compile-fail/object-safety-supertrait-mentions-Self.rs +++ b/src/test/ui/object-safety-supertrait-mentions-Self.rs @@ -24,8 +24,6 @@ fn make_bar>(t: &T) -> &Bar { fn make_baz(t: &T) -> &Baz { //~^ ERROR E0038 - //~| NOTE the trait cannot use `Self` as a type parameter in the supertraits or where-clauses - //~| NOTE the trait `Baz` cannot be made into an object t } diff --git a/src/test/ui/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety-supertrait-mentions-Self.stderr new file mode 100644 index 0000000000000..a5a67553c6154 --- /dev/null +++ b/src/test/ui/object-safety-supertrait-mentions-Self.stderr @@ -0,0 +1,10 @@ +error[E0038]: the trait `Baz` cannot be made into an object + --> $DIR/object-safety-supertrait-mentions-Self.rs:25:31 + | +25 | fn make_baz(t: &T) -> &Baz { + | ^^^ the trait `Baz` cannot be made into an object + | + = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses + +error: aborting due to previous error + diff --git a/src/test/ui/on-unimplemented/multiple-impls.rs b/src/test/ui/on-unimplemented/multiple-impls.rs index 15375936b898c..539f5d63c0b3b 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.rs +++ b/src/test/ui/on-unimplemented/multiple-impls.rs @@ -42,20 +42,11 @@ impl Index> for [i32] { fn main() { Index::index(&[] as &[i32], 2u32); //~^ ERROR E0277 - //~| NOTE trait message - //~| NOTE required by //~| ERROR E0277 - //~| NOTE trait message Index::index(&[] as &[i32], Foo(2u32)); //~^ ERROR E0277 - //~| NOTE on impl for Foo - //~| NOTE required by //~| ERROR E0277 - //~| NOTE on impl for Foo Index::index(&[] as &[i32], Bar(2u32)); //~^ ERROR E0277 - //~| NOTE on impl for Bar - //~| NOTE required by //~| ERROR E0277 - //~| NOTE on impl for Bar } diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index a1fa8b720a829..1f71be446efb5 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -16,35 +16,35 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied = help: the trait `Index` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:49:5 + --> $DIR/multiple-impls.rs:46:5 | -49 | Index::index(&[] as &[i32], Foo(2u32)); +46 | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index>` is not implemented for `[i32]` = note: required by `Index::index` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:49:5 + --> $DIR/multiple-impls.rs:46:5 | -49 | Index::index(&[] as &[i32], Foo(2u32)); +46 | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index>` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:55:5 + --> $DIR/multiple-impls.rs:49:5 | -55 | Index::index(&[] as &[i32], Bar(2u32)); +49 | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` = note: required by `Index::index` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:55:5 + --> $DIR/multiple-impls.rs:49:5 | -55 | Index::index(&[] as &[i32], Bar(2u32)); +49 | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` diff --git a/src/test/ui/on-unimplemented/on-impl.rs b/src/test/ui/on-unimplemented/on-impl.rs index 66d612baab4e8..da56ae6499344 100644 --- a/src/test/ui/on-unimplemented/on-impl.rs +++ b/src/test/ui/on-unimplemented/on-impl.rs @@ -31,8 +31,5 @@ impl Index for [i32] { fn main() { Index::::index(&[1, 2, 3] as &[i32], 2u32); //~^ ERROR E0277 - //~| NOTE a usize is required - //~| NOTE required by //~| ERROR E0277 - //~| NOTE a usize is required } diff --git a/src/test/ui/on-unimplemented/on-trait.rs b/src/test/ui/on-unimplemented/on-trait.rs index ed7ec9b143689..a5eea55eeb9d4 100644 --- a/src/test/ui/on-unimplemented/on-trait.rs +++ b/src/test/ui/on-unimplemented/on-trait.rs @@ -36,10 +36,6 @@ pub fn main() { let x = vec![1u8, 2, 3, 4]; let y: Option> = collect(x.iter()); // this should give approximately the same error for x.iter().collect() //~^ ERROR - //~^^ NOTE a collection of type `std::option::Option>` cannot be built from an iterator over elements of type `&u8` - //~^^^ NOTE required by `collect` let x: String = foobar(); //~ ERROR - //~^ NOTE test error `std::string::String` with `u8` `_` `u32` - //~^^ NOTE required by `foobar` } diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 84986c1ecfdd3..cde56022faea2 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -8,9 +8,9 @@ error[E0277]: the trait bound `std::option::Option>: MyFromIte = note: required by `collect` error[E0277]: the trait bound `std::string::String: Bar::Foo` is not satisfied - --> $DIR/on-trait.rs:42:21 + --> $DIR/on-trait.rs:40:21 | -42 | let x: String = foobar(); //~ ERROR +40 | let x: String = foobar(); //~ ERROR | ^^^^^^ test error `std::string::String` with `u8` `_` `u32` in `Bar::Foo` | = help: the trait `Bar::Foo` is not implemented for `std::string::String` diff --git a/src/test/ui/on-unimplemented/slice-index.rs b/src/test/ui/on-unimplemented/slice-index.rs index 5d30c2e982ef7..7d67e89a78e36 100644 --- a/src/test/ui/on-unimplemented/slice-index.rs +++ b/src/test/ui/on-unimplemented/slice-index.rs @@ -19,9 +19,5 @@ use std::ops::Index; fn main() { let x = &[1, 2, 3] as &[i32]; x[1i32]; //~ ERROR E0277 - //~| NOTE slice indices are of type `usize` or ranges of `usize` - //~| NOTE required because of the requirements on the impl of `std::ops::Index` x[..1i32]; //~ ERROR E0277 - //~| NOTE slice indices are of type `usize` or ranges of `usize` - //~| NOTE requirements on the impl of `std::ops::Index>` } diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index 68789f77f750c..a1ecbce770a08 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -8,9 +8,9 @@ error[E0277]: the trait bound `i32: std::slice::SliceIndex<[i32]>` is not satisf = note: required because of the requirements on the impl of `std::ops::Index` for `[i32]` error[E0277]: the trait bound `std::ops::RangeTo: std::slice::SliceIndex<[i32]>` is not satisfied - --> $DIR/slice-index.rs:24:5 + --> $DIR/slice-index.rs:22:5 | -24 | x[..1i32]; //~ ERROR E0277 +22 | x[..1i32]; //~ ERROR E0277 | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `std::ops::RangeTo` diff --git a/src/test/compile-fail/partialeq_help.rs b/src/test/ui/partialeq_help.rs similarity index 72% rename from src/test/compile-fail/partialeq_help.rs rename to src/test/ui/partialeq_help.rs index 52c24473bd3cb..ee6d632d1a3ee 100644 --- a/src/test/compile-fail/partialeq_help.rs +++ b/src/test/ui/partialeq_help.rs @@ -10,9 +10,6 @@ fn foo(a: &T, b: T) { a == b; //~ ERROR E0277 - //~| NOTE can't compare `&T` with `T` - //~| HELP the trait `std::cmp::PartialEq` is not implemented for `&T` - //~| HELP consider adding a `where &T: std::cmp::PartialEq` bound } fn main() { diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr new file mode 100644 index 0000000000000..25ae8b1276815 --- /dev/null +++ b/src/test/ui/partialeq_help.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `&T: std::cmp::PartialEq` is not satisfied + --> $DIR/partialeq_help.rs:12:7 + | +12 | a == b; //~ ERROR E0277 + | ^^ can't compare `&T` with `T` + | + = help: the trait `std::cmp::PartialEq` is not implemented for `&T` + = help: consider adding a `where &T: std::cmp::PartialEq` bound + +error: aborting due to previous error + diff --git a/src/test/compile-fail/pat-slice-old-style.rs b/src/test/ui/pat-slice-old-style.rs similarity index 86% rename from src/test/compile-fail/pat-slice-old-style.rs rename to src/test/ui/pat-slice-old-style.rs index d49ce56ccf6e7..4ff1e94b08721 100644 --- a/src/test/compile-fail/pat-slice-old-style.rs +++ b/src/test/ui/pat-slice-old-style.rs @@ -18,8 +18,6 @@ fn slice_pat(x: &[u8]) { match x { [a, b..] => {}, //~^ ERROR non-reference pattern used to match a reference - //~| HELP add #![feature(match_default_bindings)] to the crate attributes to enable - //~| HELP consider using _ => panic!(), } } diff --git a/src/test/ui/pat-slice-old-style.stderr b/src/test/ui/pat-slice-old-style.stderr new file mode 100644 index 0000000000000..5e7cd10235d4d --- /dev/null +++ b/src/test/ui/pat-slice-old-style.stderr @@ -0,0 +1,10 @@ +error: non-reference pattern used to match a reference (see issue #42640) + --> $DIR/pat-slice-old-style.rs:19:9 + | +19 | [a, b..] => {}, + | ^^^^^^^^ help: consider using a reference: `&[a, b..]` + | + = help: add #![feature(match_default_bindings)] to the crate attributes to enable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/qualified-path-params-2.rs b/src/test/ui/qualified-path-params-2.rs similarity index 84% rename from src/test/compile-fail/qualified-path-params-2.rs rename to src/test/ui/qualified-path-params-2.rs index e685ebc272098..b0dd1f2518c89 100644 --- a/src/test/compile-fail/qualified-path-params-2.rs +++ b/src/test/ui/qualified-path-params-2.rs @@ -27,9 +27,6 @@ impl S { 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/ui/qualified-path-params-2.stderr b/src/test/ui/qualified-path-params-2.stderr new file mode 100644 index 0000000000000..35a9698451f1b --- /dev/null +++ b/src/test/ui/qualified-path-params-2.stderr @@ -0,0 +1,16 @@ +error[E0109]: type parameters are not allowed on this type + --> $DIR/qualified-path-params-2.rs:28:26 + | +28 | type A = ::A::f; + | ^^ type parameter not allowed + +error[E0223]: ambiguous associated type + --> $DIR/qualified-path-params-2.rs:28:10 + | +28 | type A = ::A::f; + | ^^^^^^^^^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `<::A as Trait>::f` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs b/src/test/ui/region-borrow-params-issue-29793-small.rs similarity index 73% rename from src/test/compile-fail/region-borrow-params-issue-29793-small.rs rename to src/test/ui/region-borrow-params-issue-29793-small.rs index 18206a68515fe..4fda8ec3f384e 100644 --- a/src/test/compile-fail/region-borrow-params-issue-29793-small.rs +++ b/src/test/ui/region-borrow-params-issue-29793-small.rs @@ -19,16 +19,8 @@ fn escaping_borrow_of_closure_params_1() { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR `x` does not live long enough //~| ERROR `y` does not live long enough - //~| NOTE capture occurs here - //~| NOTE capture occurs here - //~| NOTE does not live long enough - //~| NOTE does not live long enough - //~| NOTE values in a scope are dropped in the opposite order they are created - //~| NOTE values in a scope are dropped in the opposite order they are created return f; }; - //~^ NOTE borrowed value dropped before borrower - //~| NOTE borrowed value dropped before borrower // We delberately do not call `g`; this small version of the test, // after adding such a call, was (properly) rejected even when the @@ -42,16 +34,8 @@ fn escaping_borrow_of_closure_params_2() { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR `x` does not live long enough //~| ERROR `y` does not live long enough - //~| NOTE capture occurs here - //~| NOTE capture occurs here - //~| NOTE does not live long enough - //~| NOTE does not live long enough - //~| NOTE values in a scope are dropped in the opposite order they are created - //~| NOTE values in a scope are dropped in the opposite order they are created f }; - //~^ NOTE borrowed value dropped before borrower - //~| NOTE borrowed value dropped before borrower // (we don't call `g`; see above) } @@ -80,11 +64,7 @@ fn escaping_borrow_of_fn_params_1() { fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); }; @@ -95,11 +75,7 @@ fn escaping_borrow_of_fn_params_2() { fn g<'a>(x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) }; @@ -123,11 +99,7 @@ fn escaping_borrow_of_method_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -141,11 +113,7 @@ fn escaping_borrow_of_method_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) } } @@ -173,11 +141,7 @@ fn escaping_borrow_of_trait_impl_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -192,11 +156,7 @@ fn escaping_borrow_of_trait_impl_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) } } @@ -224,11 +184,7 @@ fn escaping_borrow_of_trait_default_params_1() { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` return Box::new(f); } } @@ -242,11 +198,7 @@ fn escaping_borrow_of_trait_default_params_2() { fn g<'a>(&self, x: usize, y:usize) -> Box usize + 'a> { let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) //~^ ERROR E0373 - //~| NOTE `x` is borrowed here - //~| NOTE may outlive borrowed value `x` //~| ERROR E0373 - //~| NOTE `y` is borrowed here - //~| NOTE may outlive borrowed value `y` Box::new(f) } } diff --git a/src/test/ui/region-borrow-params-issue-29793-small.stderr b/src/test/ui/region-borrow-params-issue-29793-small.stderr new file mode 100644 index 0000000000000..d640d5c8bd97b --- /dev/null +++ b/src/test/ui/region-borrow-params-issue-29793-small.stderr @@ -0,0 +1,246 @@ +error[E0597]: `x` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:19:34 + | +19 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ does not live long enough + | | + | capture occurs here +... +23 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0597]: `y` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:19:45 + | +19 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ does not live long enough + | | + | capture occurs here +... +23 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0597]: `x` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:34:34 + | +34 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ does not live long enough + | | + | capture occurs here +... +38 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0597]: `y` does not live long enough + --> $DIR/region-borrow-params-issue-29793-small.rs:34:45 + | +34 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | --------- ^ does not live long enough + | | + | capture occurs here +... +38 | }; + | - borrowed value dropped before borrower + | + = note: values in a scope are dropped in the opposite order they are created + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + | +65 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +65 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + | +65 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +65 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + | +76 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +76 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + | +76 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +76 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + | +100 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +100 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + | +100 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +100 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + | +114 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +114 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + | +114 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +114 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + | +142 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +142 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + | +142 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +142 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + | +157 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +157 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + | +157 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +157 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + | +185 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +185 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + | +185 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +185 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + | +199 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `x` is borrowed here + | | + | may outlive borrowed value `x` +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +199 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + | +199 | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^ - `y` is borrowed here + | | + | may outlive borrowed value `y` +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +199 | let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) + | ^^^^^^^^^^^^^^ + +error: aborting due to 20 previous errors + diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/ui/regions-nested-fns-2.rs similarity index 87% rename from src/test/compile-fail/regions-nested-fns-2.rs rename to src/test/ui/regions-nested-fns-2.rs index 40ba34b26ede6..e66b62b6fb16e 100644 --- a/src/test/compile-fail/regions-nested-fns-2.rs +++ b/src/test/ui/regions-nested-fns-2.rs @@ -15,9 +15,7 @@ fn nested() { ignore( |z| { //~^ ERROR E0373 - //~| NOTE may outlive borrowed value `y` if false { &y } else { z } - //~^ NOTE `y` is borrowed here }); } diff --git a/src/test/ui/regions-nested-fns-2.stderr b/src/test/ui/regions-nested-fns-2.stderr new file mode 100644 index 0000000000000..5f0bbf6d12b1f --- /dev/null +++ b/src/test/ui/regions-nested-fns-2.stderr @@ -0,0 +1,15 @@ +error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function + --> $DIR/regions-nested-fns-2.rs:16:9 + | +16 | |z| { + | ^^^ may outlive borrowed value `y` +17 | //~^ ERROR E0373 +18 | if false { &y } else { z } + | - `y` is borrowed here +help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword + | +16 | move |z| { + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/ui/resolve-conflict-item-vs-import.rs similarity index 92% rename from src/test/compile-fail/resolve-conflict-item-vs-import.rs rename to src/test/ui/resolve-conflict-item-vs-import.rs index c91657bb46354..4e74ab95d611c 100644 --- a/src/test/compile-fail/resolve-conflict-item-vs-import.rs +++ b/src/test/ui/resolve-conflict-item-vs-import.rs @@ -9,7 +9,6 @@ // except according to those terms. use std::mem::transmute; -//~^ NOTE previous import of the value `transmute` here fn transmute() {} //~^ ERROR the name `transmute` is defined multiple times diff --git a/src/test/ui/resolve-conflict-item-vs-import.stderr b/src/test/ui/resolve-conflict-item-vs-import.stderr new file mode 100644 index 0000000000000..a52dcb37a2fed --- /dev/null +++ b/src/test/ui/resolve-conflict-item-vs-import.stderr @@ -0,0 +1,17 @@ +error[E0255]: the name `transmute` is defined multiple times + --> $DIR/resolve-conflict-item-vs-import.rs:13:1 + | +11 | use std::mem::transmute; + | ------------------- previous import of the value `transmute` here +12 | +13 | fn transmute() {} + | ^^^^^^^^^^^^^^^^^ `transmute` redefined here + | + = note: `transmute` must be defined only once in the value namespace of this module +help: You can use `as` to change the binding name of the import + | +11 | use std::mem::transmute as Othertransmute; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/compile-fail/resolve-inconsistent-names.rs b/src/test/ui/resolve-inconsistent-names.rs similarity index 74% rename from src/test/compile-fail/resolve-inconsistent-names.rs rename to src/test/ui/resolve-inconsistent-names.rs index 7fee5aedb06ed..79d78b4ca59b4 100644 --- a/src/test/compile-fail/resolve-inconsistent-names.rs +++ b/src/test/ui/resolve-inconsistent-names.rs @@ -13,9 +13,5 @@ fn main() { match y { a | b => {} //~ ERROR variable `a` is not bound in all patterns //~^ ERROR variable `b` is not bound in all patterns - //~| NOTE pattern doesn't bind `a` - //~| NOTE pattern doesn't bind `b` - //~| NOTE variable not in all patterns - //~| NOTE variable not in all patterns } } diff --git a/src/test/ui/resolve-inconsistent-names.stderr b/src/test/ui/resolve-inconsistent-names.stderr new file mode 100644 index 0000000000000..8ae5a6b8a820f --- /dev/null +++ b/src/test/ui/resolve-inconsistent-names.stderr @@ -0,0 +1,18 @@ +error[E0408]: variable `a` is not bound in all patterns + --> $DIR/resolve-inconsistent-names.rs:14:12 + | +14 | a | b => {} //~ ERROR variable `a` is not bound in all patterns + | - ^ pattern doesn't bind `a` + | | + | variable not in all patterns + +error[E0408]: variable `b` is not bound in all patterns + --> $DIR/resolve-inconsistent-names.rs:14:8 + | +14 | a | b => {} //~ ERROR variable `a` is not bound in all patterns + | ^ - variable not in all patterns + | | + | pattern doesn't bind `b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/resolve/issue-14254.rs b/src/test/ui/resolve/issue-14254.rs index 38444f69628d1..896085329ab94 100644 --- a/src/test/ui/resolve/issue-14254.rs +++ b/src/test/ui/resolve/issue-14254.rs @@ -30,7 +30,6 @@ impl Foo for *const BarTy { //~^ ERROR cannot find function `baz` a; //~^ ERROR cannot find value `a` - //~| NOTE not found in this scope } } @@ -44,12 +43,10 @@ impl<'a> Foo for &'a BarTy { //~^ ERROR cannot find value `y` a; //~^ ERROR cannot find value `a` - //~| NOTE not found in this scope bah; //~^ ERROR cannot find value `bah` b; //~^ ERROR cannot find value `b` - //~| NOTE not found in this scope } } @@ -63,12 +60,10 @@ impl<'a> Foo for &'a mut BarTy { //~^ ERROR cannot find value `y` a; //~^ ERROR cannot find value `a` - //~| NOTE not found in this scope bah; //~^ ERROR cannot find value `bah` b; //~^ ERROR cannot find value `b` - //~| NOTE not found in this scope } } diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr index a472fc861eb65..1bb5a4cab4951 100644 --- a/src/test/ui/resolve/issue-14254.stderr +++ b/src/test/ui/resolve/issue-14254.stderr @@ -11,135 +11,135 @@ error[E0425]: cannot find value `a` in this scope | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:39:9 + --> $DIR/issue-14254.rs:38:9 | -39 | baz(); +38 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-14254.rs:41:9 + --> $DIR/issue-14254.rs:40:9 | -41 | x; +40 | x; | ^ help: try: `self.x` error[E0425]: cannot find value `y` in this scope - --> $DIR/issue-14254.rs:43:9 + --> $DIR/issue-14254.rs:42:9 | -43 | y; +42 | y; | ^ help: try: `self.y` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:45:9 + --> $DIR/issue-14254.rs:44:9 | -45 | a; +44 | a; | ^ not found in this scope error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:48:9 + --> $DIR/issue-14254.rs:46:9 | -48 | bah; +46 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find value `b` in this scope - --> $DIR/issue-14254.rs:50:9 + --> $DIR/issue-14254.rs:48:9 | -50 | b; +48 | b; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:58:9 + --> $DIR/issue-14254.rs:55:9 | -58 | baz(); +55 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-14254.rs:60:9 + --> $DIR/issue-14254.rs:57:9 | -60 | x; +57 | x; | ^ help: try: `self.x` error[E0425]: cannot find value `y` in this scope - --> $DIR/issue-14254.rs:62:9 + --> $DIR/issue-14254.rs:59:9 | -62 | y; +59 | y; | ^ help: try: `self.y` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:64:9 + --> $DIR/issue-14254.rs:61:9 | -64 | a; +61 | a; | ^ not found in this scope error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:67:9 + --> $DIR/issue-14254.rs:63:9 | -67 | bah; +63 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find value `b` in this scope - --> $DIR/issue-14254.rs:69:9 + --> $DIR/issue-14254.rs:65:9 | -69 | b; +65 | b; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:77:9 + --> $DIR/issue-14254.rs:72:9 | -77 | baz(); +72 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:79:9 + --> $DIR/issue-14254.rs:74:9 | -79 | bah; +74 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:86:9 + --> $DIR/issue-14254.rs:81:9 | -86 | baz(); +81 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:88:9 + --> $DIR/issue-14254.rs:83:9 | -88 | bah; +83 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:95:9 + --> $DIR/issue-14254.rs:90:9 | -95 | baz(); +90 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:97:9 + --> $DIR/issue-14254.rs:92:9 | -97 | bah; +92 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:104:9 - | -104 | baz(); - | ^^^ help: try: `self.baz` + --> $DIR/issue-14254.rs:99:9 + | +99 | baz(); + | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:106:9 + --> $DIR/issue-14254.rs:101:9 | -106 | bah; +101 | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:113:9 + --> $DIR/issue-14254.rs:108:9 | -113 | baz(); +108 | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:115:9 + --> $DIR/issue-14254.rs:110:9 | -115 | bah; +110 | bah; | ^^^ help: try: `Self::bah` error[E0601]: main function not found diff --git a/src/test/ui/resolve/issue-17518.rs b/src/test/ui/resolve/issue-17518.rs index 295880c949988..1efbd1a004fa6 100644 --- a/src/test/ui/resolve/issue-17518.rs +++ b/src/test/ui/resolve/issue-17518.rs @@ -9,7 +9,6 @@ // except according to those terms. enum SomeEnum { -//~^ HELP you can import it into scope E } diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 33f15267e4af4..ffb110d5c3afe 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -1,7 +1,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope - --> $DIR/issue-17518.rs:17:5 + --> $DIR/issue-17518.rs:16:5 | -17 | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` +16 | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-21221-2.rs b/src/test/ui/resolve/issue-21221-2.rs index c0ebc57efb5c2..4ddb4d669fcd2 100644 --- a/src/test/ui/resolve/issue-21221-2.rs +++ b/src/test/ui/resolve/issue-21221-2.rs @@ -9,7 +9,6 @@ // except according to those terms. pub mod foo { -//~^ HELP you can import it into scope pub mod bar { // note: trait T is not public, but being in the current // crate, it's fine to show it, since the programmer can diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index ffe57c5099d68..0ae8052758dac 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `T` in this scope - --> $DIR/issue-21221-2.rs:29:6 + --> $DIR/issue-21221-2.rs:28:6 | -29 | impl T for Foo { } +28 | impl T for Foo { } | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-21221-3.rs b/src/test/ui/resolve/issue-21221-3.rs index 046066b198639..a93330b286524 100644 --- a/src/test/ui/resolve/issue-21221-3.rs +++ b/src/test/ui/resolve/issue-21221-3.rs @@ -16,7 +16,6 @@ extern crate issue_21221_3; struct Foo; -//~^ HELP possible candidate is found in another module // NOTE: This shows only traits accessible from the current // crate, thus the two private entities: diff --git a/src/test/ui/resolve/issue-21221-3.stderr b/src/test/ui/resolve/issue-21221-3.stderr index f134b86441400..b26a8cdacb029 100644 --- a/src/test/ui/resolve/issue-21221-3.stderr +++ b/src/test/ui/resolve/issue-21221-3.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `OuterTrait` in this scope - --> $DIR/issue-21221-3.rs:26:6 + --> $DIR/issue-21221-3.rs:25:6 | -26 | impl OuterTrait for Foo {} +25 | impl OuterTrait for Foo {} | ^^^^^^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-21221-4.rs b/src/test/ui/resolve/issue-21221-4.rs index da8f2c6e778e5..ec6ad2a4829cd 100644 --- a/src/test/ui/resolve/issue-21221-4.rs +++ b/src/test/ui/resolve/issue-21221-4.rs @@ -16,7 +16,6 @@ extern crate issue_21221_4; struct Foo; -//~^ HELP possible candidate is found in another module impl T for Foo {} //~^ ERROR cannot find trait `T` diff --git a/src/test/ui/resolve/issue-21221-4.stderr b/src/test/ui/resolve/issue-21221-4.stderr index 0f3830bc2581d..0a22d8e1fe1ad 100644 --- a/src/test/ui/resolve/issue-21221-4.stderr +++ b/src/test/ui/resolve/issue-21221-4.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `T` in this scope - --> $DIR/issue-21221-4.rs:21:6 + --> $DIR/issue-21221-4.rs:20:6 | -21 | impl T for Foo {} +20 | impl T for Foo {} | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index 9f7b6ff5767c1..f249e0e1127ee 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -14,8 +14,5 @@ pub trait ToNbt { impl ToNbt {} //~^ ERROR unsupported cyclic reference -//~| NOTE cyclic reference -//~| NOTE the cycle begins when processing -//~| NOTE ...which then again requires fn main() {} diff --git a/src/test/ui/resolve/issue-2356.rs b/src/test/ui/resolve/issue-2356.rs index d0490ff981dca..9505e490197b0 100644 --- a/src/test/ui/resolve/issue-2356.rs +++ b/src/test/ui/resolve/issue-2356.rs @@ -26,7 +26,6 @@ impl MaybeDog { // If this provides a suggestion, it's a bug as MaybeDog doesn't impl Groom shave(); //~^ ERROR cannot find function `shave` - //~| NOTE not found in this scope } } @@ -49,12 +48,10 @@ impl Groom for cat { fn shave(other: usize) { whiskers -= other; //~^ ERROR cannot find value `whiskers` - //~| NOTE `self` value is only available in methods with `self` parameter shave(4); //~^ ERROR cannot find function `shave` purr(); //~^ ERROR cannot find function `purr` - //~| NOTE not found in this scope } } @@ -64,16 +61,12 @@ impl cat { fn purr_louder() { static_method(); //~^ ERROR cannot find function `static_method` - //~| NOTE not found in this scope purr(); //~^ ERROR cannot find function `purr` - //~| NOTE not found in this scope purr(); //~^ ERROR cannot find function `purr` - //~| NOTE not found in this scope purr(); //~^ ERROR cannot find function `purr` - //~| NOTE not found in this scope } } @@ -81,7 +74,6 @@ impl cat { fn meow() { if self.whiskers > 3 { //~^ ERROR expected value, found module `self` - //~| NOTE `self` value is only available in methods with `self` parameter println!("MEOW"); } } @@ -89,10 +81,8 @@ impl cat { fn purr(&self) { grow_older(); //~^ ERROR cannot find function `grow_older` - //~| NOTE not found in this scope shave(); //~^ ERROR cannot find function `shave` - //~| NOTE not found in this scope } fn burn_whiskers(&mut self) { @@ -103,15 +93,12 @@ impl cat { pub fn grow_older(other:usize) { whiskers = 4; //~^ ERROR cannot find value `whiskers` - //~| NOTE `self` value is only available in methods with `self` parameter purr_louder(); //~^ ERROR cannot find function `purr_louder` - //~| NOTE not found in this scope } } fn main() { self += 1; //~^ ERROR expected value, found module `self` - //~| NOTE `self` value is only available in methods with `self` parameter } diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr index e98d132b519a3..db68167a57364 100644 --- a/src/test/ui/resolve/issue-2356.stderr +++ b/src/test/ui/resolve/issue-2356.stderr @@ -5,105 +5,105 @@ error[E0425]: cannot find function `shave` in this scope | ^^^^^ not found in this scope error[E0425]: cannot find function `clone` in this scope - --> $DIR/issue-2356.rs:35:5 + --> $DIR/issue-2356.rs:34:5 | -35 | clone(); +34 | clone(); | ^^^^^ help: try: `self.clone` error[E0425]: cannot find function `default` in this scope - --> $DIR/issue-2356.rs:42:5 + --> $DIR/issue-2356.rs:41:5 | -42 | default(); +41 | default(); | ^^^^^^^ help: try: `Self::default` error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:50:5 + --> $DIR/issue-2356.rs:49:5 | -50 | whiskers -= other; +49 | whiskers -= other; | ^^^^^^^^ | | | `self` value is only available in methods with `self` parameter | help: try: `self.whiskers` error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:53:5 + --> $DIR/issue-2356.rs:51:5 | -53 | shave(4); +51 | shave(4); | ^^^^^ help: try: `Self::shave` error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:55:5 + --> $DIR/issue-2356.rs:53:5 | -55 | purr(); +53 | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `static_method` in this scope - --> $DIR/issue-2356.rs:65:9 + --> $DIR/issue-2356.rs:62:9 | -65 | static_method(); +62 | static_method(); | ^^^^^^^^^^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:68:9 + --> $DIR/issue-2356.rs:64:9 | -68 | purr(); +64 | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:71:9 + --> $DIR/issue-2356.rs:66:9 | -71 | purr(); +66 | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:74:9 + --> $DIR/issue-2356.rs:68:9 | -74 | purr(); +68 | purr(); | ^^^^ not found in this scope error[E0424]: expected value, found module `self` - --> $DIR/issue-2356.rs:82:8 + --> $DIR/issue-2356.rs:75:8 | -82 | if self.whiskers > 3 { +75 | if self.whiskers > 3 { | ^^^^ `self` value is only available in methods with `self` parameter error[E0425]: cannot find function `grow_older` in this scope - --> $DIR/issue-2356.rs:90:5 + --> $DIR/issue-2356.rs:82:5 | -90 | grow_older(); +82 | grow_older(); | ^^^^^^^^^^ not found in this scope error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:93:5 + --> $DIR/issue-2356.rs:84:5 | -93 | shave(); +84 | shave(); | ^^^^^ not found in this scope error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:99:5 + --> $DIR/issue-2356.rs:89:5 | -99 | whiskers = 0; +89 | whiskers = 0; | ^^^^^^^^ help: try: `self.whiskers` error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:104:5 - | -104 | whiskers = 4; - | ^^^^^^^^ - | | - | `self` value is only available in methods with `self` parameter - | help: try: `self.whiskers` + --> $DIR/issue-2356.rs:94:5 + | +94 | whiskers = 4; + | ^^^^^^^^ + | | + | `self` value is only available in methods with `self` parameter + | help: try: `self.whiskers` error[E0425]: cannot find function `purr_louder` in this scope - --> $DIR/issue-2356.rs:107:5 - | -107 | purr_louder(); - | ^^^^^^^^^^^ not found in this scope + --> $DIR/issue-2356.rs:96:5 + | +96 | purr_louder(); + | ^^^^^^^^^^^ not found in this scope error[E0424]: expected value, found module `self` - --> $DIR/issue-2356.rs:114:5 + --> $DIR/issue-2356.rs:102:5 | -114 | self += 1; +102 | self += 1; | ^^^^ `self` value is only available in methods with `self` parameter error: aborting due to 17 previous errors diff --git a/src/test/ui/resolve/issue-24968.rs b/src/test/ui/resolve/issue-24968.rs index 6065646401fcb..0bd08f8976483 100644 --- a/src/test/ui/resolve/issue-24968.rs +++ b/src/test/ui/resolve/issue-24968.rs @@ -10,7 +10,6 @@ fn foo(_: Self) { //~^ ERROR cannot find type `Self` -//~| NOTE `Self` is only available in traits and impls } fn main() {} diff --git a/src/test/ui/resolve/issue-39226.rs b/src/test/ui/resolve/issue-39226.rs index f58f7cc3869d2..9d7291c4059d5 100644 --- a/src/test/ui/resolve/issue-39226.rs +++ b/src/test/ui/resolve/issue-39226.rs @@ -19,7 +19,5 @@ fn main() { let s: Something = Something { handle: Handle //~^ ERROR expected value, found struct `Handle` - //~| NOTE did you mean `Handle { /* fields */ }`? - //~| NOTE did you mean `handle` }; } diff --git a/src/test/ui/resolve/issue-5035.rs b/src/test/ui/resolve/issue-5035.rs index 06a753cca8585..e9b50dddd30d1 100644 --- a/src/test/ui/resolve/issue-5035.rs +++ b/src/test/ui/resolve/issue-5035.rs @@ -11,8 +11,6 @@ trait I {} type K = I; impl K for isize {} //~ ERROR expected trait, found type alias `K` - //~| NOTE type aliases cannot be used for traits - //~| NOTE did you mean `I` use ImportError; //~ ERROR unresolved import `ImportError` [E0432] //~^ no `ImportError` in the root diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index c9de39759b5ff..3b37f5d4c83dd 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `ImportError` - --> $DIR/issue-5035.rs:17:5 + --> $DIR/issue-5035.rs:15:5 | -17 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] +15 | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] | ^^^^^^^^^^^ no `ImportError` in the root error[E0404]: expected trait, found type alias `K` diff --git a/src/test/ui/resolve/issue-6702.rs b/src/test/ui/resolve/issue-6702.rs index b391ddf346938..8c5897d1d59cb 100644 --- a/src/test/ui/resolve/issue-6702.rs +++ b/src/test/ui/resolve/issue-6702.rs @@ -15,5 +15,4 @@ struct Monster { fn main() { let _m = Monster(); //~ ERROR expected function, found struct `Monster` - //~^ NOTE did you mean `Monster { /* fields */ }`? } diff --git a/src/test/ui/resolve/privacy-struct-ctor.rs b/src/test/ui/resolve/privacy-struct-ctor.rs index fe3774af47ddb..eb6edae738133 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.rs +++ b/src/test/ui/resolve/privacy-struct-ctor.rs @@ -25,9 +25,6 @@ mod m { n::Z; //~ ERROR tuple struct `Z` is private Z; //~^ ERROR expected value, found struct `Z` - //~| NOTE constructor is not visible here due to private fields - //~| NOTE did you mean `S` - //~| NOTE did you mean `Z { /* fields */ }` } } @@ -37,14 +34,10 @@ fn main() { m::S; //~ ERROR tuple struct `S` is private S; //~^ ERROR expected value, found struct `S` - //~| NOTE constructor is not visible here due to private fields - //~| NOTE did you mean `S { /* fields */ }` m::n::Z; //~ ERROR tuple struct `Z` is private xcrate::m::S; //~ ERROR tuple struct `S` is private xcrate::S; //~^ ERROR expected value, found struct `xcrate::S` - //~| NOTE did you mean `xcrate::S { /* fields */ }` - //~| NOTE constructor is not visible here due to private fields xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private } diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index 81c52a1b7c37d..39bedf59641a8 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -13,29 +13,29 @@ help: possible better candidate is found in another module, you can import it in | error[E0423]: expected value, found struct `S` - --> $DIR/privacy-struct-ctor.rs:38:5 + --> $DIR/privacy-struct-ctor.rs:35:5 | -38 | S; +35 | S; | ^ | | | constructor is not visible here due to private fields | did you mean `S { /* fields */ }`? help: possible better candidate is found in another module, you can import it into scope | -34 | use m::S; +31 | use m::S; | error[E0423]: expected value, found struct `xcrate::S` - --> $DIR/privacy-struct-ctor.rs:45:5 + --> $DIR/privacy-struct-ctor.rs:40:5 | -45 | xcrate::S; +40 | xcrate::S; | ^^^^^^^^^ | | | constructor is not visible here due to private fields | did you mean `xcrate::S { /* fields */ }`? help: possible better candidate is found in another module, you can import it into scope | -34 | use m::S; +31 | use m::S; | error[E0603]: tuple struct `Z` is private @@ -45,27 +45,27 @@ error[E0603]: tuple struct `Z` is private | ^^^^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:37:5 + --> $DIR/privacy-struct-ctor.rs:34:5 | -37 | m::S; //~ ERROR tuple struct `S` is private +34 | m::S; //~ ERROR tuple struct `S` is private | ^^^^ error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:42:5 + --> $DIR/privacy-struct-ctor.rs:37:5 | -42 | m::n::Z; //~ ERROR tuple struct `Z` is private +37 | m::n::Z; //~ ERROR tuple struct `Z` is private | ^^^^^^^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:44:5 + --> $DIR/privacy-struct-ctor.rs:39:5 | -44 | xcrate::m::S; //~ ERROR tuple struct `S` is private +39 | xcrate::m::S; //~ ERROR tuple struct `S` is private | ^^^^^^^^^^^^ error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:49:5 + --> $DIR/privacy-struct-ctor.rs:42:5 | -49 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private +42 | xcrate::m::n::Z; //~ ERROR tuple struct `Z` is private | ^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.rs b/src/test/ui/resolve/resolve-assoc-suggestions.rs index 62d2dc7a8faeb..f3bc8107360d2 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.rs +++ b/src/test/ui/resolve/resolve-assoc-suggestions.rs @@ -25,10 +25,8 @@ impl Tr for S { fn method(&self) { let _: field; //~^ ERROR cannot find type `field` - //~| NOTE not found in this scope let field(..); //~^ ERROR cannot find tuple struct/variant `field` - //~| NOTE not found in this scope field; //~^ ERROR cannot find value `field` @@ -36,17 +34,13 @@ impl Tr for S { //~^ ERROR cannot find type `Type` let Type(..); //~^ ERROR cannot find tuple struct/variant `Type` - //~| NOTE not found in this scope Type; //~^ ERROR cannot find value `Type` - //~| NOTE not found in this scope let _: method; //~^ ERROR cannot find type `method` - //~| NOTE not found in this scope let method(..); //~^ ERROR cannot find tuple struct/variant `method` - //~| NOTE not found in this scope method; //~^ ERROR cannot find value `method` } diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr index 4bb3947a02811..3a6eeda833a7b 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr +++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr @@ -5,51 +5,51 @@ error[E0412]: cannot find type `field` in this scope | ^^^^^ not found in this scope error[E0531]: cannot find tuple struct/variant `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:29:13 + --> $DIR/resolve-assoc-suggestions.rs:28:13 | -29 | let field(..); +28 | let field(..); | ^^^^^ not found in this scope error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:32:9 + --> $DIR/resolve-assoc-suggestions.rs:30:9 | -32 | field; +30 | field; | ^^^^^ help: try: `self.field` error[E0412]: cannot find type `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:35:16 + --> $DIR/resolve-assoc-suggestions.rs:33:16 | -35 | let _: Type; +33 | let _: Type; | ^^^^ help: try: `Self::Type` error[E0531]: cannot find tuple struct/variant `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:37:13 + --> $DIR/resolve-assoc-suggestions.rs:35:13 | -37 | let Type(..); +35 | let Type(..); | ^^^^ not found in this scope error[E0425]: cannot find value `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:40:9 + --> $DIR/resolve-assoc-suggestions.rs:37:9 | -40 | Type; +37 | Type; | ^^^^ not found in this scope error[E0412]: cannot find type `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:44:16 + --> $DIR/resolve-assoc-suggestions.rs:40:16 | -44 | let _: method; +40 | let _: method; | ^^^^^^ not found in this scope error[E0531]: cannot find tuple struct/variant `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:47:13 + --> $DIR/resolve-assoc-suggestions.rs:42:13 | -47 | let method(..); +42 | let method(..); | ^^^^^^ not found in this scope error[E0425]: cannot find value `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:50:9 + --> $DIR/resolve-assoc-suggestions.rs:44:9 | -50 | method; +44 | method; | ^^^^^^ help: try: `self.method` error: aborting due to 9 previous errors diff --git a/src/test/ui/resolve/resolve-hint-macro.rs b/src/test/ui/resolve/resolve-hint-macro.rs index 72fd9a7937629..cc9f73b871c71 100644 --- a/src/test/ui/resolve/resolve-hint-macro.rs +++ b/src/test/ui/resolve/resolve-hint-macro.rs @@ -11,5 +11,4 @@ fn main() { assert(true); //~^ ERROR expected function, found macro `assert` - //~| NOTE did you mean `assert!(...)`? } diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.rs b/src/test/ui/resolve/resolve-speculative-adjustment.rs index 120237b662df8..fb5ed150bf42a 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.rs +++ b/src/test/ui/resolve/resolve-speculative-adjustment.rs @@ -26,10 +26,8 @@ impl Tr for S { // "did you mean" messages are not printed. field; //~^ ERROR cannot find value `field` - //~| NOTE not found in this scope method(); //~^ ERROR cannot find function `method` - //~| NOTE not found in this scope } field; diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.stderr b/src/test/ui/resolve/resolve-speculative-adjustment.stderr index 2d74e427ea04e..45512b26705d5 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.stderr +++ b/src/test/ui/resolve/resolve-speculative-adjustment.stderr @@ -5,21 +5,21 @@ error[E0425]: cannot find value `field` in this scope | ^^^^^ not found in this scope error[E0425]: cannot find function `method` in this scope - --> $DIR/resolve-speculative-adjustment.rs:30:13 + --> $DIR/resolve-speculative-adjustment.rs:29:13 | -30 | method(); +29 | method(); | ^^^^^^ not found in this scope error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-speculative-adjustment.rs:35:9 + --> $DIR/resolve-speculative-adjustment.rs:33:9 | -35 | field; +33 | field; | ^^^^^ help: try: `self.field` error[E0425]: cannot find function `method` in this scope - --> $DIR/resolve-speculative-adjustment.rs:37:9 + --> $DIR/resolve-speculative-adjustment.rs:35:9 | -37 | method(); +35 | method(); | ^^^^^^ help: try: `self.method` error: aborting due to 4 previous errors diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs index 70d072a388b90..981a853a04056 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs @@ -26,53 +26,42 @@ pub mod a { fn h1() -> i32 { a.I //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::I`? } fn h2() -> i32 { a.g() //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::g(...)`? } fn h3() -> i32 { a.b.J //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::b`? } fn h4() -> i32 { a::b.J //~^ ERROR expected value, found module `a::b` - //~| NOTE did you mean `a::b::J`? - //~| NOTE did you mean `I` } fn h5() { a.b.f(); //~^ ERROR expected value, found module `a` - //~| NOTE did you mean `a::b`? let v = Vec::new(); v.push(a::b); //~^ ERROR expected value, found module `a::b` - //~| NOTE did you mean `I` } fn h6() -> i32 { a::b.f() //~^ ERROR expected value, found module `a::b` - //~| NOTE did you mean `a::b::f(...)`? - //~| NOTE did you mean `I` } fn h7() { a::b //~^ ERROR expected value, found module `a::b` - //~| NOTE did you mean `I` } fn h8() -> i32 { a::b() //~^ ERROR expected function, found module `a::b` - //~| NOTE did you mean `I` } diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index fd5de16bdd1da..861026ade182e 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -7,67 +7,67 @@ error[E0423]: expected value, found module `a` | did you mean `a::I`? error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:33:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5 | -33 | a.g() +32 | a.g() | ^---- | | | did you mean `a::g(...)`? error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:39:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:37:5 | -39 | a.b.J +37 | a.b.J | ^-- | | | did you mean `a::b`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 | -45 | a::b.J +42 | a::b.J | ^^^--- | | | | | did you mean `I`? | did you mean `a::b::J`? error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:52:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:47:5 | -52 | a.b.f(); +47 | a.b.f(); | ^-- | | | did you mean `a::b`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:56:12 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:12 | -56 | v.push(a::b); +50 | v.push(a::b); | ^^^- | | | did you mean `I`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:62:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5 | -62 | a::b.f() +55 | a::b.f() | ^^^----- | | | | | did you mean `I`? | did you mean `a::b::f(...)`? error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:69:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:60:5 | -69 | a::b +60 | a::b | ^^^- | | | did you mean `I`? error[E0423]: expected function, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:75:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5 | -75 | a::b() +65 | a::b() | ^^^- | | | did you mean `I`? diff --git a/src/test/ui/resolve/token-error-correct-2.rs b/src/test/ui/resolve/token-error-correct-2.rs index 121a565b2b1eb..e49374f9ce649 100644 --- a/src/test/ui/resolve/token-error-correct-2.rs +++ b/src/test/ui/resolve/token-error-correct-2.rs @@ -12,8 +12,6 @@ fn main() { if foo { - //~^ NOTE: unclosed delimiter - //~| ERROR: cannot find value `foo` - //~| NOTE: not found in this scope + //~^ ERROR: cannot find value `foo` ) //~ ERROR: incorrect close delimiter: `)` } diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index feb12612e6604..00bd5dba8d994 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -1,7 +1,7 @@ error: incorrect close delimiter: `)` - --> $DIR/token-error-correct-2.rs:18:5 + --> $DIR/token-error-correct-2.rs:16:5 | -18 | ) //~ ERROR: incorrect close delimiter: `)` +16 | ) //~ ERROR: incorrect close delimiter: `)` | ^ | note: unclosed delimiter diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index 746eee9ecd74e..6d216178a752f 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -19,10 +19,7 @@ pub mod raw { callback: F) -> io::Result { if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` - //~^ NOTE: not found in this scope - callback(path.as_ref(); //~ NOTE: unclosed delimiter - //~^ NOTE: expected one of - //~| ERROR expected one of + callback(path.as_ref(); //~ ERROR expected one of fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types //~^ expected (), found enum `std::result::Result` //~| expected type `()` diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index b500a349f6cf6..f2281a24e238e 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,28 +1,28 @@ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct-3.rs:31:9 + --> $DIR/token-error-correct-3.rs:28:9 | -31 | } else { //~ ERROR: incorrect close delimiter: `}` +28 | } else { //~ ERROR: incorrect close delimiter: `}` | ^ | note: unclosed delimiter - --> $DIR/token-error-correct-3.rs:23:21 + --> $DIR/token-error-correct-3.rs:22:21 | -23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter +22 | callback(path.as_ref(); //~ ERROR expected one of | ^ error: expected one of `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:23:35 + --> $DIR/token-error-correct-3.rs:22:35 | -23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter +22 | callback(path.as_ref(); //~ ERROR expected one of | ^ expected one of `,`, `.`, `?`, or an operator here error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - --> $DIR/token-error-correct-3.rs:31:9 + --> $DIR/token-error-correct-3.rs:28:9 | -26 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types +23 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | - expected one of `.`, `;`, `?`, `}`, or an operator here ... -31 | } else { //~ ERROR: incorrect close delimiter: `}` +28 | } else { //~ ERROR: incorrect close delimiter: `}` | ^ unexpected token error[E0425]: cannot find function `is_directory` in this scope @@ -32,9 +32,9 @@ error[E0425]: cannot find function `is_directory` in this scope | ^^^^^^^^^^^^ not found in this scope error[E0308]: mismatched types - --> $DIR/token-error-correct-3.rs:26:13 + --> $DIR/token-error-correct-3.rs:23:13 | -26 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types +23 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found enum `std::result::Result` diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs index 0c7fe0df1c706..f8b5e670b8426 100644 --- a/src/test/ui/resolve/token-error-correct.rs +++ b/src/test/ui/resolve/token-error-correct.rs @@ -12,9 +12,7 @@ fn main() { foo(bar(; - //~^ NOTE: unclosed delimiter - //~| NOTE: unclosed delimiter - //~| ERROR: expected expression, found `;` + //~^ ERROR: expected expression, found `;` } //~^ ERROR: incorrect close delimiter: `}` //~| ERROR: incorrect close delimiter: `}` diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index cad58b30df206..0e396f6254a3b 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -1,7 +1,7 @@ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct.rs:18:1 + --> $DIR/token-error-correct.rs:16:1 | -18 | } +16 | } | ^ | note: unclosed delimiter @@ -11,9 +11,9 @@ note: unclosed delimiter | ^ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct.rs:18:1 + --> $DIR/token-error-correct.rs:16:1 | -18 | } +16 | } | ^ | note: unclosed delimiter @@ -29,9 +29,9 @@ error: expected expression, found `;` | ^ error: expected expression, found `)` - --> $DIR/token-error-correct.rs:18:1 + --> $DIR/token-error-correct.rs:16:1 | -18 | } +16 | } | ^ error: aborting due to 4 previous errors diff --git a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs index ee4c40f2c8d4d..9d5e2e89666a8 100644 --- a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs +++ b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs @@ -10,12 +10,10 @@ fn f isize>(x: F) {} //~^ ERROR cannot find trait `Nonexist` -//~| NOTE not found in this scope type Typedef = isize; fn g isize>(x: F) {} //~^ ERROR expected trait, found type alias `Typedef` -//~| NOTE type aliases cannot be used for traits fn main() {} diff --git a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr index 015dbfc3dc775..eaee35451ec93 100644 --- a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr +++ b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr @@ -5,9 +5,9 @@ error[E0405]: cannot find trait `Nonexist` in this scope | ^^^^^^^^ not found in this scope error[E0404]: expected trait, found type alias `Typedef` - --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:17:8 + --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:16:8 | -17 | fn g isize>(x: F) {} +16 | fn g isize>(x: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^ type aliases cannot be used for traits error: cannot continue compilation due to previous error diff --git a/src/test/ui/resolve/unresolved_static_type_field.rs b/src/test/ui/resolve/unresolved_static_type_field.rs index 711e46b1248b7..9ba39ce08c7e8 100644 --- a/src/test/ui/resolve/unresolved_static_type_field.rs +++ b/src/test/ui/resolve/unresolved_static_type_field.rs @@ -18,7 +18,6 @@ impl Foo { fn bar() { f(cx); //~^ ERROR cannot find value `cx` in this scope - //~| NOTE `self` value is only available in methods with `self` parameter } } diff --git a/src/test/compile-fail/self-impl.rs b/src/test/ui/self-impl.rs similarity index 79% rename from src/test/compile-fail/self-impl.rs rename to src/test/ui/self-impl.rs index 860e69fcaec4d..1494d9ca574ce 100644 --- a/src/test/compile-fail/self-impl.rs +++ b/src/test/ui/self-impl.rs @@ -32,12 +32,8 @@ impl Bar { fn f() { let _: ::Baz = true; //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `::Baz` let _: Self::Baz = true; //~^ ERROR ambiguous associated type - //~| NOTE ambiguous associated type - //~| NOTE specify the type using the syntax `::Baz` } } diff --git a/src/test/ui/self-impl.stderr b/src/test/ui/self-impl.stderr new file mode 100644 index 0000000000000..e1be5c18a6870 --- /dev/null +++ b/src/test/ui/self-impl.stderr @@ -0,0 +1,18 @@ +error[E0223]: ambiguous associated type + --> $DIR/self-impl.rs:33:16 + | +33 | let _: ::Baz = true; + | ^^^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `::Baz` + +error[E0223]: ambiguous associated type + --> $DIR/self-impl.rs:35:16 + | +35 | let _: Self::Baz = true; + | ^^^^^^^^^ ambiguous associated type + | + = note: specify the type using the syntax `::Baz` + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/shadowed-lifetime.rs b/src/test/ui/shadowed-lifetime.rs similarity index 87% rename from src/test/compile-fail/shadowed-lifetime.rs rename to src/test/ui/shadowed-lifetime.rs index 31283623a3ce6..63e4038398d52 100644 --- a/src/test/compile-fail/shadowed-lifetime.rs +++ b/src/test/ui/shadowed-lifetime.rs @@ -13,18 +13,14 @@ struct Foo<'a>(&'a isize); impl<'a> Foo<'a> { - //~^ NOTE first declared here fn shadow_in_method<'a>(&'a self) -> &'a isize { //~^ ERROR lifetime name `'a` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'a already in scope self.0 } fn shadow_in_type<'b>(&'b self) -> &'b isize { - //~^ NOTE first declared here let x: for<'b> fn(&'b isize) = panic!(); //~^ ERROR lifetime name `'b` shadows a lifetime name that is already in scope - //~| NOTE lifetime 'b already in scope self.0 } diff --git a/src/test/ui/shadowed-lifetime.stderr b/src/test/ui/shadowed-lifetime.stderr new file mode 100644 index 0000000000000..8eaa3e595658a --- /dev/null +++ b/src/test/ui/shadowed-lifetime.stderr @@ -0,0 +1,18 @@ +error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope + --> $DIR/shadowed-lifetime.rs:16:25 + | +15 | impl<'a> Foo<'a> { + | -- first declared here +16 | fn shadow_in_method<'a>(&'a self) -> &'a isize { + | ^^ lifetime 'a already in scope + +error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope + --> $DIR/shadowed-lifetime.rs:22:20 + | +21 | fn shadow_in_type<'b>(&'b self) -> &'b isize { + | -- first declared here +22 | let x: for<'b> fn(&'b isize) = panic!(); + | ^^ lifetime 'b already in scope + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/span/E0046.rs b/src/test/ui/span/E0046.rs index 9e757860a857b..53813a4f5864c 100644 --- a/src/test/ui/span/E0046.rs +++ b/src/test/ui/span/E0046.rs @@ -10,14 +10,12 @@ trait Foo { fn foo(); - //~^ NOTE `foo` from trait } struct Bar; impl Foo for Bar {} //~^ ERROR E0046 -//~| NOTE missing `foo` in implementation fn main() { } diff --git a/src/test/ui/span/E0046.stderr b/src/test/ui/span/E0046.stderr index 729a515612463..cd963de441b5f 100644 --- a/src/test/ui/span/E0046.stderr +++ b/src/test/ui/span/E0046.stderr @@ -1,10 +1,10 @@ error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/E0046.rs:18:1 + --> $DIR/E0046.rs:17:1 | 12 | fn foo(); | --------- `foo` from trait ... -18 | impl Foo for Bar {} +17 | impl Foo for Bar {} | ^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs index 1c45771ff8a3c..66673c152d550 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs @@ -21,12 +21,8 @@ struct Test<'a> { fn call(mut f: F) where F: FnMut(Fn) { f(Box::new(|| { //~^ ERROR: cannot borrow `f` as mutable more than once - //~| NOTE first mutable borrow occurs here - //~| NOTE second mutable borrow occurs here f((Box::new(|| {}))) - //~^ NOTE borrow occurs due to use of `f` in closure })); - //~^ NOTE first borrow ends here } fn test1() { @@ -36,10 +32,8 @@ fn test1() { } fn test2(f: &F) where F: FnMut() { - //~^ NOTE use `&mut F` here to make mutable (*f)(); //~^ ERROR cannot borrow immutable borrowed content `*f` as mutable - //~| NOTE cannot borrow as mutable } fn test3(f: &mut F) where F: FnMut() { @@ -47,10 +41,8 @@ fn test3(f: &mut F) where F: FnMut() { } fn test4(f: &Test) { - //~^ NOTE use `&mut Test` here to make mutable f.f.call_mut(()) //~^ ERROR: cannot borrow immutable `Box` content `*f.f` as mutable - //~| NOTE cannot borrow as mutable } fn test5(f: &mut Test) { @@ -67,14 +59,10 @@ fn test6() { fn test7() { fn foo(_: F) where F: FnMut(Box, isize) {} let mut f = |g: Box, b: isize| {}; - //~^ NOTE captured outer variable f(Box::new(|a| { - //~^ NOTE borrow of `f` occurs here foo(f); //~^ ERROR cannot move `f` into closure because it is borrowed //~| ERROR cannot move out of captured outer variable in an `FnMut` closure - //~| NOTE move into closure occurs here - //~| NOTE cannot move out of captured outer variable in an `FnMut` closure }), 3); } diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 0a1429d5509b0..542ee997046f4 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -5,47 +5,43 @@ error[E0499]: cannot borrow `f` as mutable more than once at a time | - ^^ second mutable borrow occurs here | | | first mutable borrow occurs here -... -26 | f((Box::new(|| {}))) +23 | //~^ ERROR: cannot borrow `f` as mutable more than once +24 | f((Box::new(|| {}))) | - borrow occurs due to use of `f` in closure -27 | //~^ NOTE borrow occurs due to use of `f` in closure -28 | })); +25 | })); | - first borrow ends here error[E0596]: cannot borrow immutable borrowed content `*f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:40:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5 | -38 | fn test2(f: &F) where F: FnMut() { +34 | fn test2(f: &F) where F: FnMut() { | -- use `&mut F` here to make mutable -39 | //~^ NOTE use `&mut F` here to make mutable -40 | (*f)(); +35 | (*f)(); | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable `Box` content `*f.f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:51:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5 | -49 | fn test4(f: &Test) { +43 | fn test4(f: &Test) { | ----- use `&mut Test` here to make mutable -50 | //~^ NOTE use `&mut Test` here to make mutable -51 | f.f.call_mut(()) +44 | f.f.call_mut(()) | ^^^ cannot borrow as mutable error[E0504]: cannot move `f` into closure because it is borrowed - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:73:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13 | -71 | f(Box::new(|a| { +62 | f(Box::new(|a| { | - borrow of `f` occurs here -72 | //~^ NOTE borrow of `f` occurs here -73 | foo(f); +63 | foo(f); | ^ move into closure occurs here error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:73:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:63:13 | -69 | let mut f = |g: Box, b: isize| {}; +61 | let mut f = |g: Box, b: isize| {}; | ----- captured outer variable -... -73 | foo(f); +62 | f(Box::new(|a| { +63 | foo(f); | ^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to 5 previous errors diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs index b31ba324b0cda..2bbfd4517b05a 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs @@ -19,15 +19,11 @@ fn f() { let young = ['y']; // statement 3 v2.push(&young[0]); // statement 4 - //~^ NOTE borrow occurs here let mut v3 = Vec::new(); // statement 5 v3.push(&id('x')); // statement 6 //~^ ERROR borrowed value does not live long enough - //~| NOTE temporary value created here - //~| NOTE temporary value dropped here while still borrowed - //~| NOTE consider using a `let` binding to increase its lifetime { @@ -35,28 +31,17 @@ fn f() { v4.push(&id('y')); //~^ ERROR borrowed value does not live long enough - //~| NOTE temporary value created here - //~| NOTE temporary value dropped here while still borrowed - //~| NOTE consider using a `let` binding to increase its lifetime } // (statement 7) - //~^ NOTE temporary value needs to live until here let mut v5 = Vec::new(); // statement 8 v5.push(&id('z')); //~^ ERROR borrowed value does not live long enough - //~| NOTE temporary value created here - //~| NOTE temporary value dropped here while still borrowed - //~| NOTE consider using a `let` binding to increase its lifetime v1.push(&old[0]); } //~^ ERROR `young[..]` does not live long enough -//~| NOTE `young[..]` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created -//~| NOTE temporary value needs to live until here -//~| NOTE temporary value needs to live until here fn main() { f(); diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr index 86c6f28ef1c87..3daeb71d346e1 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr @@ -1,49 +1,49 @@ error[E0597]: `young[..]` does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:54:1 + --> $DIR/borrowck-let-suggestion-suffixes.rs:43:1 | 21 | v2.push(&young[0]); // statement 4 | -------- borrow occurs here ... -54 | } +43 | } | ^ `young[..]` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:26:22 + --> $DIR/borrowck-let-suggestion-suffixes.rs:25:22 | -26 | v3.push(&id('x')); // statement 6 +25 | v3.push(&id('x')); // statement 6 | ------- ^ temporary value dropped here while still borrowed | | | temporary value created here ... -54 | } +43 | } | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:36:26 + --> $DIR/borrowck-let-suggestion-suffixes.rs:32:26 | -36 | v4.push(&id('y')); +32 | v4.push(&id('y')); | ------- ^ temporary value dropped here while still borrowed | | | temporary value created here ... -42 | } // (statement 7) +35 | } // (statement 7) | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:47:22 + --> $DIR/borrowck-let-suggestion-suffixes.rs:39:22 | -47 | v5.push(&id('z')); +39 | v5.push(&id('z')); | ------- ^ temporary value dropped here while still borrowed | | | temporary value created here ... -54 | } +43 | } | - temporary value needs to live until here | = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs index 0a3e18043fe45..95461ee809384 100644 --- a/src/test/ui/span/coerce-suggestions.rs +++ b/src/test/ui/span/coerce-suggestions.rs @@ -16,27 +16,16 @@ fn test2(_x: &mut i32) {} fn main() { let x: usize = String::new(); //~^ ERROR E0308 - //~| NOTE expected usize, found struct `std::string::String` - //~| NOTE expected type `usize` - //~| HELP here are some functions which might fulfill your needs: let x: &str = String::new(); //~^ ERROR E0308 - //~| NOTE expected &str, found struct `std::string::String` - //~| NOTE expected type `&str` - //~| HELP consider borrowing here let y = String::new(); test(&y); //~^ ERROR E0308 - //~| NOTE types differ in mutability - //~| NOTE expected type `&mut std::string::String` test2(&y); //~^ ERROR E0308 - //~| NOTE types differ in mutability - //~| NOTE expected type `&mut i32` let f; f = box f; //~^ ERROR E0308 - //~| NOTE cyclic type of infinite size let s = &mut String::new(); s = format!("foo"); diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 604b38bef6cc4..078526197656c 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -11,9 +11,9 @@ error[E0308]: mismatched types - .len() error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:22:19 + --> $DIR/coerce-suggestions.rs:19:19 | -22 | let x: &str = String::new(); +19 | let x: &str = String::new(); | ^^^^^^^^^^^^^ | | | expected &str, found struct `std::string::String` @@ -23,33 +23,33 @@ error[E0308]: mismatched types found type `std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:28:10 + --> $DIR/coerce-suggestions.rs:22:10 | -28 | test(&y); +22 | test(&y); | ^^ types differ in mutability | = note: expected type `&mut std::string::String` found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:32:11 + --> $DIR/coerce-suggestions.rs:24:11 | -32 | test2(&y); +24 | test2(&y); | ^^ types differ in mutability | = note: expected type `&mut i32` found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:37:9 + --> $DIR/coerce-suggestions.rs:27:9 | -37 | f = box f; +27 | f = box f; | ^^^^^ cyclic type of infinite size error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:42:9 + --> $DIR/coerce-suggestions.rs:31:9 | -42 | s = format!("foo"); +31 | s = format!("foo"); | ^^^^^^^^^^^^^^ | | | expected mutable reference, found struct `std::string::String` diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs index ce9bc17432ef9..aaa5cd415bb01 100644 --- a/src/test/ui/span/dropck-object-cycle.rs +++ b/src/test/ui/span/dropck-object-cycle.rs @@ -35,7 +35,6 @@ impl<'t> MakerTrait for Box+'static> { pub fn main() { let m : Box = make_val(); assert_eq!(object_invoke1(&*m), (4,5)); - //~^ NOTE borrow occurs here // the problem here is that the full type of `m` is // @@ -56,6 +55,4 @@ pub fn main() { // error. } //~^ ERROR `*m` does not live long enough -//~| NOTE `*m` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/dropck-object-cycle.stderr b/src/test/ui/span/dropck-object-cycle.stderr index 49115b244e673..5e87534c3911e 100644 --- a/src/test/ui/span/dropck-object-cycle.stderr +++ b/src/test/ui/span/dropck-object-cycle.stderr @@ -1,10 +1,10 @@ error[E0597]: `*m` does not live long enough - --> $DIR/dropck-object-cycle.rs:57:1 + --> $DIR/dropck-object-cycle.rs:56:1 | 37 | assert_eq!(object_invoke1(&*m), (4,5)); | -- borrow occurs here ... -57 | } +56 | } | ^ `*m` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/impl-wrong-item-for-trait.rs b/src/test/ui/span/impl-wrong-item-for-trait.rs index d4aafabed3791..f86ee2b1377a3 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.rs +++ b/src/test/ui/span/impl-wrong-item-for-trait.rs @@ -13,23 +13,15 @@ use std::fmt::Debug; trait Foo { fn bar(&self); - //~^ NOTE item in trait - //~| NOTE `bar` from trait - //~| NOTE item in trait - //~| NOTE `bar` from trait const MY_CONST: u32; - //~^ NOTE item in trait - //~| NOTE `MY_CONST` from trait } pub struct FooConstForMethod; impl Foo for FooConstForMethod { //~^ ERROR E0046 - //~| NOTE missing `bar` in implementation const bar: u64 = 1; //~^ ERROR E0323 - //~| NOTE does not match trait const MY_CONST: u32 = 1; } @@ -37,22 +29,17 @@ pub struct FooMethodForConst; impl Foo for FooMethodForConst { //~^ ERROR E0046 - //~| NOTE missing `MY_CONST` in implementation fn bar(&self) {} fn MY_CONST() {} //~^ ERROR E0324 - //~| NOTE does not match trait } pub struct FooTypeForMethod; impl Foo for FooTypeForMethod { //~^ ERROR E0046 - //~| NOTE missing `bar` in implementation type bar = u64; //~^ ERROR E0325 - //~| NOTE does not match trait - //~| NOTE not a member //~| ERROR E0437 const MY_CONST: u32 = 1; } @@ -60,7 +47,5 @@ impl Foo for FooTypeForMethod { impl Debug for FooTypeForMethod { } //~^^ ERROR E0046 -//~| NOTE missing `fmt` in implementation -//~| NOTE `fmt` from trait: fn main () {} diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr index dfca435f2a073..92993e192650e 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr @@ -1,86 +1,84 @@ error[E0437]: type `bar` is not a member of trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:52:5 + --> $DIR/impl-wrong-item-for-trait.rs:41:5 | -52 | type bar = u64; +41 | type bar = u64; | ^^^^^^^^^^^^^^^ not a member of trait `Foo` error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:30:5 + --> $DIR/impl-wrong-item-for-trait.rs:23:5 | 15 | fn bar(&self); | -------------- item in trait ... -30 | const bar: u64 = 1; +23 | const bar: u64 = 1; | ^^^^^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:27:1 + --> $DIR/impl-wrong-item-for-trait.rs:21:1 | 15 | fn bar(&self); | -------------- `bar` from trait ... -27 | / impl Foo for FooConstForMethod { -28 | | //~^ ERROR E0046 -29 | | //~| NOTE missing `bar` in implementation -30 | | const bar: u64 = 1; -... | -33 | | const MY_CONST: u32 = 1; -34 | | } +21 | / impl Foo for FooConstForMethod { +22 | | //~^ ERROR E0046 +23 | | const bar: u64 = 1; +24 | | //~^ ERROR E0323 +25 | | const MY_CONST: u32 = 1; +26 | | } | |_^ missing `bar` in implementation error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:42:5 + --> $DIR/impl-wrong-item-for-trait.rs:33:5 | -20 | const MY_CONST: u32; +16 | const MY_CONST: u32; | -------------------- item in trait ... -42 | fn MY_CONST() {} +33 | fn MY_CONST() {} | ^^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `MY_CONST` - --> $DIR/impl-wrong-item-for-trait.rs:38:1 + --> $DIR/impl-wrong-item-for-trait.rs:30:1 | -20 | const MY_CONST: u32; +16 | const MY_CONST: u32; | -------------------- `MY_CONST` from trait ... -38 | / impl Foo for FooMethodForConst { -39 | | //~^ ERROR E0046 -40 | | //~| NOTE missing `MY_CONST` in implementation -41 | | fn bar(&self) {} -... | -44 | | //~| NOTE does not match trait -45 | | } +30 | / impl Foo for FooMethodForConst { +31 | | //~^ ERROR E0046 +32 | | fn bar(&self) {} +33 | | fn MY_CONST() {} +34 | | //~^ ERROR E0324 +35 | | } | |_^ missing `MY_CONST` in implementation error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:52:5 + --> $DIR/impl-wrong-item-for-trait.rs:41:5 | 15 | fn bar(&self); | -------------- item in trait ... -52 | type bar = u64; +41 | type bar = u64; | ^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:49:1 + --> $DIR/impl-wrong-item-for-trait.rs:39:1 | 15 | fn bar(&self); | -------------- `bar` from trait ... -49 | / impl Foo for FooTypeForMethod { -50 | | //~^ ERROR E0046 -51 | | //~| NOTE missing `bar` in implementation -52 | | type bar = u64; -... | -57 | | const MY_CONST: u32 = 1; -58 | | } +39 | / impl Foo for FooTypeForMethod { +40 | | //~^ ERROR E0046 +41 | | type bar = u64; +42 | | //~^ ERROR E0325 +43 | | //~| ERROR E0437 +44 | | const MY_CONST: u32 = 1; +45 | | } | |_^ missing `bar` in implementation error[E0046]: not all trait items implemented, missing: `fmt` - --> $DIR/impl-wrong-item-for-trait.rs:60:1 + --> $DIR/impl-wrong-item-for-trait.rs:47:1 | -60 | / impl Debug for FooTypeForMethod { -61 | | } +47 | / impl Debug for FooTypeForMethod { +48 | | } | |_^ missing `fmt` in implementation | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` diff --git a/src/test/ui/span/issue-23729.rs b/src/test/ui/span/issue-23729.rs index 66134a03baf41..e872fabfc2631 100644 --- a/src/test/ui/span/issue-23729.rs +++ b/src/test/ui/span/issue-23729.rs @@ -19,8 +19,6 @@ fn main() { impl Iterator for Recurrence { //~^ ERROR E0046 - //~| NOTE missing `Item` in implementation - //~| NOTE `Item` from trait: `type Item;` #[inline] fn next(&mut self) -> Option { if self.pos < 2 { diff --git a/src/test/ui/span/issue-23729.stderr b/src/test/ui/span/issue-23729.stderr index d9f4bacce35ae..0124d33635c47 100644 --- a/src/test/ui/span/issue-23729.stderr +++ b/src/test/ui/span/issue-23729.stderr @@ -3,11 +3,11 @@ error[E0046]: not all trait items implemented, missing: `Item` | 20 | / impl Iterator for Recurrence { 21 | | //~^ ERROR E0046 -22 | | //~| NOTE missing `Item` in implementation -23 | | //~| NOTE `Item` from trait: `type Item;` +22 | | #[inline] +23 | | fn next(&mut self) -> Option { ... | -36 | | } -37 | | } +34 | | } +35 | | } | |_________^ missing `Item` in implementation | = note: `Item` from trait: `type Item;` diff --git a/src/test/ui/span/issue-23827.rs b/src/test/ui/span/issue-23827.rs index 01269714c16ca..890f2623ebc1f 100644 --- a/src/test/ui/span/issue-23827.rs +++ b/src/test/ui/span/issue-23827.rs @@ -35,8 +35,6 @@ impl FnMut<(C,)> for Prototype { impl FnOnce<(C,)> for Prototype { //~^ ERROR E0046 - //~| NOTE missing `Output` in implementation - //~| NOTE `Output` from trait: `type Output;` extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype { Fn::call(&self, (comp,)) } diff --git a/src/test/ui/span/issue-23827.stderr b/src/test/ui/span/issue-23827.stderr index 3127af157a62b..acf499e4c8dde 100644 --- a/src/test/ui/span/issue-23827.stderr +++ b/src/test/ui/span/issue-23827.stderr @@ -3,11 +3,10 @@ error[E0046]: not all trait items implemented, missing: `Output` | 36 | / impl FnOnce<(C,)> for Prototype { 37 | | //~^ ERROR E0046 -38 | | //~| NOTE missing `Output` in implementation -39 | | //~| NOTE `Output` from trait: `type Output;` -... | -42 | | } -43 | | } +38 | | extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype { +39 | | Fn::call(&self, (comp,)) +40 | | } +41 | | } | |_^ missing `Output` in implementation | = note: `Output` from trait: `type Output;` diff --git a/src/test/ui/span/issue-24356.rs b/src/test/ui/span/issue-24356.rs index 0997dc802f88b..0580370033a96 100644 --- a/src/test/ui/span/issue-24356.rs +++ b/src/test/ui/span/issue-24356.rs @@ -29,8 +29,6 @@ fn main() { // Causes ICE impl Deref for Thing { //~^ ERROR E0046 - //~| NOTE missing `Target` in implementation - //~| NOTE `Target` from trait: `type Target;` fn deref(&self) -> i8 { self.0 } } diff --git a/src/test/ui/span/issue-24356.stderr b/src/test/ui/span/issue-24356.stderr index 71ab82d98b809..c526a4bc521c4 100644 --- a/src/test/ui/span/issue-24356.stderr +++ b/src/test/ui/span/issue-24356.stderr @@ -3,10 +3,8 @@ error[E0046]: not all trait items implemented, missing: `Target` | 30 | / impl Deref for Thing { 31 | | //~^ ERROR E0046 -32 | | //~| NOTE missing `Target` in implementation -33 | | //~| NOTE `Target` from trait: `type Target;` -34 | | fn deref(&self) -> i8 { self.0 } -35 | | } +32 | | fn deref(&self) -> i8 { self.0 } +33 | | } | |_________^ missing `Target` in implementation | = note: `Target` from trait: `type Target;` diff --git a/src/test/ui/span/issue-36537.rs b/src/test/ui/span/issue-36537.rs index 33182e02fa3c4..d016e8fdbc086 100644 --- a/src/test/ui/span/issue-36537.rs +++ b/src/test/ui/span/issue-36537.rs @@ -11,8 +11,6 @@ fn main() { let p; let a = 42; - p = &a; //~ NOTE borrow occurs here + p = &a; } //~^ ERROR `a` does not live long enough -//~| NOTE `a` dropped here while still borrowed -//~| NOTE values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui/span/issue-36537.stderr b/src/test/ui/span/issue-36537.stderr index 803e476b74932..fed240a850d61 100644 --- a/src/test/ui/span/issue-36537.stderr +++ b/src/test/ui/span/issue-36537.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-36537.rs:15:1 | -14 | p = &a; //~ NOTE borrow occurs here +14 | p = &a; | - borrow occurs here 15 | } | ^ `a` dropped here while still borrowed diff --git a/src/test/ui/span/issue-7575.rs b/src/test/ui/span/issue-7575.rs index f7059e01261a6..b1dbd5b86e77b 100644 --- a/src/test/ui/span/issue-7575.rs +++ b/src/test/ui/span/issue-7575.rs @@ -13,11 +13,11 @@ trait CtxtFn { fn f8(self, _: usize) -> usize; - fn f9(_: usize) -> usize; //~ NOTE candidate + fn f9(_: usize) -> usize; } trait OtherTrait { - fn f9(_: usize) -> usize; //~ NOTE candidate + fn f9(_: usize) -> usize; } // Note: this trait is not implemented, but we can't really tell @@ -26,7 +26,7 @@ trait OtherTrait { // candidate. This seems not unreasonable -- perhaps the user meant to // implement it, after all. trait UnusedTrait { - fn f9(_: usize) -> usize; //~ NOTE candidate + fn f9(_: usize) -> usize; } impl CtxtFn for usize { @@ -45,16 +45,16 @@ impl OtherTrait for usize { } } -struct Myisize(isize); //~ NOTE not found for this +struct Myisize(isize); impl Myisize { - fn fff(i: isize) -> isize { //~ NOTE candidate + fn fff(i: isize) -> isize { i } } trait ManyImplTrait { - fn is_str() -> bool { //~ NOTE candidate + fn is_str() -> bool { false } } @@ -73,10 +73,7 @@ impl ManyImplTrait for Myisize {} fn no_param_bound(u: usize, m: Myisize) -> usize { u.f8(42) + u.f9(342) + m.fff(42) //~^ ERROR no method named `f9` found for type `usize` in the current scope - //~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter - //~| NOTE the following traits define an item //~| ERROR no method named `fff` found for type `Myisize` in the current scope - //~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter } @@ -84,8 +81,6 @@ fn no_param_bound(u: usize, m: Myisize) -> usize { fn param_bound(t: T) -> bool { t.is_str() //~^ ERROR no method named `is_str` found for type `T` in the current scope - //~| NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter - //~| NOTE the following trait defines } fn main() { diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr index a1ed5db69c0db..57c4d25b7d097 100644 --- a/src/test/ui/span/issue-7575.stderr +++ b/src/test/ui/span/issue-7575.stderr @@ -9,19 +9,19 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope note: candidate #1 is defined in the trait `CtxtFn` --> $DIR/issue-7575.rs:16:5 | -16 | fn f9(_: usize) -> usize; //~ NOTE candidate +16 | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `CtxtFn::f9(u, 342)` instead note: candidate #2 is defined in the trait `OtherTrait` --> $DIR/issue-7575.rs:20:5 | -20 | fn f9(_: usize) -> usize; //~ NOTE candidate +20 | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `OtherTrait::f9(u, 342)` instead note: candidate #3 is defined in the trait `UnusedTrait` --> $DIR/issue-7575.rs:29:5 | -29 | fn f9(_: usize) -> usize; //~ NOTE candidate +29 | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `UnusedTrait::f9(u, 342)` instead = help: items from traits can only be used if the trait is implemented and in scope @@ -33,7 +33,7 @@ note: candidate #3 is defined in the trait `UnusedTrait` error[E0599]: no method named `fff` found for type `Myisize` in the current scope --> $DIR/issue-7575.rs:74:30 | -48 | struct Myisize(isize); //~ NOTE not found for this +48 | struct Myisize(isize); | ---------------------- method `fff` not found for this ... 74 | u.f8(42) + u.f9(342) + m.fff(42) @@ -44,15 +44,15 @@ error[E0599]: no method named `fff` found for type `Myisize` in the current scop note: candidate #1 is defined in an impl for the type `Myisize` --> $DIR/issue-7575.rs:51:5 | -51 | / fn fff(i: isize) -> isize { //~ NOTE candidate +51 | / fn fff(i: isize) -> isize { 52 | | i 53 | | } | |_____^ error[E0599]: no method named `is_str` found for type `T` in the current scope - --> $DIR/issue-7575.rs:85:7 + --> $DIR/issue-7575.rs:82:7 | -85 | t.is_str() +82 | t.is_str() | ^^^^^^ | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter @@ -60,7 +60,7 @@ error[E0599]: no method named `is_str` found for type `T` in the current scope note: candidate #1 is defined in the trait `ManyImplTrait` --> $DIR/issue-7575.rs:57:5 | -57 | / fn is_str() -> bool { //~ NOTE candidate +57 | / fn is_str() -> bool { 58 | | false 59 | | } | |_____^ diff --git a/src/test/ui/span/loan-extend.stderr b/src/test/ui/span/loan-extend.stderr index 91bdd8a8caddb..280ddd6581a68 100644 --- a/src/test/ui/span/loan-extend.stderr +++ b/src/test/ui/span/loan-extend.stderr @@ -3,7 +3,7 @@ error[E0597]: `short` does not live long enough | 19 | long = borrow(&mut short); | ----- borrow occurs here -20 | //~^ NOTE borrow occurs here +20 | 21 | } | ^ `short` dropped here while still borrowed | diff --git a/src/test/ui/span/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs index 7c4834751d899..19f580f51b4f5 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.rs +++ b/src/test/ui/span/regions-escape-loop-via-vec.rs @@ -12,19 +12,12 @@ fn broken() { let mut x = 3; let mut _y = vec![&mut x]; - //~^ NOTE borrow of `x` occurs here - //~| NOTE borrow of `x` occurs here - //~| NOTE borrow of `x` occurs here while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed - //~^ NOTE use of borrowed `x` let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed - //~^ NOTE use of borrowed `x` - _y.push(&mut z); //~ NOTE borrow occurs here + _y.push(&mut z); x += 1; //~ ERROR cannot assign - //~^ NOTE assignment to borrowed `x` occurs here - } //~ NOTE `z` dropped here while still borrowed + } //~^ ERROR `z` does not live long enough } -//~^ NOTE borrowed value needs to live until here fn main() { } diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr index a7224fcd4cc8c..13614e3106663 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr @@ -1,40 +1,39 @@ error[E0597]: `z` does not live long enough - --> $DIR/regions-escape-loop-via-vec.rs:25:5 + --> $DIR/regions-escape-loop-via-vec.rs:19:5 | -22 | _y.push(&mut z); //~ NOTE borrow occurs here +17 | _y.push(&mut z); | - borrow occurs here -... -25 | } //~ NOTE `z` dropped here while still borrowed +18 | x += 1; //~ ERROR cannot assign +19 | } | ^ `z` dropped here while still borrowed -26 | //~^ ERROR `z` does not live long enough -27 | } +20 | //~^ ERROR `z` does not live long enough +21 | } | - borrowed value needs to live until here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:18:11 + --> $DIR/regions-escape-loop-via-vec.rs:15:11 | 14 | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -... -18 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +15 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:20:13 + --> $DIR/regions-escape-loop-via-vec.rs:16:13 | 14 | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -... -20 | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +15 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +16 | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed | ^^^^^ use of borrowed `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/regions-escape-loop-via-vec.rs:23:9 + --> $DIR/regions-escape-loop-via-vec.rs:18:9 | 14 | let mut _y = vec![&mut x]; | - borrow of `x` occurs here ... -23 | x += 1; //~ ERROR cannot assign +18 | x += 1; //~ ERROR cannot assign | ^^^^^^ assignment to borrowed `x` occurs here error: aborting due to 4 previous errors diff --git a/src/test/compile-fail/str-concat-on-double-ref.rs b/src/test/ui/str-concat-on-double-ref.rs similarity index 87% rename from src/test/compile-fail/str-concat-on-double-ref.rs rename to src/test/ui/str-concat-on-double-ref.rs index f85422f76d40e..292dcbf8ef777 100644 --- a/src/test/compile-fail/str-concat-on-double-ref.rs +++ b/src/test/ui/str-concat-on-double-ref.rs @@ -13,6 +13,5 @@ fn main() { let b: &str = &"2"; let c = a + b; //~^ ERROR binary operation `+` cannot be applied to type `&std::string::String` - //~| NOTE an implementation of `std::ops::Add` might be missing for `&std::string::String` println!("{:?}", c); } diff --git a/src/test/ui/str-concat-on-double-ref.stderr b/src/test/ui/str-concat-on-double-ref.stderr new file mode 100644 index 0000000000000..15d578133016f --- /dev/null +++ b/src/test/ui/str-concat-on-double-ref.stderr @@ -0,0 +1,10 @@ +error[E0369]: binary operation `+` cannot be applied to type `&std::string::String` + --> $DIR/str-concat-on-double-ref.rs:14:13 + | +14 | let c = a + b; + | ^^^^^ + | + = note: an implementation of `std::ops::Add` might be missing for `&std::string::String` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-decl-dupe.rs b/src/test/ui/struct-fields-decl-dupe.rs similarity index 86% rename from src/test/compile-fail/struct-fields-decl-dupe.rs rename to src/test/ui/struct-fields-decl-dupe.rs index dd9d7d2946882..1f6b070d83723 100644 --- a/src/test/compile-fail/struct-fields-decl-dupe.rs +++ b/src/test/ui/struct-fields-decl-dupe.rs @@ -9,10 +9,9 @@ // except according to those terms. struct BuildData { - foo: isize, //~ NOTE `foo` first declared here + foo: isize, foo: isize, //~^ ERROR field `foo` is already declared [E0124] - //~| NOTE field already declared } fn main() { diff --git a/src/test/ui/struct-fields-decl-dupe.stderr b/src/test/ui/struct-fields-decl-dupe.stderr new file mode 100644 index 0000000000000..8f2180716c904 --- /dev/null +++ b/src/test/ui/struct-fields-decl-dupe.stderr @@ -0,0 +1,10 @@ +error[E0124]: field `foo` is already declared + --> $DIR/struct-fields-decl-dupe.rs:13:5 + | +12 | foo: isize, + | ---------- `foo` first declared here +13 | foo: isize, + | ^^^^^^^^^^ field already declared + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-hints-no-dupe.rs b/src/test/ui/struct-fields-hints-no-dupe.rs similarity index 91% rename from src/test/compile-fail/struct-fields-hints-no-dupe.rs rename to src/test/ui/struct-fields-hints-no-dupe.rs index de78503d9044f..e4366cf79b1cf 100644 --- a/src/test/compile-fail/struct-fields-hints-no-dupe.rs +++ b/src/test/ui/struct-fields-hints-no-dupe.rs @@ -19,7 +19,6 @@ fn main() { foo : 5, bar : 42, //~^ ERROR struct `A` has no field named `bar` - //~| NOTE field does not exist - did you mean `barr`? car : 9, }; } diff --git a/src/test/ui/struct-fields-hints-no-dupe.stderr b/src/test/ui/struct-fields-hints-no-dupe.stderr new file mode 100644 index 0000000000000..93cbe1f5afa80 --- /dev/null +++ b/src/test/ui/struct-fields-hints-no-dupe.stderr @@ -0,0 +1,8 @@ +error[E0560]: struct `A` has no field named `bar` + --> $DIR/struct-fields-hints-no-dupe.rs:20:9 + | +20 | bar : 42, + | ^^^^^ field does not exist - did you mean `barr`? + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-hints.rs b/src/test/ui/struct-fields-hints.rs similarity index 91% rename from src/test/compile-fail/struct-fields-hints.rs rename to src/test/ui/struct-fields-hints.rs index 628f03f3272ca..85dc1aedb445f 100644 --- a/src/test/compile-fail/struct-fields-hints.rs +++ b/src/test/ui/struct-fields-hints.rs @@ -19,6 +19,5 @@ fn main() { foo : 5, bar : 42, //~^ ERROR struct `A` has no field named `bar` - //~| NOTE field does not exist - did you mean `car`? }; } diff --git a/src/test/ui/struct-fields-hints.stderr b/src/test/ui/struct-fields-hints.stderr new file mode 100644 index 0000000000000..a7c77103e7357 --- /dev/null +++ b/src/test/ui/struct-fields-hints.stderr @@ -0,0 +1,8 @@ +error[E0560]: struct `A` has no field named `bar` + --> $DIR/struct-fields-hints.rs:20:9 + | +20 | bar : 42, + | ^^^^^ field does not exist - did you mean `car`? + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-fields-too-many.rs b/src/test/ui/struct-fields-too-many.rs similarity index 86% rename from src/test/compile-fail/struct-fields-too-many.rs rename to src/test/ui/struct-fields-too-many.rs index b1af142ad0fd2..1e0b8efc96fea 100644 --- a/src/test/compile-fail/struct-fields-too-many.rs +++ b/src/test/ui/struct-fields-too-many.rs @@ -17,7 +17,5 @@ fn main() { foo: 0, bar: 0 //~^ ERROR struct `BuildData` has no field named `bar` - //~| NOTE `BuildData` does not have this field - //~| NOTE available fields are: `foo` }; } diff --git a/src/test/ui/struct-fields-too-many.stderr b/src/test/ui/struct-fields-too-many.stderr new file mode 100644 index 0000000000000..ec353d00aa7ee --- /dev/null +++ b/src/test/ui/struct-fields-too-many.stderr @@ -0,0 +1,10 @@ +error[E0560]: struct `BuildData` has no field named `bar` + --> $DIR/struct-fields-too-many.rs:18:9 + | +18 | bar: 0 + | ^^^^ `BuildData` does not have this field + | + = note: available fields are: `foo` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/struct-path-self-type-mismatch.rs b/src/test/ui/struct-path-self-type-mismatch.rs similarity index 67% rename from src/test/compile-fail/struct-path-self-type-mismatch.rs rename to src/test/ui/struct-path-self-type-mismatch.rs index ad568b41fcbf3..e966ea6590254 100644 --- a/src/test/compile-fail/struct-path-self-type-mismatch.rs +++ b/src/test/ui/struct-path-self-type-mismatch.rs @@ -15,20 +15,15 @@ trait Bar { fn bar(); } impl Bar for Foo { fn bar() { Self { inner: 1.5f32 }; //~ ERROR mismatched types - //~^ NOTE expected i32, found f32 } } impl Foo { - fn new(u: U) -> Foo { //~ NOTE expected `Foo` because of return type + fn new(u: U) -> Foo { Self { //~^ ERROR mismatched types - //~| NOTE expected type parameter, found a different type parameter - //~| NOTE expected type `Foo` inner: u //~^ ERROR mismatched types - //~| NOTE expected type parameter, found a different type parameter - //~| NOTE expected type `T` } } } diff --git a/src/test/ui/struct-path-self-type-mismatch.stderr b/src/test/ui/struct-path-self-type-mismatch.stderr new file mode 100644 index 0000000000000..a98ec0ec4b2be --- /dev/null +++ b/src/test/ui/struct-path-self-type-mismatch.stderr @@ -0,0 +1,32 @@ +error[E0308]: mismatched types + --> $DIR/struct-path-self-type-mismatch.rs:17:23 + | +17 | Self { inner: 1.5f32 }; //~ ERROR mismatched types + | ^^^^^^ expected i32, found f32 + +error[E0308]: mismatched types + --> $DIR/struct-path-self-type-mismatch.rs:25:20 + | +25 | inner: u + | ^ expected type parameter, found a different type parameter + | + = note: expected type `T` + found type `U` + +error[E0308]: mismatched types + --> $DIR/struct-path-self-type-mismatch.rs:23:9 + | +22 | fn new(u: U) -> Foo { + | ------ expected `Foo` because of return type +23 | / Self { +24 | | //~^ ERROR mismatched types +25 | | inner: u +26 | | //~^ ERROR mismatched types +27 | | } + | |_________^ expected type parameter, found a different type parameter + | + = note: expected type `Foo` + found type `Foo` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/suggest-private-fields.rs b/src/test/ui/suggest-private-fields.rs similarity index 78% rename from src/test/compile-fail/suggest-private-fields.rs rename to src/test/ui/suggest-private-fields.rs index d0752b5f02f06..77b38abad848a 100644 --- a/src/test/compile-fail/suggest-private-fields.rs +++ b/src/test/ui/suggest-private-fields.rs @@ -24,19 +24,14 @@ fn main () { let k = B { aa: 20, //~^ ERROR struct `xc::B` has no field named `aa` - //~| NOTE field does not exist - did you mean `a`? bb: 20, //~^ ERROR struct `xc::B` has no field named `bb` - //~| NOTE `xc::B` does not have this field - //~| NOTE available fields are: `a` }; // local crate struct let l = A { aa: 20, //~^ ERROR struct `A` has no field named `aa` - //~| NOTE field does not exist - did you mean `a`? bb: 20, //~^ ERROR struct `A` has no field named `bb` - //~| NOTE field does not exist - did you mean `b`? }; } diff --git a/src/test/ui/suggest-private-fields.stderr b/src/test/ui/suggest-private-fields.stderr new file mode 100644 index 0000000000000..d32d85f6e3fd1 --- /dev/null +++ b/src/test/ui/suggest-private-fields.stderr @@ -0,0 +1,28 @@ +error[E0560]: struct `xc::B` has no field named `aa` + --> $DIR/suggest-private-fields.rs:25:9 + | +25 | aa: 20, + | ^^^ field does not exist - did you mean `a`? + +error[E0560]: struct `xc::B` has no field named `bb` + --> $DIR/suggest-private-fields.rs:27:9 + | +27 | bb: 20, + | ^^^ `xc::B` does not have this field + | + = note: available fields are: `a` + +error[E0560]: struct `A` has no field named `aa` + --> $DIR/suggest-private-fields.rs:32:9 + | +32 | aa: 20, + | ^^^ field does not exist - did you mean `a`? + +error[E0560]: struct `A` has no field named `bb` + --> $DIR/suggest-private-fields.rs:34:9 + | +34 | bb: 20, + | ^^^ field does not exist - did you mean `b`? + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs index 6e0f9999ec1d2..ef1566ab56ae8 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Obj where F: FnMut() -> u32 { //~ NOTE not found for this +struct Obj where F: FnMut() -> u32 { closure: F, } @@ -16,6 +16,4 @@ fn main() { let o = Obj { closure: || 42 }; o.closure(); //~^ ERROR no method named `closure` found - //~| HELP use `(o.closure)(...)` if you meant to call the function stored in the `closure` field - //~| NOTE field, not a method } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr index 62dceceedf388..bbe8fe7345aa0 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-18343.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:16:28: 16:33]>` in the current scope --> $DIR/issue-18343.rs:17:7 | -11 | struct Obj where F: FnMut() -> u32 { //~ NOTE not found for this +11 | struct Obj where F: FnMut() -> u32 { | ------------------------------------- method `closure` not found for this ... 17 | o.closure(); diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs index cba0ecbf58ec6..f0c5a2a913f8e 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.rs @@ -13,9 +13,6 @@ use std::boxed::FnBox; struct FuncContainer { -//~^ NOTE not found for this -//~| NOTE not found for this -//~| NOTE not found for this f1: fn(data: u8), f2: extern "C" fn(data: u8), f3: unsafe fn(data: u8), @@ -26,19 +23,11 @@ struct FuncContainerOuter { } struct Obj where F: FnOnce() -> u32 { -//~^ NOTE not found for this -//~| NOTE not found for this -//~| NOTE not found for this -//~| NOTE not found for this -//~| NOTE not found for this -//~| NOTE not found for this closure: F, not_closure: usize, } struct BoxedObj { -//~^ NOTE not found for this -//~| NOTE not found for this boxed_closure: Box u32>, } @@ -59,58 +48,36 @@ fn main() { let o_closure = Obj { closure: || 42, not_closure: 42 }; o_closure.closure(); //~ ERROR no method named `closure` found - //~^ HELP use `(o_closure.closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method o_closure.not_closure(); //~^ ERROR no method named `not_closure` found - //~| NOTE field, not a method - //~| HELP did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`? let o_func = Obj { closure: func, not_closure: 5 }; o_func.closure(); //~ ERROR no method named `closure` found - //~^ HELP use `(o_func.closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method let boxed_fn = BoxedObj { boxed_closure: Box::new(func) }; boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found - //~^ HELP use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box u32> }; boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found - //~^ HELP use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method // test expression writing in the notes let w = Wrapper { wrap: o_func }; w.wrap.closure();//~ ERROR no method named `closure` found - //~^ HELP use `(w.wrap.closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method w.wrap.not_closure(); //~^ ERROR no method named `not_closure` found - //~| NOTE field, not a method - //~| HELP did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`? check_expression().closure();//~ ERROR no method named `closure` found - //~^ HELP use `(check_expression().closure)(...)` if you meant to call the function stored - //~| NOTE field, not a method } impl FuncContainerOuter { fn run(&self) { unsafe { (*self.container).f1(1); //~ ERROR no method named `f1` found - //~^ HELP use `((*self.container).f1)(...)` - //~| NOTE field, not a method (*self.container).f2(1); //~ ERROR no method named `f2` found - //~^ HELP use `((*self.container).f2)(...)` - //~| NOTE field, not a method (*self.container).f3(1); //~ ERROR no method named `f3` found - //~^ HELP use `((*self.container).f3)(...)` - //~| NOTE field, not a method } } } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr index b4086b1602701..083245f0b8e80 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-2392.stderr @@ -1,123 +1,123 @@ -error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:60:36: 60:41]>` in the current scope - --> $DIR/issue-2392.rs:61:15 +error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope + --> $DIR/issue-2392.rs:50:15 | -28 | struct Obj where F: FnOnce() -> u32 { +25 | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -61 | o_closure.closure(); //~ ERROR no method named `closure` found +50 | o_closure.closure(); //~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field -error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:60:36: 60:41]>` in the current scope - --> $DIR/issue-2392.rs:65:15 +error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope + --> $DIR/issue-2392.rs:52:15 | -28 | struct Obj where F: FnOnce() -> u32 { +25 | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `not_closure` not found for this ... -65 | o_closure.not_closure(); +52 | o_closure.not_closure(); | ^^^^^^^^^^^ field, not a method | = help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`? error[E0599]: no method named `closure` found for type `Obj u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:71:12 + --> $DIR/issue-2392.rs:56:12 | -28 | struct Obj where F: FnOnce() -> u32 { +25 | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -71 | o_func.closure(); //~ ERROR no method named `closure` found +56 | o_func.closure(); //~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:76:14 + --> $DIR/issue-2392.rs:59:14 | -39 | struct BoxedObj { +30 | struct BoxedObj { | --------------- method `boxed_closure` not found for this ... -76 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found +59 | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:81:19 + --> $DIR/issue-2392.rs:62:19 | -39 | struct BoxedObj { +30 | struct BoxedObj { | --------------- method `boxed_closure` not found for this ... -81 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found +62 | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field error[E0599]: no method named `closure` found for type `Obj u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:88:12 + --> $DIR/issue-2392.rs:67:12 | -28 | struct Obj where F: FnOnce() -> u32 { +25 | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -88 | w.wrap.closure();//~ ERROR no method named `closure` found +67 | w.wrap.closure();//~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `not_closure` found for type `Obj u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:92:12 + --> $DIR/issue-2392.rs:69:12 | -28 | struct Obj where F: FnOnce() -> u32 { +25 | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `not_closure` not found for this ... -92 | w.wrap.not_closure(); +69 | w.wrap.not_closure(); | ^^^^^^^^^^^ field, not a method | = help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`? error[E0599]: no method named `closure` found for type `Obj + 'static>>` in the current scope - --> $DIR/issue-2392.rs:97:24 + --> $DIR/issue-2392.rs:72:24 | -28 | struct Obj where F: FnOnce() -> u32 { +25 | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -97 | check_expression().closure();//~ ERROR no method named `closure` found +72 | check_expression().closure();//~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:105:31 - | -15 | struct FuncContainer { - | -------------------- method `f1` not found for this + --> $DIR/issue-2392.rs:78:31 + | +15 | struct FuncContainer { + | -------------------- method `f1` not found for this ... -105 | (*self.container).f1(1); //~ ERROR no method named `f1` found - | ^^ field, not a method - | - = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field +78 | (*self.container).f1(1); //~ ERROR no method named `f1` found + | ^^ field, not a method + | + = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:108:31 - | -15 | struct FuncContainer { - | -------------------- method `f2` not found for this + --> $DIR/issue-2392.rs:79:31 + | +15 | struct FuncContainer { + | -------------------- method `f2` not found for this ... -108 | (*self.container).f2(1); //~ ERROR no method named `f2` found - | ^^ field, not a method - | - = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field +79 | (*self.container).f2(1); //~ ERROR no method named `f2` found + | ^^ field, not a method + | + = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:111:31 - | -15 | struct FuncContainer { - | -------------------- method `f3` not found for this + --> $DIR/issue-2392.rs:80:31 + | +15 | struct FuncContainer { + | -------------------- method `f3` not found for this ... -111 | (*self.container).f3(1); //~ ERROR no method named `f3` found - | ^^ field, not a method - | - = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field +80 | (*self.container).f3(1); //~ ERROR no method named `f3` found + | ^^ field, not a method + | + = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field error: aborting due to 11 previous errors diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs index 32d5c7f5e8aef..d306b38e00e3f 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Example { //~ NOTE not found for this +struct Example { example: Box i32> } @@ -21,7 +21,5 @@ fn main() { demo.example(1); //~^ ERROR no method named `example` - //~| HELP use `(demo.example)(...)` - //~| NOTE field, not a method // (demo.example)(1); } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr index 813b6060db072..d6a837a17ae1c 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-32128.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `example` found for type `Example` in the current scope --> $DIR/issue-32128.rs:22:10 | -11 | struct Example { //~ NOTE not found for this +11 | struct Example { | -------------- method `example` not found for this ... 22 | demo.example(1); diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs index 8734985522191..4cd50be50d4a5 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.rs @@ -35,15 +35,9 @@ fn main() { let o = Obj { fn_ptr: empty, closure: || 42 }; let p = &o; p.closure(); //~ ERROR no method named `closure` found - //~^ HELP use `(p.closure)(...)` if you meant to call the function stored in the `closure` field - //~| NOTE field, not a method let q = &p; q.fn_ptr(); //~ ERROR no method named `fn_ptr` found - //~^ HELP use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field - //~| NOTE field, not a method let r = D(C { c_fn_ptr: empty }); let s = &r; s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found - //~^ HELP use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` - //~| NOTE field, not a method } diff --git a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr index d41f7cbdf5658..28e21610214ef 100644 --- a/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr +++ b/src/test/ui/suggestions/confuse-field-and-method/issue-33784.stderr @@ -7,17 +7,17 @@ error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue = help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope - --> $DIR/issue-33784.rs:41:7 + --> $DIR/issue-33784.rs:39:7 | -41 | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found +39 | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found | ^^^^^^ field, not a method | = help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope - --> $DIR/issue-33784.rs:46:7 + --> $DIR/issue-33784.rs:42:7 | -46 | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found +42 | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found | ^^^^^^^^ field, not a method | = help: use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` field diff --git a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs index 72269768e0f5c..0a2e7ef322606 100644 --- a/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs +++ b/src/test/ui/suggestions/dont-suggest-dereference-on-arg.rs @@ -15,7 +15,5 @@ fn main() { x.iter() .filter(|&(ref a, _)| foo(a)) //~^ ERROR non-reference pattern used to match a reference - //~| HELP consider using a reference - //~| HELP add .collect(); } diff --git a/src/test/ui/suggestions/str-array-assignment.rs b/src/test/ui/suggestions/str-array-assignment.rs index 444684507d387..b70028bd926c6 100644 --- a/src/test/ui/suggestions/str-array-assignment.rs +++ b/src/test/ui/suggestions/str-array-assignment.rs @@ -8,25 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() { //~ NOTE expected `()` because of default return type +fn main() { let s = "abc"; let t = if true { s[..2] } else { s }; //~^ ERROR if and else have incompatible types - //~| NOTE expected str, found &str - //~| NOTE expected type let u: &str = if true { s[..2] } else { s }; //~^ ERROR mismatched types - //~| NOTE expected &str, found str - //~| NOTE expected type let v = s[..2]; //~^ ERROR the trait bound `str: std::marker::Sized` is not satisfied - //~| HELP consider borrowing here - //~| NOTE `str` does not have a constant size known at compile-time - //~| HELP the trait `std::marker::Sized` is not implemented for `str` - //~| NOTE all local variables must have a statically known size let w: &str = s[..2]; //~^ ERROR mismatched types - //~| NOTE expected &str, found str - //~| NOTE expected type - //~| HELP consider borrowing here } diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr index c65639805af6c..4ef18e640a755 100644 --- a/src/test/ui/suggestions/str-array-assignment.stderr +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -8,21 +8,21 @@ error[E0308]: if and else have incompatible types found type `&str` error[E0308]: mismatched types - --> $DIR/str-array-assignment.rs:17:27 + --> $DIR/str-array-assignment.rs:15:27 | -11 | fn main() { //~ NOTE expected `()` because of default return type +11 | fn main() { | - expected `()` because of default return type ... -17 | let u: &str = if true { s[..2] } else { s }; +15 | let u: &str = if true { s[..2] } else { s }; | ^^^^^^ expected &str, found str | = note: expected type `&str` found type `str` error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied - --> $DIR/str-array-assignment.rs:21:7 + --> $DIR/str-array-assignment.rs:17:7 | -21 | let v = s[..2]; +17 | let v = s[..2]; | ^ ------ help: consider borrowing here: `&s[..2]` | | | `str` does not have a constant size known at compile-time @@ -31,9 +31,9 @@ error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied = note: all local variables must have a statically known size error[E0308]: mismatched types - --> $DIR/str-array-assignment.rs:27:17 + --> $DIR/str-array-assignment.rs:19:17 | -27 | let w: &str = s[..2]; +19 | let w: &str = s[..2]; | ^^^^^^ | | | expected &str, found str diff --git a/src/test/compile-fail/svh-change-lit.rs b/src/test/ui/svh-change-lit.rs similarity index 88% rename from src/test/compile-fail/svh-change-lit.rs rename to src/test/ui/svh-change-lit.rs index f24a3905cc3c8..c529873e73284 100644 --- a/src/test/compile-fail/svh-change-lit.rs +++ b/src/test/ui/svh-change-lit.rs @@ -14,11 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-lit.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: fn main() { b::foo() diff --git a/src/test/ui/svh-change-lit.stderr b/src/test/ui/svh-change-lit.stderr new file mode 100644 index 0000000000000..94e845c527c6a --- /dev/null +++ b/src/test/ui/svh-change-lit.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-lit.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-significant-cfg.rs b/src/test/ui/svh-change-significant-cfg.rs similarity index 88% rename from src/test/compile-fail/svh-change-significant-cfg.rs rename to src/test/ui/svh-change-significant-cfg.rs index 7a197fc6ae92e..ad51cbc5ec831 100644 --- a/src/test/compile-fail/svh-change-significant-cfg.rs +++ b/src/test/ui/svh-change-significant-cfg.rs @@ -14,11 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-significant-cfg.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: fn main() { b::foo() diff --git a/src/test/ui/svh-change-significant-cfg.stderr b/src/test/ui/svh-change-significant-cfg.stderr new file mode 100644 index 0000000000000..d2744771ec7a3 --- /dev/null +++ b/src/test/ui/svh-change-significant-cfg.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-significant-cfg.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-trait-bound.rs b/src/test/ui/svh-change-trait-bound.rs similarity index 88% rename from src/test/compile-fail/svh-change-trait-bound.rs rename to src/test/ui/svh-change-trait-bound.rs index 560feb960f6f0..ae17ff3feb79d 100644 --- a/src/test/compile-fail/svh-change-trait-bound.rs +++ b/src/test/ui/svh-change-trait-bound.rs @@ -14,11 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-trait-bound.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: fn main() { b::foo() diff --git a/src/test/ui/svh-change-trait-bound.stderr b/src/test/ui/svh-change-trait-bound.stderr new file mode 100644 index 0000000000000..e272f399f797f --- /dev/null +++ b/src/test/ui/svh-change-trait-bound.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-trait-bound.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-type-arg.rs b/src/test/ui/svh-change-type-arg.rs similarity index 88% rename from src/test/compile-fail/svh-change-type-arg.rs rename to src/test/ui/svh-change-type-arg.rs index b8928c09562b6..5b796a3f5c0bf 100644 --- a/src/test/compile-fail/svh-change-type-arg.rs +++ b/src/test/ui/svh-change-type-arg.rs @@ -14,11 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-arg.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: fn main() { b::foo() diff --git a/src/test/ui/svh-change-type-arg.stderr b/src/test/ui/svh-change-type-arg.stderr new file mode 100644 index 0000000000000..d94dd5e522e1d --- /dev/null +++ b/src/test/ui/svh-change-type-arg.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-arg.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-type-ret.rs b/src/test/ui/svh-change-type-ret.rs similarity index 88% rename from src/test/compile-fail/svh-change-type-ret.rs rename to src/test/ui/svh-change-type-ret.rs index 14973baafbd61..88bf146760f9b 100644 --- a/src/test/compile-fail/svh-change-type-ret.rs +++ b/src/test/ui/svh-change-type-ret.rs @@ -14,11 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-ret.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: fn main() { b::foo() diff --git a/src/test/ui/svh-change-type-ret.stderr b/src/test/ui/svh-change-type-ret.stderr new file mode 100644 index 0000000000000..4484faabbf45b --- /dev/null +++ b/src/test/ui/svh-change-type-ret.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-ret.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-change-type-static.rs b/src/test/ui/svh-change-type-static.rs similarity index 88% rename from src/test/compile-fail/svh-change-type-static.rs rename to src/test/ui/svh-change-type-static.rs index cac95b4df8c97..c9a167c5a02cf 100644 --- a/src/test/compile-fail/svh-change-type-static.rs +++ b/src/test/ui/svh-change-type-static.rs @@ -14,11 +14,10 @@ // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-static.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~| NOTE: perhaps that crate needs to be recompiled -//~| NOTE: the following crate versions were found: fn main() { b::foo() diff --git a/src/test/ui/svh-change-type-static.stderr b/src/test/ui/svh-change-type-static.stderr new file mode 100644 index 0000000000000..24c5acbf6f2aa --- /dev/null +++ b/src/test/ui/svh-change-type-static.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `a` which `b` depends on + --> $DIR/svh-change-type-static.rs:20:1 + | +20 | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on + | ^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `a`: $PATH_a + crate `b`: $PATH_b + +error: aborting due to previous error + diff --git a/src/test/compile-fail/svh-use-trait.rs b/src/test/ui/svh-use-trait.rs similarity index 90% rename from src/test/compile-fail/svh-use-trait.rs rename to src/test/ui/svh-use-trait.rs index c875fa8a0b2b9..3a87f6bfc77e4 100644 --- a/src/test/compile-fail/svh-use-trait.rs +++ b/src/test/ui/svh-use-trait.rs @@ -14,6 +14,7 @@ // aux-build:svh-uta-base.rs // aux-build:svh-utb.rs // aux-build:svh-uta-change-use-trait.rs +// normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" //! "compile-fail/svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash @@ -22,8 +23,6 @@ extern crate uta; extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends -//~| NOTE: perhaps that crate needs to be recompiled? -//~| NOTE: the following crate versions were found: fn main() { utb::foo() diff --git a/src/test/ui/svh-use-trait.stderr b/src/test/ui/svh-use-trait.stderr new file mode 100644 index 0000000000000..e695d60e2a127 --- /dev/null +++ b/src/test/ui/svh-use-trait.stderr @@ -0,0 +1,13 @@ +error[E0460]: found possibly newer version of crate `uta` which `utb` depends on + --> $DIR/svh-use-trait.rs:25:1 + | +25 | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends + | ^^^^^^^^^^^^^^^^^ + | + = note: perhaps that crate needs to be recompiled? + = note: the following crate versions were found: + crate `uta`: $PATH_uta + crate `utb`: $PATH_utb + +error: aborting due to previous error + diff --git a/src/test/ui/token/issue-10636-2.rs b/src/test/ui/token/issue-10636-2.rs index c22baee680a02..4aa4127019378 100644 --- a/src/test/ui/token/issue-10636-2.rs +++ b/src/test/ui/token/issue-10636-2.rs @@ -12,9 +12,8 @@ // first one. This would be easy-ish to address by better recovery in tokenisation. pub fn trace_option(option: Option) { - option.map(|some| 42; //~ NOTE: unclosed delimiter + option.map(|some| 42; //~^ ERROR: expected one of - //~| NOTE: expected one of } //~ ERROR: incorrect close delimiter //~^ ERROR: expected expression, found `)` diff --git a/src/test/ui/token/issue-10636-2.stderr b/src/test/ui/token/issue-10636-2.stderr index 48bbeac75d3d1..b4f0f30c6c19f 100644 --- a/src/test/ui/token/issue-10636-2.stderr +++ b/src/test/ui/token/issue-10636-2.stderr @@ -1,25 +1,25 @@ error: incorrect close delimiter: `}` - --> $DIR/issue-10636-2.rs:19:1 + --> $DIR/issue-10636-2.rs:18:1 | -19 | } //~ ERROR: incorrect close delimiter +18 | } //~ ERROR: incorrect close delimiter | ^ | note: unclosed delimiter --> $DIR/issue-10636-2.rs:15:15 | -15 | option.map(|some| 42; //~ NOTE: unclosed delimiter +15 | option.map(|some| 42; | ^ error: expected one of `,`, `.`, `?`, or an operator, found `;` --> $DIR/issue-10636-2.rs:15:25 | -15 | option.map(|some| 42; //~ NOTE: unclosed delimiter +15 | option.map(|some| 42; | ^ expected one of `,`, `.`, `?`, or an operator here error: expected expression, found `)` - --> $DIR/issue-10636-2.rs:19:1 + --> $DIR/issue-10636-2.rs:18:1 | -19 | } //~ ERROR: incorrect close delimiter +18 | } //~ ERROR: incorrect close delimiter | ^ error[E0601]: main function not found diff --git a/src/test/ui/token/macro-incomplete-parse.rs b/src/test/ui/token/macro-incomplete-parse.rs index fd2561ce49653..9b8fdaf9a257e 100644 --- a/src/test/ui/token/macro-incomplete-parse.rs +++ b/src/test/ui/token/macro-incomplete-parse.rs @@ -20,7 +20,6 @@ macro_rules! ignored_item { macro_rules! ignored_expr { () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` - //~^ NOTE expected one of `.`, `;`, `?`, `}`, or an operator here 2 ) } @@ -29,12 +28,12 @@ macro_rules! ignored_pat { () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` } -ignored_item!(); //~ NOTE caused by the macro expansion here +ignored_item!(); fn main() { - ignored_expr!(); //~ NOTE in this expansion + ignored_expr!(); match 1 { - ignored_pat!() => (), //~ NOTE caused by the macro expansion here + ignored_pat!() => (), _ => (), } } diff --git a/src/test/ui/token/macro-incomplete-parse.stderr b/src/test/ui/token/macro-incomplete-parse.stderr index 6bce09af05250..28ba6cc37c3dd 100644 --- a/src/test/ui/token/macro-incomplete-parse.stderr +++ b/src/test/ui/token/macro-incomplete-parse.stderr @@ -5,9 +5,9 @@ error: macro expansion ignores token `,` and any following | ^ | note: caused by the macro expansion here; the usage of `ignored_item!` is likely invalid in item context - --> $DIR/macro-incomplete-parse.rs:32:1 + --> $DIR/macro-incomplete-parse.rs:31:1 | -32 | ignored_item!(); //~ NOTE caused by the macro expansion here +31 | ignored_item!(); | ^^^^^^^^^^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` @@ -16,19 +16,19 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` 22 | () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here ... -35 | ignored_expr!(); //~ NOTE in this expansion +34 | ignored_expr!(); | ---------------- in this macro invocation error: macro expansion ignores token `,` and any following - --> $DIR/macro-incomplete-parse.rs:29:14 + --> $DIR/macro-incomplete-parse.rs:28:14 | -29 | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` +28 | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` | ^ | note: caused by the macro expansion here; the usage of `ignored_pat!` is likely invalid in pattern context - --> $DIR/macro-incomplete-parse.rs:37:9 + --> $DIR/macro-incomplete-parse.rs:36:9 | -37 | ignored_pat!() => (), //~ NOTE caused by the macro expansion here +36 | ignored_pat!() => (), | ^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/compile-fail/trait-duplicate-methods.rs b/src/test/ui/trait-duplicate-methods.rs similarity index 72% rename from src/test/compile-fail/trait-duplicate-methods.rs rename to src/test/ui/trait-duplicate-methods.rs index b8e628dd47ad7..d35caa40a2d77 100644 --- a/src/test/compile-fail/trait-duplicate-methods.rs +++ b/src/test/ui/trait-duplicate-methods.rs @@ -9,10 +9,8 @@ // except according to those terms. trait Foo { - fn orange(&self); //~ NOTE previous definition of the value `orange` here + fn orange(&self); fn orange(&self); //~ ERROR the name `orange` is defined multiple times - //~| NOTE `orange` redefined here -//~| NOTE `orange` must be defined only once in the value namespace of this trait } fn main() {} diff --git a/src/test/ui/trait-duplicate-methods.stderr b/src/test/ui/trait-duplicate-methods.stderr new file mode 100644 index 0000000000000..5f796777c418c --- /dev/null +++ b/src/test/ui/trait-duplicate-methods.stderr @@ -0,0 +1,12 @@ +error[E0428]: the name `orange` is defined multiple times + --> $DIR/trait-duplicate-methods.rs:13:5 + | +12 | fn orange(&self); + | ----------------- previous definition of the value `orange` here +13 | fn orange(&self); //~ ERROR the name `orange` is defined multiple times + | ^^^^^^^^^^^^^^^^^ `orange` redefined here + | + = note: `orange` must be defined only once in the value namespace of this trait + +error: aborting due to previous error + diff --git a/src/test/compile-fail/trait-safety-fn-body.rs b/src/test/ui/trait-safety-fn-body.rs similarity index 94% rename from src/test/compile-fail/trait-safety-fn-body.rs rename to src/test/ui/trait-safety-fn-body.rs index 65732a8ff69e5..1a2bcc471b43a 100644 --- a/src/test/compile-fail/trait-safety-fn-body.rs +++ b/src/test/ui/trait-safety-fn-body.rs @@ -20,7 +20,6 @@ unsafe impl UnsafeTrait for *mut isize { // Unsafe actions are not made legal by taking place in an unsafe trait: *self += 1; //~^ ERROR E0133 - //~| NOTE dereference of raw pointer } } diff --git a/src/test/ui/trait-safety-fn-body.stderr b/src/test/ui/trait-safety-fn-body.stderr new file mode 100644 index 0000000000000..ab8793f8a7403 --- /dev/null +++ b/src/test/ui/trait-safety-fn-body.stderr @@ -0,0 +1,8 @@ +error[E0133]: dereference of raw pointer requires unsafe function or block + --> $DIR/trait-safety-fn-body.rs:21:9 + | +21 | *self += 1; + | ^^^^^^^^^^ dereference of raw pointer + +error: aborting due to previous error + diff --git a/src/test/ui/trait-suggest-where-clause.rs b/src/test/ui/trait-suggest-where-clause.rs new file mode 100644 index 0000000000000..5dcb4c8a220ba --- /dev/null +++ b/src/test/ui/trait-suggest-where-clause.rs @@ -0,0 +1,46 @@ +// Copyright 2016 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +struct Misc(T); + +fn check() { + // suggest a where-clause, if needed + mem::size_of::(); + //~^ ERROR `U: std::marker::Sized` is not satisfied + + mem::size_of::>(); + //~^ ERROR `U: std::marker::Sized` is not satisfied + + // ... even if T occurs as a type parameter + + >::from; + //~^ ERROR `u64: std::convert::From` is not satisfied + + ::Item>>::from; + //~^ ERROR `u64: std::convert::From<::Item>` is not satisfied + + // ... but not if there are inference variables + + as From>::from; + //~^ ERROR `Misc<_>: std::convert::From` is not satisfied + + // ... and also not if the error is not related to the type + + mem::size_of::<[T]>(); + //~^ ERROR `[T]: std::marker::Sized` is not satisfied + + mem::size_of::<[&U]>(); + //~^ ERROR `[&U]: std::marker::Sized` is not satisfied +} + +fn main() { +} diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr new file mode 100644 index 0000000000000..57d2b9aae789f --- /dev/null +++ b/src/test/ui/trait-suggest-where-clause.stderr @@ -0,0 +1,67 @@ +error[E0277]: the trait bound `U: std::marker::Sized` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:17:5 + | +17 | mem::size_of::(); + | ^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `U` + = help: consider adding a `where U: std::marker::Sized` bound + = note: required by `std::mem::size_of` + +error[E0277]: the trait bound `U: std::marker::Sized` is not satisfied in `Misc` + --> $DIR/trait-suggest-where-clause.rs:20:5 + | +20 | mem::size_of::>(); + | ^^^^^^^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time + | + = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` + = help: consider adding a `where U: std::marker::Sized` bound + = note: required because it appears within the type `Misc` + = note: required by `std::mem::size_of` + +error[E0277]: the trait bound `u64: std::convert::From` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:25:5 + | +25 | >::from; + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `u64` + | + = help: consider adding a `where u64: std::convert::From` bound + = note: required by `std::convert::From::from` + +error[E0277]: the trait bound `u64: std::convert::From<::Item>` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:28:5 + | +28 | ::Item>>::from; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<::Item>` is not implemented for `u64` + | + = help: consider adding a `where u64: std::convert::From<::Item>` bound + = note: required by `std::convert::From::from` + +error[E0277]: the trait bound `Misc<_>: std::convert::From` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:33:5 + | +33 | as From>::from; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `Misc<_>` + | + = note: required by `std::convert::From::from` + +error[E0277]: the trait bound `[T]: std::marker::Sized` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:38:5 + | +38 | mem::size_of::<[T]>(); + | ^^^^^^^^^^^^^^^^^^^ `[T]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[T]` + = note: required by `std::mem::size_of` + +error[E0277]: the trait bound `[&U]: std::marker::Sized` is not satisfied + --> $DIR/trait-suggest-where-clause.rs:41:5 + | +41 | mem::size_of::<[&U]>(); + | ^^^^^^^^^^^^^^^^^^^^ `[&U]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[&U]` + = note: required by `std::mem::size_of` + +error: aborting due to 7 previous errors + diff --git a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs b/src/test/ui/traits-multidispatch-convert-ambig-dest.rs similarity index 96% rename from src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs rename to src/test/ui/traits-multidispatch-convert-ambig-dest.rs index 2e115431c92c4..0d4855c544f88 100644 --- a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs +++ b/src/test/ui/traits-multidispatch-convert-ambig-dest.rs @@ -35,7 +35,6 @@ where T : Convert fn a() { test(22, std::default::Default::default()); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `U` } fn main() {} diff --git a/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr new file mode 100644 index 0000000000000..8304fb3b7972a --- /dev/null +++ b/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/traits-multidispatch-convert-ambig-dest.rs:36:5 + | +36 | test(22, std::default::Default::default()); + | ^^^^ cannot infer type for `U` + +error: aborting due to previous error + diff --git a/src/test/ui/transmute/main.rs b/src/test/ui/transmute/main.rs index ab448de656e67..285b079cf96c8 100644 --- a/src/test/ui/transmute/main.rs +++ b/src/test/ui/transmute/main.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// normalize-stderr-32bit: "&str (64 bits)" -> "&str ($STR bits)" -// normalize-stderr-64bit: "&str (128 bits)" -> "&str ($STR bits)" +// normalize-stderr-32bit: "&str \(64 bits\)" -> "&str ($$STR bits)" +// normalize-stderr-64bit: "&str \(128 bits\)" -> "&str ($$STR bits)" diff --git a/src/test/ui/type-check/assignment-in-if.rs b/src/test/ui/type-check/assignment-in-if.rs index e4422f0b99aa4..d4d070ecaefb9 100644 --- a/src/test/ui/type-check/assignment-in-if.rs +++ b/src/test/ui/type-check/assignment-in-if.rs @@ -24,25 +24,21 @@ fn main() { // `x { ... }` should not be interpreted as a struct literal here if x = x { //~^ ERROR mismatched types - //~| HELP try comparing for equality println!("{}", x); } // Explicit parentheses on the left should match behavior of above if (x = x) { //~^ ERROR mismatched types - //~| HELP try comparing for equality println!("{}", x); } // The struct literal interpretation is fine with explicit parentheses on the right if y = (Foo { foo: x }) { //~^ ERROR mismatched types - //~| HELP try comparing for equality println!("{}", x); } // "invalid left-hand side expression" error is suppresed if 3 = x { //~^ ERROR mismatched types - //~| HELP try comparing for equality println!("{}", x); } if (if true { x = 4 } else { x = 5 }) { diff --git a/src/test/ui/type-check/assignment-in-if.stderr b/src/test/ui/type-check/assignment-in-if.stderr index 6052b3091c7bd..fffdca17d843b 100644 --- a/src/test/ui/type-check/assignment-in-if.stderr +++ b/src/test/ui/type-check/assignment-in-if.stderr @@ -11,9 +11,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:31:8 + --> $DIR/assignment-in-if.rs:30:8 | -31 | if (x = x) { +30 | if (x = x) { | ^^^^^^^ | | | expected bool, found () @@ -23,9 +23,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:37:8 + --> $DIR/assignment-in-if.rs:35:8 | -37 | if y = (Foo { foo: x }) { +35 | if y = (Foo { foo: x }) { | ^^^^^^^^^^^^^^^^^^^^ | | | expected bool, found () @@ -35,9 +35,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:43:8 + --> $DIR/assignment-in-if.rs:40:8 | -43 | if 3 = x { +40 | if 3 = x { | ^^^^^ | | | expected bool, found () @@ -47,9 +47,9 @@ error[E0308]: mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:48:8 + --> $DIR/assignment-in-if.rs:44:8 | -48 | if (if true { x = 4 } else { x = 5 }) { +44 | if (if true { x = 4 } else { x = 5 }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found () | = note: expected type `bool` diff --git a/src/test/ui/type-check/missing_trait_impl.rs b/src/test/ui/type-check/missing_trait_impl.rs index fe008db68a004..adf6b85b6429c 100644 --- a/src/test/ui/type-check/missing_trait_impl.rs +++ b/src/test/ui/type-check/missing_trait_impl.rs @@ -13,5 +13,4 @@ fn main() { fn foo(x: T, y: T) { let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T` - //~^ NOTE `T` might need a bound for `std::ops::Add` } diff --git a/src/test/compile-fail/type-recursive.rs b/src/test/ui/type-recursive.rs similarity index 82% rename from src/test/compile-fail/type-recursive.rs rename to src/test/ui/type-recursive.rs index 5dd76ce32c7a4..4bb739800df36 100644 --- a/src/test/compile-fail/type-recursive.rs +++ b/src/test/ui/type-recursive.rs @@ -9,9 +9,8 @@ // except according to those terms. struct t1 { //~ ERROR E0072 - //~| NOTE recursive type has infinite size foo: isize, - foolish: t1 //~ NOTE recursive without indirection + foolish: t1 } fn main() { } diff --git a/src/test/ui/type-recursive.stderr b/src/test/ui/type-recursive.stderr new file mode 100644 index 0000000000000..4c76452979712 --- /dev/null +++ b/src/test/ui/type-recursive.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `t1` has infinite size + --> $DIR/type-recursive.rs:11:1 + | +11 | struct t1 { //~ ERROR E0072 + | ^^^^^^^^^ recursive type has infinite size +12 | foo: isize, +13 | foolish: t1 + | ----------- recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `t1` representable + +error: aborting due to previous error + diff --git a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck-builtin-bound-type-parameters.rs similarity index 82% rename from src/test/compile-fail/typeck-builtin-bound-type-parameters.rs rename to src/test/ui/typeck-builtin-bound-type-parameters.rs index 0d98e044ab04e..15fc3ecab97cb 100644 --- a/src/test/compile-fail/typeck-builtin-bound-type-parameters.rs +++ b/src/test/ui/typeck-builtin-bound-type-parameters.rs @@ -10,26 +10,20 @@ fn foo1, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments trait Trait: Copy {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments struct MyStruct1>; //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments struct MyStruct2<'a, T: Copy<'a>>; //~^ ERROR: wrong number of lifetime parameters: expected 0, found 1 -//~| NOTE unexpected lifetime parameter fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments //~| ERROR: wrong number of lifetime parameters: expected 0, found 1 -//~| NOTE unexpected lifetime parameter fn main() { } diff --git a/src/test/ui/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck-builtin-bound-type-parameters.stderr new file mode 100644 index 0000000000000..cf280bf1cd324 --- /dev/null +++ b/src/test/ui/typeck-builtin-bound-type-parameters.stderr @@ -0,0 +1,38 @@ +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:11:11 + | +11 | fn foo1, U>(x: T) {} + | ^^^^^^^ expected no type arguments + +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:14:14 + | +14 | trait Trait: Copy {} + | ^^^^^^^^^^ expected no type arguments + +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:17:21 + | +17 | struct MyStruct1>; + | ^^^^^^^ expected no type arguments + +error[E0107]: wrong number of lifetime parameters: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:20:25 + | +20 | struct MyStruct2<'a, T: Copy<'a>>; + | ^^^^^^^^ unexpected lifetime parameter + +error[E0107]: wrong number of lifetime parameters: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:24:15 + | +24 | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} + | ^^^^^^^^^^^ unexpected lifetime parameter + +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/typeck-builtin-bound-type-parameters.rs:24:15 + | +24 | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} + | ^^^^^^^^^^^ expected no type arguments + +error: aborting due to 6 previous errors + diff --git a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs b/src/test/ui/typeck-default-trait-impl-outside-crate.rs similarity index 91% rename from src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs rename to src/test/ui/typeck-default-trait-impl-outside-crate.rs index da3e926d6fc1f..ff0446e23e63e 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs +++ b/src/test/ui/typeck-default-trait-impl-outside-crate.rs @@ -12,5 +12,4 @@ #[allow(auto_impl)] impl Copy for .. {} //~ ERROR E0318 - //~^ NOTE `Copy` trait not defined in this crate fn main() {} diff --git a/src/test/ui/typeck-default-trait-impl-outside-crate.stderr b/src/test/ui/typeck-default-trait-impl-outside-crate.stderr new file mode 100644 index 0000000000000..6b50fde01d8a2 --- /dev/null +++ b/src/test/ui/typeck-default-trait-impl-outside-crate.stderr @@ -0,0 +1,8 @@ +error[E0318]: cannot create default implementations for traits outside the crate they're defined in; define a new trait instead + --> $DIR/typeck-default-trait-impl-outside-crate.rs:14:6 + | +14 | impl Copy for .. {} //~ ERROR E0318 + | ^^^^ `Copy` trait not defined in this crate + +error: aborting due to previous error + diff --git a/src/test/compile-fail/typeck_type_placeholder_item.rs b/src/test/ui/typeck_type_placeholder_item.rs similarity index 75% rename from src/test/compile-fail/typeck_type_placeholder_item.rs rename to src/test/ui/typeck_type_placeholder_item.rs index 42db3b47a04f3..d4f3cdfd8b7e2 100644 --- a/src/test/compile-fail/typeck_type_placeholder_item.rs +++ b/src/test/ui/typeck_type_placeholder_item.rs @@ -13,141 +13,107 @@ fn test() -> _ { 5 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures fn test2() -> (_, _) { (5, 5) } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures -//~| NOTE not allowed in type signatures static TEST3: _ = "test"; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures static TEST4: _ = 145; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures static TEST5: (_, _) = (1, 2); //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures -//~| NOTE not allowed in type signatures fn test6(_: _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures fn test7(x: _) { let _x: usize = x; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures fn test8(_f: fn() -> _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| NOTE not allowed in type signatures struct Test9; impl Test9 { fn test9(&self) -> _ { () } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn test10(&self, _x : _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } impl Clone for Test9 { fn clone(&self) -> _ { Test9 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn clone_from(&mut self, other: _) { *self = Test9; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } struct Test10 { a: _, //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures b: (_, _), //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures } pub fn main() { fn fn_test() -> _ { 5 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test2() -> (_, _) { (5, 5) } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures static FN_TEST3: _ = "test"; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures static FN_TEST4: _ = 145; //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures static FN_TEST5: (_, _) = (1, 2); //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures fn fn_test6(_: _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test7(x: _) { let _x: usize = x; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test8(_f: fn() -> _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures struct FnTest9; impl FnTest9 { fn fn_test9(&self) -> _ { () } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn fn_test10(&self, _x : _) { } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } impl Clone for FnTest9 { fn clone(&self) -> _ { FnTest9 } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures fn clone_from(&mut self, other: _) { *self = FnTest9; } //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures } struct FnTest10 { a: _, //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures b: (_, _), //~^ ERROR the type placeholder `_` is not allowed within types on item signatures //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| NOTE not allowed in type signatures - //~| NOTE not allowed in type signatures } } diff --git a/src/test/ui/typeck_type_placeholder_item.stderr b/src/test/ui/typeck_type_placeholder_item.stderr new file mode 100644 index 0000000000000..39e4273157671 --- /dev/null +++ b/src/test/ui/typeck_type_placeholder_item.stderr @@ -0,0 +1,206 @@ +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:14:14 + | +14 | fn test() -> _ { 5 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:17:16 + | +17 | fn test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:17:19 + | +17 | fn test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:21:15 + | +21 | static TEST3: _ = "test"; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:24:15 + | +24 | static TEST4: _ = 145; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:27:16 + | +27 | static TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:27:19 + | +27 | static TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:31:13 + | +31 | fn test6(_: _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:34:13 + | +34 | fn test7(x: _) { let _x: usize = x; } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:37:22 + | +37 | fn test8(_f: fn() -> _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:59:8 + | +59 | a: _, + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:61:9 + | +61 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:61:12 + | +61 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:67:21 + | +67 | fn fn_test() -> _ { 5 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:70:23 + | +70 | fn fn_test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:70:26 + | +70 | fn fn_test2() -> (_, _) { (5, 5) } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:74:22 + | +74 | static FN_TEST3: _ = "test"; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:77:22 + | +77 | static FN_TEST4: _ = 145; + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:80:23 + | +80 | static FN_TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:80:26 + | +80 | static FN_TEST5: (_, _) = (1, 2); + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:84:20 + | +84 | fn fn_test6(_: _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:87:20 + | +87 | fn fn_test7(x: _) { let _x: usize = x; } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:90:29 + | +90 | fn fn_test8(_f: fn() -> _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:112:12 + | +112 | a: _, + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:114:13 + | +114 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:114:16 + | +114 | b: (_, _), + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:43:24 + | +43 | fn test9(&self) -> _ { () } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:46:27 + | +46 | fn test10(&self, _x : _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:51:24 + | +51 | fn clone(&self) -> _ { Test9 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:54:37 + | +54 | fn clone_from(&mut self, other: _) { *self = Test9; } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:96:31 + | +96 | fn fn_test9(&self) -> _ { () } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:99:34 + | +99 | fn fn_test10(&self, _x : _) { } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:104:28 + | +104 | fn clone(&self) -> _ { FnTest9 } + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/typeck_type_placeholder_item.rs:107:41 + | +107 | fn clone_from(&mut self, other: _) { *self = FnTest9; } + | ^ not allowed in type signatures + +error: aborting due to 34 previous errors + diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs b/src/test/ui/typeck_type_placeholder_lifetime_1.rs similarity index 95% rename from src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs rename to src/test/ui/typeck_type_placeholder_lifetime_1.rs index ad57752b6f755..49774ab173a8a 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/ui/typeck_type_placeholder_lifetime_1.rs @@ -18,5 +18,4 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, _> = Foo { r: &5 }; //~^ ERROR wrong number of type arguments: expected 1, found 2 [E0244] - //~| NOTE expected 1 type argument } diff --git a/src/test/ui/typeck_type_placeholder_lifetime_1.stderr b/src/test/ui/typeck_type_placeholder_lifetime_1.stderr new file mode 100644 index 0000000000000..8f017e6d9a2dc --- /dev/null +++ b/src/test/ui/typeck_type_placeholder_lifetime_1.stderr @@ -0,0 +1,8 @@ +error[E0244]: wrong number of type arguments: expected 1, found 2 + --> $DIR/typeck_type_placeholder_lifetime_1.rs:19:12 + | +19 | let c: Foo<_, _> = Foo { r: &5 }; + | ^^^^^^^^^ expected 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs b/src/test/ui/typeck_type_placeholder_lifetime_2.rs similarity index 95% rename from src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs rename to src/test/ui/typeck_type_placeholder_lifetime_2.rs index f1ecad0056e97..40617613ed7c6 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs +++ b/src/test/ui/typeck_type_placeholder_lifetime_2.rs @@ -18,5 +18,4 @@ 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 [E0244] - //~| NOTE expected 1 type argument } diff --git a/src/test/ui/typeck_type_placeholder_lifetime_2.stderr b/src/test/ui/typeck_type_placeholder_lifetime_2.stderr new file mode 100644 index 0000000000000..396715f57ab7c --- /dev/null +++ b/src/test/ui/typeck_type_placeholder_lifetime_2.stderr @@ -0,0 +1,8 @@ +error[E0244]: wrong number of type arguments: expected 1, found 2 + --> $DIR/typeck_type_placeholder_lifetime_2.rs:19:12 + | +19 | let c: Foo<_, usize> = Foo { r: &5 }; + | ^^^^^^^^^^^^^ expected 1 type argument + +error: aborting due to previous error + diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/ui/unboxed-closure-sugar-wrong-trait.rs similarity index 88% rename from src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs rename to src/test/ui/unboxed-closure-sugar-wrong-trait.rs index 95d78c0750173..1519ceb898851 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/ui/unboxed-closure-sugar-wrong-trait.rs @@ -14,8 +14,6 @@ trait Trait {} fn f isize>(x: F) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0244] -//~| NOTE expected no type arguments //~| ERROR E0220 -//~| NOTE associated type `Output` not found fn main() {} diff --git a/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr new file mode 100644 index 0000000000000..544d4b74bb7e6 --- /dev/null +++ b/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr @@ -0,0 +1,14 @@ +error[E0244]: wrong number of type arguments: expected 0, found 1 + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:8 + | +15 | fn f isize>(x: F) {} + | ^^^^^^^^^^^^^^^^^^^^^ expected no type arguments + +error[E0220]: associated type `Output` not found for `Trait` + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24 + | +15 | fn f isize>(x: F) {} + | ^^^^^ associated type `Output` not found + +error: aborting due to 2 previous errors + diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/ui/unconstrained-none.rs similarity index 92% rename from src/test/compile-fail/unconstrained-none.rs rename to src/test/ui/unconstrained-none.rs index 52ca91e62f8df..8124773497917 100644 --- a/src/test/compile-fail/unconstrained-none.rs +++ b/src/test/ui/unconstrained-none.rs @@ -12,5 +12,4 @@ fn main() { None; //~ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` } diff --git a/src/test/ui/unconstrained-none.stderr b/src/test/ui/unconstrained-none.stderr new file mode 100644 index 0000000000000..0f70cc5fd1093 --- /dev/null +++ b/src/test/ui/unconstrained-none.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/unconstrained-none.rs:14:5 + | +14 | None; //~ ERROR type annotations needed [E0282] + | ^^^^ cannot infer type for `T` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/ui/unconstrained-ref.rs similarity index 91% rename from src/test/compile-fail/unconstrained-ref.rs rename to src/test/ui/unconstrained-ref.rs index 6aaed789716a3..05c0d23b7e72d 100644 --- a/src/test/compile-fail/unconstrained-ref.rs +++ b/src/test/ui/unconstrained-ref.rs @@ -14,5 +14,4 @@ struct S<'a, T:'a> { fn main() { S { o: &None }; //~ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` } diff --git a/src/test/ui/unconstrained-ref.stderr b/src/test/ui/unconstrained-ref.stderr new file mode 100644 index 0000000000000..96d9b8396a4f9 --- /dev/null +++ b/src/test/ui/unconstrained-ref.stderr @@ -0,0 +1,8 @@ +error[E0282]: type annotations needed + --> $DIR/unconstrained-ref.rs:16:5 + | +16 | S { o: &None }; //~ ERROR type annotations needed [E0282] + | ^ cannot infer type for `T` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/union/union-const-eval.rs b/src/test/ui/union/union-const-eval.rs similarity index 86% rename from src/test/compile-fail/union/union-const-eval.rs rename to src/test/ui/union/union-const-eval.rs index 73b7743fc45c7..a4c969ba20c46 100644 --- a/src/test/compile-fail/union/union-const-eval.rs +++ b/src/test/ui/union/union-const-eval.rs @@ -19,8 +19,6 @@ fn main() { unsafe { let a: [u8; C.a]; // OK let b: [u8; C.b]; //~ ERROR constant evaluation error - //~^ NOTE nonexistent struct field //~| WARNING constant evaluation error - //~| NOTE on by default } } diff --git a/src/test/ui/union/union-const-eval.stderr b/src/test/ui/union/union-const-eval.stderr new file mode 100644 index 0000000000000..3c98b5cdc6cdc --- /dev/null +++ b/src/test/ui/union/union-const-eval.stderr @@ -0,0 +1,16 @@ +warning: constant evaluation error: nonexistent struct field + --> $DIR/union-const-eval.rs:21:21 + | +21 | let b: [u8; C.b]; //~ ERROR constant evaluation error + | ^^^ + | + = note: #[warn(const_err)] on by default + +error[E0080]: constant evaluation error + --> $DIR/union-const-eval.rs:21:21 + | +21 | let b: [u8; C.b]; //~ ERROR constant evaluation error + | ^^^ nonexistent struct field + +error: aborting due to previous error + diff --git a/src/test/compile-fail/union/union-derive-eq.rs b/src/test/ui/union/union-derive-eq.rs similarity index 100% rename from src/test/compile-fail/union/union-derive-eq.rs rename to src/test/ui/union/union-derive-eq.rs diff --git a/src/test/ui/union/union-derive-eq.stderr b/src/test/ui/union/union-derive-eq.stderr new file mode 100644 index 0000000000000..569191ca6e7b5 --- /dev/null +++ b/src/test/ui/union/union-derive-eq.stderr @@ -0,0 +1,10 @@ +error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied + --> $DIR/union-derive-eq.rs:25:5 + | +25 | a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied + | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq` + | + = note: required by `std::cmp::AssertParamIsEq` + +error: aborting due to previous error + diff --git a/src/test/ui/union-fields.rs b/src/test/ui/union/union-fields-1.rs similarity index 100% rename from src/test/ui/union-fields.rs rename to src/test/ui/union/union-fields-1.rs diff --git a/src/test/ui/union-fields.stderr b/src/test/ui/union/union-fields-1.stderr similarity index 76% rename from src/test/ui/union-fields.stderr rename to src/test/ui/union/union-fields-1.stderr index ffcd178ca548f..5204a13f6f209 100644 --- a/src/test/ui/union-fields.stderr +++ b/src/test/ui/union/union-fields-1.stderr @@ -1,29 +1,29 @@ error: field is never used: `c` - --> $DIR/union-fields.rs:16:5 + --> $DIR/union-fields-1.rs:16:5 | 16 | c: u8, //~ ERROR field is never used | ^^^^^ | note: lint level defined here - --> $DIR/union-fields.rs:11:9 + --> $DIR/union-fields-1.rs:11:9 | 11 | #![deny(dead_code)] | ^^^^^^^^^ error: field is never used: `a` - --> $DIR/union-fields.rs:19:5 + --> $DIR/union-fields-1.rs:19:5 | 19 | a: u8, //~ ERROR field is never used | ^^^^^ error: field is never used: `a` - --> $DIR/union-fields.rs:23:20 + --> $DIR/union-fields-1.rs:23:20 | 23 | union NoDropLike { a: u8 } //~ ERROR field is never used | ^^^^^ error: field is never used: `c` - --> $DIR/union-fields.rs:28:5 + --> $DIR/union-fields-1.rs:28:5 | 28 | c: u8, //~ ERROR field is never used | ^^^^^ diff --git a/src/test/compile-fail/union/union-fields.rs b/src/test/ui/union/union-fields-2.rs similarity index 87% rename from src/test/compile-fail/union/union-fields.rs rename to src/test/ui/union/union-fields-2.rs index 124b16f99b1af..7b9ff866a4351 100644 --- a/src/test/compile-fail/union/union-fields.rs +++ b/src/test/ui/union/union-fields-2.rs @@ -19,8 +19,6 @@ fn main() { let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field //~^ ERROR union `U` has no field named `c` - //~| NOTE `U` does not have this field - //~| NOTE available fields are: `a`, `b` let u = U { ..u }; //~ ERROR union expressions should have exactly one field //~^ ERROR functional record update syntax requires a struct @@ -29,7 +27,6 @@ fn main() { let U { a, b } = u; //~ ERROR union patterns should have exactly one field let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field //~^ ERROR union `U` does not have a field named `c` - //~| NOTE union `U` does not have field `c` let U { .. } = u; //~ ERROR union patterns should have exactly one field //~^ ERROR `..` cannot be used in union patterns let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns diff --git a/src/test/ui/union/union-fields-2.stderr b/src/test/ui/union/union-fields-2.stderr new file mode 100644 index 0000000000000..f6c64dcabd74c --- /dev/null +++ b/src/test/ui/union/union-fields-2.stderr @@ -0,0 +1,82 @@ +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:17:13 + | +17 | let u = U {}; //~ ERROR union expressions should have exactly one field + | ^ + +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:19:13 + | +19 | let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field + | ^ + +error[E0560]: union `U` has no field named `c` + --> $DIR/union-fields-2.rs:20:29 + | +20 | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field + | ^^ `U` does not have this field + | + = note: available fields are: `a`, `b` + +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:20:13 + | +20 | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field + | ^ + +error: union expressions should have exactly one field + --> $DIR/union-fields-2.rs:22:13 + | +22 | let u = U { ..u }; //~ ERROR union expressions should have exactly one field + | ^ + +error[E0436]: functional record update syntax requires a struct + --> $DIR/union-fields-2.rs:22:19 + | +22 | let u = U { ..u }; //~ ERROR union expressions should have exactly one field + | ^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:25:9 + | +25 | let U {} = u; //~ ERROR union patterns should have exactly one field + | ^^^^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:27:9 + | +27 | let U { a, b } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^^^ + +error[E0026]: union `U` does not have a field named `c` + --> $DIR/union-fields-2.rs:28:19 + | +28 | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field + | ^ union `U` does not have field `c` + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:28:9 + | +28 | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^^^^^^ + +error: union patterns should have exactly one field + --> $DIR/union-fields-2.rs:30:9 + | +30 | let U { .. } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^ + +error: `..` cannot be used in union patterns + --> $DIR/union-fields-2.rs:30:9 + | +30 | let U { .. } = u; //~ ERROR union patterns should have exactly one field + | ^^^^^^^^ + +error: `..` cannot be used in union patterns + --> $DIR/union-fields-2.rs:32:9 + | +32 | let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns + | ^^^^^^^^^^^ + +error: aborting due to 13 previous errors + diff --git a/src/test/ui/union-sized-field.rs b/src/test/ui/union/union-sized-field.rs similarity index 100% rename from src/test/ui/union-sized-field.rs rename to src/test/ui/union/union-sized-field.rs diff --git a/src/test/ui/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr similarity index 100% rename from src/test/ui/union-sized-field.stderr rename to src/test/ui/union/union-sized-field.stderr diff --git a/src/test/compile-fail/union/union-suggest-field.rs b/src/test/ui/union/union-suggest-field.rs similarity index 86% rename from src/test/compile-fail/union/union-suggest-field.rs rename to src/test/ui/union/union-suggest-field.rs index 65c7c980b8ac2..96fca78ef220c 100644 --- a/src/test/compile-fail/union/union-suggest-field.rs +++ b/src/test/ui/union/union-suggest-field.rs @@ -19,10 +19,8 @@ impl U { fn main() { let u = U { principle: 0 }; //~^ ERROR union `U` has no field named `principle` - //~| NOTE field does not exist - did you mean `principal`? let w = u.principial; //~ ERROR no field `principial` on type `U` //~^ did you mean `principal`? let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` - //~^ HELP maybe a `()` to call it is missing? } diff --git a/src/test/ui/union/union-suggest-field.stderr b/src/test/ui/union/union-suggest-field.stderr new file mode 100644 index 0000000000000..d2ea09553bcc1 --- /dev/null +++ b/src/test/ui/union/union-suggest-field.stderr @@ -0,0 +1,22 @@ +error[E0560]: union `U` has no field named `principle` + --> $DIR/union-suggest-field.rs:20:17 + | +20 | let u = U { principle: 0 }; + | ^^^^^^^^^^ field does not exist - did you mean `principal`? + +error[E0609]: no field `principial` on type `U` + --> $DIR/union-suggest-field.rs:22:15 + | +22 | let w = u.principial; //~ ERROR no field `principial` on type `U` + | ^^^^^^^^^^ did you mean `principal`? + +error[E0615]: attempted to take value of method `calculate` on type `U` + --> $DIR/union-suggest-field.rs:25:15 + | +25 | let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` + | ^^^^^^^^^ + | + = help: maybe a `()` to call it is missing? + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/unsafe-const-fn.rs b/src/test/ui/unsafe-const-fn.rs similarity index 95% rename from src/test/compile-fail/unsafe-const-fn.rs rename to src/test/ui/unsafe-const-fn.rs index 91e16592be472..765e2059a4b5e 100644 --- a/src/test/compile-fail/unsafe-const-fn.rs +++ b/src/test/ui/unsafe-const-fn.rs @@ -18,7 +18,6 @@ const unsafe fn dummy(v: u32) -> u32 { const VAL: u32 = dummy(0xFFFF); //~^ ERROR E0133 -//~| NOTE call to unsafe function fn main() { assert_eq!(VAL, 0xFFFF0000); diff --git a/src/test/ui/unsafe-const-fn.stderr b/src/test/ui/unsafe-const-fn.stderr new file mode 100644 index 0000000000000..f3923244aba85 --- /dev/null +++ b/src/test/ui/unsafe-const-fn.stderr @@ -0,0 +1,8 @@ +error[E0133]: call to unsafe function requires unsafe function or block + --> $DIR/unsafe-const-fn.rs:19:18 + | +19 | const VAL: u32 = dummy(0xFFFF); + | ^^^^^^^^^^^^^ call to unsafe function + +error: aborting due to previous error + diff --git a/src/test/compile-fail/unsized-enum2.rs b/src/test/ui/unsized-enum2.rs similarity index 100% rename from src/test/compile-fail/unsized-enum2.rs rename to src/test/ui/unsized-enum2.rs diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr new file mode 100644 index 0000000000000..97a83456bb4c7 --- /dev/null +++ b/src/test/ui/unsized-enum2.stderr @@ -0,0 +1,190 @@ +error[E0277]: the trait bound `W: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:33:8 + | +33 | VA(W), //~ ERROR `W: std::marker::Sized` is not satisfied + | ^^ `W` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `W` + = help: consider adding a `where W: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `X: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:34:8 + | +34 | VB{x: X}, //~ ERROR `X: std::marker::Sized` is not satisfied + | ^^^^ `X` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `X` + = help: consider adding a `where X: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Y: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:35:15 + | +35 | VC(isize, Y), //~ ERROR `Y: std::marker::Sized` is not satisfied + | ^^ `Y` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Y` + = help: consider adding a `where Y: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Z: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:36:18 + | +36 | VD{u: isize, x: Z}, //~ ERROR `Z: std::marker::Sized` is not satisfied + | ^^^^ `Z` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Z` + = help: consider adding a `where Z: std::marker::Sized` bound + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:39:8 + | +39 | VE([u8]), //~ ERROR `[u8]: std::marker::Sized` is not satisfied + | ^^^^^ `[u8]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[u8]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:40:8 + | +40 | VF{x: str}, //~ ERROR `str: std::marker::Sized` is not satisfied + | ^^^^^^ `str` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[f32]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:41:15 + | +41 | VG(isize, [f32]), //~ ERROR `[f32]: std::marker::Sized` is not satisfied + | ^^^^^^ `[f32]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[f32]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[u32]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:42:18 + | +42 | VH{u: isize, x: [u32]}, //~ ERROR `[u32]: std::marker::Sized` is not satisfied + | ^^^^^^^^ `[u32]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[u32]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Foo + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:51:8 + | +51 | VM(Foo), //~ ERROR `Foo + 'static: std::marker::Sized` is not satisfied + | ^^^^ `Foo + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `Bar + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:52:8 + | +52 | VN{x: Bar}, //~ ERROR `Bar + 'static: std::marker::Sized` is not satisfied + | ^^^^^^ `Bar + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `FooBar + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:53:15 + | +53 | VO(isize, FooBar), //~ ERROR `FooBar + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `BarFoo + 'static: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:54:18 + | +54 | VP{u: isize, x: BarFoo}, //~ ERROR `BarFoo + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^^^ `BarFoo + 'static` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[i8]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:57:8 + | +57 | VQ(<&'static [i8] as Deref>::Target), //~ ERROR `[i8]: std::marker::Sized` is not satisfied + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[i8]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[char]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:58:8 + | +58 | VR{x: <&'static [char] as Deref>::Target}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[char]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[char]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[f64]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:60:15 + | +60 | VS(isize, <&'static [f64] as Deref>::Target), + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[f64]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `[i32]: std::marker::Sized` is not satisfied + --> $DIR/unsized-enum2.rs:62:18 + | +62 | VT{u: isize, x: <&'static [i32] as Deref>::Target}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i32]` does not have a constant size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[i32]` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper1 + 'static: std::marker::Sized` is not satisfied in `Path1` + --> $DIR/unsized-enum2.rs:45:8 + | +45 | VI(Path1), //~ ERROR `PathHelper1 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time + | + = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `PathHelper1 + 'static` + = note: required because it appears within the type `Path1` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper2 + 'static: std::marker::Sized` is not satisfied in `Path2` + --> $DIR/unsized-enum2.rs:46:8 + | +46 | VJ{x: Path2}, //~ ERROR `PathHelper2 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^^ `PathHelper2 + 'static` does not have a constant size known at compile-time + | + = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `PathHelper2 + 'static` + = note: required because it appears within the type `Path2` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper3 + 'static: std::marker::Sized` is not satisfied in `Path3` + --> $DIR/unsized-enum2.rs:47:15 + | +47 | VK(isize, Path3), //~ ERROR `PathHelper3 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time + | + = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `PathHelper3 + 'static` + = note: required because it appears within the type `Path3` + = note: no field of an enum variant may have a dynamically sized type + +error[E0277]: the trait bound `PathHelper4 + 'static: std::marker::Sized` is not satisfied in `Path4` + --> $DIR/unsized-enum2.rs:48:18 + | +48 | VL{u: isize, x: Path4}, //~ ERROR `PathHelper4 + 'static: std::marker::Sized` is not satisfied + | ^^^^^^^^ `PathHelper4 + 'static` does not have a constant size known at compile-time + | + = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `PathHelper4 + 'static` + = note: required because it appears within the type `Path4` + = note: no field of an enum variant may have a dynamically sized type + +error: aborting due to 20 previous errors + diff --git a/src/test/compile-fail/use-mod.rs b/src/test/ui/use-mod.rs similarity index 74% rename from src/test/compile-fail/use-mod.rs rename to src/test/ui/use-mod.rs index 485a75f0f915f..2eb716959c153 100644 --- a/src/test/compile-fail/use-mod.rs +++ b/src/test/ui/use-mod.rs @@ -11,13 +11,9 @@ use foo::bar::{ self, //~^ ERROR `self` import can only appear once in the list -//~^^ NOTE previous import of the module `bar` here Bar, self -//~^ NOTE another `self` import appears here -//~| ERROR the name `bar` is defined multiple times -//~| NOTE `bar` reimported here -//~| NOTE `bar` must be defined only once in the type namespace of this module +//~^ ERROR the name `bar` is defined multiple times }; use {self}; diff --git a/src/test/ui/use-mod.stderr b/src/test/ui/use-mod.stderr new file mode 100644 index 0000000000000..abc7e2beb1ab6 --- /dev/null +++ b/src/test/ui/use-mod.stderr @@ -0,0 +1,35 @@ +error[E0430]: `self` import can only appear once in the list + --> $DIR/use-mod.rs:12:5 + | +12 | self, + | ^^^^ + | +note: another `self` import appears here + --> $DIR/use-mod.rs:15:5 + | +15 | self + | ^^^^ + +error[E0431]: `self` import can only appear in an import list with a non-empty prefix + --> $DIR/use-mod.rs:19:6 + | +19 | use {self}; + | ^^^^ + +error[E0252]: the name `bar` is defined multiple times + --> $DIR/use-mod.rs:15:5 + | +12 | self, + | ---- previous import of the module `bar` here +... +15 | self + | ^^^^ `bar` reimported here + | + = note: `bar` must be defined only once in the type namespace of this module +help: You can use `as` to change the binding name of the import + | +15 | self as Otherbar + | + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/variadic-ffi-3.rs b/src/test/ui/variadic-ffi-3.rs similarity index 87% rename from src/test/compile-fail/variadic-ffi-3.rs rename to src/test/ui/variadic-ffi-3.rs index fb102027180f0..12beebc181baf 100644 --- a/src/test/compile-fail/variadic-ffi-3.rs +++ b/src/test/ui/variadic-ffi-3.rs @@ -19,21 +19,17 @@ extern "C" fn bar(f: isize, x: u8) {} fn main() { unsafe { foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied - //~| NOTE expected at least 2 parameters foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied - //~| NOTE expected at least 2 parameters let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~^ ERROR: mismatched types //~| expected type `unsafe extern "C" fn(isize, u8)` //~| found type `unsafe extern "C" fn(isize, u8, ...) {foo}` - //~| NOTE: expected non-variadic fn, found variadic function let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~^ ERROR: mismatched types //~| expected type `extern "C" fn(isize, u8, ...)` //~| found type `extern "C" fn(isize, u8) {bar}` - //~| NOTE: expected variadic fn, found non-variadic function foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` diff --git a/src/test/ui/variadic-ffi-3.stderr b/src/test/ui/variadic-ffi-3.stderr new file mode 100644 index 0000000000000..be158c1e39896 --- /dev/null +++ b/src/test/ui/variadic-ffi-3.stderr @@ -0,0 +1,74 @@ +error[E0060]: this function takes at least 2 parameters but 0 parameters were supplied + --> $DIR/variadic-ffi-3.rs:21:9 + | +12 | fn foo(f: isize, x: u8, ...); + | ----------------------------- defined here +... +21 | foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied + | ^^^^^ expected at least 2 parameters + +error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied + --> $DIR/variadic-ffi-3.rs:22:9 + | +12 | fn foo(f: isize, x: u8, ...); + | ----------------------------- defined here +... +22 | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied + | ^^^^^^ expected at least 2 parameters + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-3.rs:24:56 + | +24 | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; + | ^^^ expected non-variadic fn, found variadic function + | + = note: expected type `unsafe extern "C" fn(isize, u8)` + found type `unsafe extern "C" fn(isize, u8, ...) {foo}` + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-3.rs:29:54 + | +29 | let y: extern "C" fn(f: isize, x: u8, ...) = bar; + | ^^^ expected variadic fn, found non-variadic function + | + = note: expected type `extern "C" fn(isize, u8, ...)` + found type `extern "C" fn(isize, u8) {bar}` + +error[E0617]: can't pass `f32` to variadic function, cast to `c_double` + --> $DIR/variadic-ffi-3.rs:34:19 + | +34 | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function, cast to `c_double` + | ^^^^ + +error[E0617]: can't pass `bool` to variadic function, cast to `c_int` + --> $DIR/variadic-ffi-3.rs:35:19 + | +35 | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function, cast to `c_int` + | ^^^^ + +error[E0617]: can't pass `i8` to variadic function, cast to `c_int` + --> $DIR/variadic-ffi-3.rs:36:19 + | +36 | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function, cast to `c_int` + | ^^^ + +error[E0617]: can't pass `u8` to variadic function, cast to `c_uint` + --> $DIR/variadic-ffi-3.rs:37:19 + | +37 | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function, cast to `c_uint` + | ^^^ + +error[E0617]: can't pass `i16` to variadic function, cast to `c_int` + --> $DIR/variadic-ffi-3.rs:38:19 + | +38 | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function, cast to `c_int` + | ^^^^ + +error[E0617]: can't pass `u16` to variadic function, cast to `c_uint` + --> $DIR/variadic-ffi-3.rs:39:19 + | +39 | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function, cast to `c_uint` + | ^^^^ + +error: aborting due to 10 previous errors + diff --git a/src/test/compile-fail/variance-unused-type-param.rs b/src/test/ui/variance-unused-type-param.rs similarity index 93% rename from src/test/compile-fail/variance-unused-type-param.rs rename to src/test/ui/variance-unused-type-param.rs index 862d842d62c23..a5f6fd2fda14f 100644 --- a/src/test/compile-fail/variance-unused-type-param.rs +++ b/src/test/ui/variance-unused-type-param.rs @@ -15,16 +15,13 @@ struct SomeStruct { x: u32 } //~^ ERROR parameter `A` is never used -//~| HELP PhantomData enum SomeEnum { Nothing } //~^ ERROR parameter `A` is never used -//~| HELP PhantomData // Here T might *appear* used, but in fact it isn't. enum ListCell { //~^ ERROR parameter `T` is never used -//~| HELP PhantomData Cons(Box>), Nil } diff --git a/src/test/ui/variance-unused-type-param.stderr b/src/test/ui/variance-unused-type-param.stderr new file mode 100644 index 0000000000000..0b07ac38cb65d --- /dev/null +++ b/src/test/ui/variance-unused-type-param.stderr @@ -0,0 +1,26 @@ +error[E0392]: parameter `A` is never used + --> $DIR/variance-unused-type-param.rs:16:19 + | +16 | struct SomeStruct { x: u32 } + | ^ unused type parameter + | + = help: consider removing `A` or using a marker such as `std::marker::PhantomData` + +error[E0392]: parameter `A` is never used + --> $DIR/variance-unused-type-param.rs:19:15 + | +19 | enum SomeEnum { Nothing } + | ^ unused type parameter + | + = help: consider removing `A` or using a marker such as `std::marker::PhantomData` + +error[E0392]: parameter `T` is never used + --> $DIR/variance-unused-type-param.rs:23:15 + | +23 | enum ListCell { + | ^ unused type parameter + | + = help: consider removing `T` or using a marker such as `std::marker::PhantomData` + +error: aborting due to 3 previous errors + diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/ui/vector-no-ann.rs similarity index 86% rename from src/test/compile-fail/vector-no-ann.rs rename to src/test/ui/vector-no-ann.rs index de229ded463f6..2143d2b64c6c3 100644 --- a/src/test/compile-fail/vector-no-ann.rs +++ b/src/test/ui/vector-no-ann.rs @@ -12,6 +12,4 @@ fn main() { let _foo = Vec::new(); //~^ ERROR type annotations needed [E0282] - //~| NOTE cannot infer type for `T` - //~| NOTE consider giving `_foo` a type } diff --git a/src/test/ui/vector-no-ann.stderr b/src/test/ui/vector-no-ann.stderr new file mode 100644 index 0000000000000..e788ea125ad40 --- /dev/null +++ b/src/test/ui/vector-no-ann.stderr @@ -0,0 +1,10 @@ +error[E0282]: type annotations needed + --> $DIR/vector-no-ann.rs:13:16 + | +13 | let _foo = Vec::new(); + | ---- ^^^^^^^^ cannot infer type for `T` + | | + | consider giving `_foo` a type + +error: aborting due to previous error + diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 6fc9423a4139a..494c57b161fea 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -9,6 +9,7 @@ env_logger = { version = "0.4", default-features = false } filetime = "0.1" getopts = "0.2" log = "0.3" +regex = "0.2" rustc-serialize = "0.3" [target.'cfg(unix)'.dependencies] diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index fac3b71f82cc4..8546289fdec09 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -22,6 +22,7 @@ extern crate libc; #[macro_use] extern crate log; extern crate rustc_serialize; +extern crate regex; extern crate test; use std::env; diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 74da774c6d55a..06e798554167b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -20,6 +20,7 @@ use json; use header::TestProps; use test::TestPaths; use util::logv; +use regex::Regex; use std::collections::HashMap; use std::collections::HashSet; @@ -2677,7 +2678,8 @@ impl<'test> TestCx<'test> { .replace("\r\n", "\n") // normalize for linebreaks on windows .replace("\t", "\\t"); // makes tabs visible for rule in custom_rules { - normalized = normalized.replace(&rule.0, &rule.1); + let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule"); + normalized = re.replace_all(&normalized, &rule.1[..]).into_owned(); } normalized }