diff options
| author | Matthias Einwag <matthias.einwag@live.com> | 2019-02-12 22:46:14 -0800 |
|---|---|---|
| committer | Matthias Einwag <matthias.einwag@live.com> | 2019-02-12 22:46:14 -0800 |
| commit | 871338c3aed87cb84f02ebd7fd9b447966d5b05d (patch) | |
| tree | a2e1315d7d17d0b9f3463686ed2fbf36f3238ec4 /src/test/ui | |
| parent | 1ef34a5a39641846e824b6450a705d6031002beb (diff) | |
| parent | 0f949c2fcc696d0260a99196d5e5400c59a26a54 (diff) | |
| download | rust-871338c3aed87cb84f02ebd7fd9b447966d5b05d.tar.gz rust-871338c3aed87cb84f02ebd7fd9b447966d5b05d.zip | |
Merging master
Diffstat (limited to 'src/test/ui')
179 files changed, 1592 insertions, 642 deletions
diff --git a/src/test/ui/associated-types/associated-types-coherence-failure.rs b/src/test/ui/associated-types/associated-types-coherence-failure.rs index fe1201ea06f..c33f2ac96ba 100644 --- a/src/test/ui/associated-types/associated-types-coherence-failure.rs +++ b/src/test/ui/associated-types/associated-types-coherence-failure.rs @@ -41,7 +41,7 @@ impl ToOwned for u8 { pub trait ToOwned { type Owned; - /// Create owned data from borrowed data, usually by copying. + /// Creates owned data from borrowed data, usually by copying. fn to_owned(&self) -> Self::Owned; } diff --git a/src/test/ui/attr-usage-repr.rs b/src/test/ui/attr-usage-repr.rs index 498bf4d284a..1df2947cbe2 100644 --- a/src/test/ui/attr-usage-repr.rs +++ b/src/test/ui/attr-usage-repr.rs @@ -1,4 +1,5 @@ #![feature(repr_simd)] +#![feature(repr_align_enum)] #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union fn f() {} @@ -18,7 +19,7 @@ struct SInt(f64, f64); #[repr(C)] enum EExtern { A, B } -#[repr(align(8))] //~ ERROR: attribute should be applied to struct +#[repr(align(8))] enum EAlign { A, B } #[repr(packed)] //~ ERROR: attribute should be applied to struct diff --git a/src/test/ui/attr-usage-repr.stderr b/src/test/ui/attr-usage-repr.stderr index 990984bbb2b..abb8685e4ce 100644 --- a/src/test/ui/attr-usage-repr.stderr +++ b/src/test/ui/attr-usage-repr.stderr @@ -1,5 +1,5 @@ error[E0517]: attribute should be applied to struct, enum or union - --> $DIR/attr-usage-repr.rs:3:8 + --> $DIR/attr-usage-repr.rs:4:8 | LL | #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union | ^ @@ -7,7 +7,7 @@ LL | fn f() {} | --------- not a struct, enum or union error[E0517]: attribute should be applied to enum - --> $DIR/attr-usage-repr.rs:15:8 + --> $DIR/attr-usage-repr.rs:16:8 | LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum | ^^ @@ -15,15 +15,7 @@ LL | struct SInt(f64, f64); | ---------------------- not an enum error[E0517]: attribute should be applied to struct or union - --> $DIR/attr-usage-repr.rs:21:8 - | -LL | #[repr(align(8))] //~ ERROR: attribute should be applied to struct - | ^^^^^^^^ -LL | enum EAlign { A, B } - | -------------------- not a struct or union - -error[E0517]: attribute should be applied to struct or union - --> $DIR/attr-usage-repr.rs:24:8 + --> $DIR/attr-usage-repr.rs:25:8 | LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct | ^^^^^^ @@ -31,13 +23,13 @@ LL | enum EPacked { A, B } | --------------------- not a struct or union error[E0517]: attribute should be applied to struct - --> $DIR/attr-usage-repr.rs:27:8 + --> $DIR/attr-usage-repr.rs:28:8 | LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct | ^^^^ LL | enum ESimd { A, B } | ------------------- not a struct -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0517`. diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.rs b/src/test/ui/attribute-with-no-generics-in-parameter-list.rs new file mode 100644 index 00000000000..c2cc91d8f77 --- /dev/null +++ b/src/test/ui/attribute-with-no-generics-in-parameter-list.rs @@ -0,0 +1,3 @@ +fn foo<#[attr]>() {} //~ ERROR attribute without generic parameters + +fn main() {} diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr new file mode 100644 index 00000000000..f08f107a62f --- /dev/null +++ b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr @@ -0,0 +1,8 @@ +error: attribute without generic parameters + --> $DIR/attribute-with-no-generics-in-parameter-list.rs:1:8 + | +LL | fn foo<#[attr]>() {} //~ ERROR attribute without generic parameters + | ^^^^^^^ attributes are only permitted when preceding parameters + +error: aborting due to previous error + diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs index d7feb038530..ca5fdd9da85 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs @@ -7,7 +7,7 @@ struct RefIntPair<'a, 'b>(&'a u32, &'b u32); impl<#[rustc_1] 'a, 'b, #[oops]> RefIntPair<'a, 'b> { - //~^ ERROR trailing attribute after lifetime parameters + //~^ ERROR trailing attribute after generic parameter } fn main() { diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr index c4c0cee5ccc..55e7a987784 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr @@ -1,4 +1,4 @@ -error: trailing attribute after lifetime parameters +error: trailing attribute after generic parameter --> $DIR/attrs-with-no-formal-in-generics-1.rs:9:25 | LL | impl<#[rustc_1] 'a, 'b, #[oops]> RefIntPair<'a, 'b> { diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs index f9db6a5f72a..c795612acf0 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs @@ -7,6 +7,6 @@ struct RefAny<'a, T>(&'a T); impl<#[rustc_1] 'a, #[rustc_2] T, #[oops]> RefAny<'a, T> {} -//~^ ERROR trailing attribute after type parameters +//~^ ERROR trailing attribute after generic parameter fn main() {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr index 9099d74ce1b..acd0ae3678a 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr @@ -1,4 +1,4 @@ -error: trailing attribute after type parameters +error: trailing attribute after generic parameter --> $DIR/attrs-with-no-formal-in-generics-2.rs:9:35 | LL | impl<#[rustc_1] 'a, #[rustc_2] T, #[oops]> RefAny<'a, T> {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs index e9f908d479f..3cfc70b4185 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs @@ -6,7 +6,7 @@ struct RefIntPair<'a, 'b>(&'a u32, &'b u32); fn hof_lt<Q>(_: Q) where Q: for <#[allow(unused)] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32 - //~^ ERROR trailing attribute after lifetime parameters + //~^ ERROR trailing attribute after generic parameter {} fn main() {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr index 452f0ea5e17..b9ca0097467 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr @@ -1,4 +1,4 @@ -error: trailing attribute after lifetime parameters +error: trailing attribute after generic parameter --> $DIR/attrs-with-no-formal-in-generics-3.rs:8:44 | LL | where Q: for <#[allow(unused)] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32 diff --git a/src/test/ui/augmented-assignments.nll.stderr b/src/test/ui/augmented-assignments.nll.stderr index 840b377263d..33c94d6e3a5 100644 --- a/src/test/ui/augmented-assignments.nll.stderr +++ b/src/test/ui/augmented-assignments.nll.stderr @@ -9,7 +9,7 @@ LL | x //~ error: use of moved value: `x` LL | | //~^ value used here after move LL | | += LL | | x; //~ value moved here - | | - + | | ^ | | | | |_____move out of `x` occurs here | borrow later used here diff --git a/src/test/ui/bad/bad-lint-cap2.stderr b/src/test/ui/bad/bad-lint-cap2.stderr index d7ec41489d1..b9638722778 100644 --- a/src/test/ui/bad/bad-lint-cap2.stderr +++ b/src/test/ui/bad/bad-lint-cap2.stderr @@ -2,7 +2,7 @@ error: unused import: `std::option` --> $DIR/bad-lint-cap2.rs:6:5 | LL | use std::option; //~ ERROR - | ^^^^^^^^^^^ + | ----^^^^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/bad-lint-cap2.rs:4:9 diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr index 5bf0b089afa..21ed50b550a 100644 --- a/src/test/ui/bad/bad-lint-cap3.stderr +++ b/src/test/ui/bad/bad-lint-cap3.stderr @@ -2,7 +2,7 @@ warning: unused import: `std::option` --> $DIR/bad-lint-cap3.rs:7:5 | LL | use std::option; //~ WARN - | ^^^^^^^^^^^ + | ----^^^^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/bad-lint-cap3.rs:4:9 diff --git a/src/test/ui/bad/bad-type-env-capture.rs b/src/test/ui/bad/bad-type-env-capture.rs index d2e6dff1252..53dfb13139a 100644 --- a/src/test/ui/bad/bad-type-env-capture.rs +++ b/src/test/ui/bad/bad-type-env-capture.rs @@ -1,4 +1,4 @@ fn foo<T>() { - fn bar(b: T) { } //~ ERROR can't use type parameters from outer + fn bar(b: T) { } //~ ERROR can't use generic parameters from outer } fn main() { } diff --git a/src/test/ui/bad/bad-type-env-capture.stderr b/src/test/ui/bad/bad-type-env-capture.stderr index 5558a440061..ce803e96801 100644 --- a/src/test/ui/bad/bad-type-env-capture.stderr +++ b/src/test/ui/bad/bad-type-env-capture.stderr @@ -1,12 +1,12 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/bad-type-env-capture.rs:2:15 | LL | fn foo<T>() { | - type variable from outer function -LL | fn bar(b: T) { } //~ ERROR can't use type parameters from outer - | --- ^ use of type variable from outer function +LL | fn bar(b: T) { } //~ ERROR can't use generic parameters from outer + | --- ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `bar<T>` + | help: try using a local generic parameter instead: `bar<T>` error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs new file mode 100644 index 00000000000..f4e9008dbd0 --- /dev/null +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -0,0 +1,23 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +fn u32_identity<const X: u32>() -> u32 { + //~^ ERROR const generics in any position are currently unsupported + 5 +} + +fn foo_a() { + u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` +} + +fn foo_b() { + u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` +} + +fn foo_c() { + u32_identity::< -1 >(); // ok +} + +fn main() { + u32_identity::<5>(); // ok +} diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr new file mode 100644 index 00000000000..1dd3a960316 --- /dev/null +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -0,0 +1,26 @@ +error: expected identifier, found `<-` + --> $DIR/const-expression-parameter.rs:10:19 + | +LL | u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` + | ^^ expected identifier + +error: expected one of `,` or `>`, found `+` + --> $DIR/const-expression-parameter.rs:14:22 + | +LL | u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` + | ^ expected one of `,` or `>` here + +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/const-expression-parameter.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error: const generics in any position are currently unsupported + --> $DIR/const-expression-parameter.rs:4:23 + | +LL | fn u32_identity<const X: u32>() -> u32 { + | ^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/const-generics/const-fn-with-const-param.rs b/src/test/ui/const-generics/const-fn-with-const-param.rs new file mode 100644 index 00000000000..052d723d96e --- /dev/null +++ b/src/test/ui/const-generics/const-fn-with-const-param.rs @@ -0,0 +1,12 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +const fn const_u32_identity<const X: u32>() -> u32 { + //~^ ERROR const parameters are not permitted in `const fn` + //~^^ ERROR const generics in any position are currently unsupported + X +} + +fn main() { + println!("{:?}", const_u32_identity::<18>()); +} diff --git a/src/test/ui/const-generics/const-fn-with-const-param.stderr b/src/test/ui/const-generics/const-fn-with-const-param.stderr new file mode 100644 index 00000000000..a08ebfb0d97 --- /dev/null +++ b/src/test/ui/const-generics/const-fn-with-const-param.stderr @@ -0,0 +1,24 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/const-fn-with-const-param.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error: const parameters are not permitted in `const fn` + --> $DIR/const-fn-with-const-param.rs:4:1 + | +LL | / const fn const_u32_identity<const X: u32>() -> u32 { +LL | | //~^ ERROR const parameters are not permitted in `const fn` +LL | | //~^^ ERROR const generics in any position are currently unsupported +LL | | X +LL | | } + | |_^ + +error: const generics in any position are currently unsupported + --> $DIR/const-fn-with-const-param.rs:4:35 + | +LL | const fn const_u32_identity<const X: u32>() -> u32 { + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs new file mode 100644 index 00000000000..3f120cbc4d3 --- /dev/null +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -0,0 +1,13 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +fn foo<const X: (), T>(_: T) { + //~^ ERROR type parameters must be declared prior to const parameters + //~^^ ERROR const generics in any position are currently unsupported +} + +fn bar<const X: (), 'a>(_: &'a ()) { + //~^ ERROR lifetime parameters must be declared prior to const parameters +} + +fn main() {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr new file mode 100644 index 00000000000..aedcaf52e26 --- /dev/null +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -0,0 +1,26 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/const-param-before-other-params.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error: type parameters must be declared prior to const parameters + --> $DIR/const-param-before-other-params.rs:4:21 + | +LL | fn foo<const X: (), T>(_: T) { + | --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>` + +error: lifetime parameters must be declared prior to const parameters + --> $DIR/const-param-before-other-params.rs:9:21 + | +LL | fn bar<const X: (), 'a>(_: &'a ()) { + | --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>` + +error: const generics in any position are currently unsupported + --> $DIR/const-param-before-other-params.rs:4:14 + | +LL | fn foo<const X: (), T>(_: T) { + | ^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.rs b/src/test/ui/const-generics/const-param-from-outer-fn.rs new file mode 100644 index 00000000000..5a8dd92086f --- /dev/null +++ b/src/test/ui/const-generics/const-param-from-outer-fn.rs @@ -0,0 +1,11 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +fn foo<const X: u32>() { + //~^ ERROR const generics in any position are currently unsupported + fn bar() -> u32 { + X //~ ERROR can't use generic parameters from outer function + } +} + +fn main() {} diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.stderr new file mode 100644 index 00000000000..b238b3a2aa4 --- /dev/null +++ b/src/test/ui/const-generics/const-param-from-outer-fn.stderr @@ -0,0 +1,26 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/const-param-from-outer-fn.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error[E0401]: can't use generic parameters from outer function + --> $DIR/const-param-from-outer-fn.rs:7:9 + | +LL | fn foo<const X: u32>() { + | - const variable from outer function +LL | //~^ ERROR const generics in any position are currently unsupported +LL | fn bar() -> u32 { + | --- try adding a local generic parameter in this method instead +LL | X //~ ERROR can't use generic parameters from outer function + | ^ use of generic parameter from outer function + +error: const generics in any position are currently unsupported + --> $DIR/const-param-from-outer-fn.rs:4:14 + | +LL | fn foo<const X: u32>() { + | ^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.rs b/src/test/ui/consts/miri_unleashed/assoc_const.rs new file mode 100644 index 00000000000..b8959667cc2 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/assoc_const.rs @@ -0,0 +1,30 @@ +// compile-flags: -Zunleash-the-miri-inside-of-you +#![allow(const_err)] + +// a test demonstrating why we do need to run static const qualification on associated constants +// instead of just checking the final constant + +trait Foo<T> { + const X: T; +} + +trait Bar<T, U: Foo<T>> { + const F: u32 = (U::X, 42).1; //~ WARN skipping const checks +} + +impl Foo<u32> for () { + const X: u32 = 42; +} +impl Foo<Vec<u32>> for String { + const X: Vec<u32> = Vec::new(); +} + +impl Bar<u32, ()> for () {} +impl Bar<Vec<u32>, String> for String {} + +fn main() { + // this is fine, but would have been forbidden by the static checks on `F` + let x = <() as Bar<u32, ()>>::F; + // this test only causes errors due to the line below, so post-monomorphization + let y = <String as Bar<Vec<u32>, String>>::F; //~ ERROR erroneous constant +} diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr new file mode 100644 index 00000000000..a40f8d46d0a --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -0,0 +1,15 @@ +warning: skipping const checks + --> $DIR/assoc_const.rs:12:31 + | +LL | const F: u32 = (U::X, 42).1; //~ WARN skipping const checks + | ^ + +error[E0080]: erroneous constant used + --> $DIR/assoc_const.rs:29:13 + | +LL | let y = <String as Bar<Vec<u32>, String>>::F; //~ ERROR erroneous constant + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs new file mode 100644 index 00000000000..c87b6389848 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs @@ -0,0 +1,28 @@ +#![allow(const_err)] + +// a test demonstrating that const qualification cannot prevent monomorphization time errors + +trait Foo { + const X: u32; +} + +trait Bar<U: Foo> { + const F: u32 = 100 / U::X; +} + +impl Foo for () { + const X: u32 = 42; +} + +impl Foo for String { + const X: u32 = 0; +} + +impl Bar<()> for () {} +impl Bar<String> for String {} + +fn main() { + let x = <() as Bar<()>>::F; + // this test only causes errors due to the line below, so post-monomorphization + let y = <String as Bar<String>>::F; //~ ERROR erroneous constant +} diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr new file mode 100644 index 00000000000..77aab31d26e --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -0,0 +1,9 @@ +error[E0080]: erroneous constant used + --> $DIR/assoc_const_2.rs:27:13 + | +LL | let y = <String as Bar<String>>::F; //~ ERROR erroneous constant + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs new file mode 100644 index 00000000000..5fb92535502 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs @@ -0,0 +1,27 @@ +#![allow(const_err)] + +// a test demonstrating why we do need to run static const qualification on associated constants +// instead of just checking the final constant + +trait Foo<T> { + const X: T; +} + +trait Bar<T, U: Foo<T>> { + const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time +} + +impl Foo<u32> for () { + const X: u32 = 42; +} +impl Foo<Vec<u32>> for String { + const X: Vec<u32> = Vec::new(); //~ ERROR not yet stable as a const fn +} + +impl Bar<u32, ()> for () {} +impl Bar<Vec<u32>, String> for String {} + +fn main() { + let x = <() as Bar<u32, ()>>::F; + let y = <String as Bar<Vec<u32>, String>>::F; +} diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr new file mode 100644 index 00000000000..e23ed1c6206 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr @@ -0,0 +1,17 @@ +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:11:20 + | +LL | const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time + | ^^^^^^^^^^ constants cannot evaluate destructors + +error: `<std::vec::Vec<T>>::new` is not yet stable as a const fn + --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:18:25 + | +LL | const X: Vec<u32> = Vec::new(); //~ ERROR not yet stable as a const fn + | ^^^^^^^^^^ + | + = help: add `#![feature(const_vec_new)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0493`. diff --git a/src/test/ui/double-type-import.stderr b/src/test/ui/double-type-import.stderr index 4bdee0c4c9f..c7288af13c2 100644 --- a/src/test/ui/double-type-import.stderr +++ b/src/test/ui/double-type-import.stderr @@ -4,13 +4,12 @@ error[E0252]: the name `X` is defined multiple times LL | pub use self::bar::X; | ------------ previous import of the type `X` here LL | use self::bar::X; - | ^^^^^^^^^^^^ `X` reimported here + | ----^^^^^^^^^^^^- + | | | + | | `X` reimported here + | help: remove unnecessary import | = note: `X` 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 - | -LL | use self::bar::X as OtherX; - | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/duplicate/duplicate-type-parameter.stderr b/src/test/ui/duplicate/duplicate-type-parameter.stderr index 41750d4bb36..17d48edc35c 100644 --- a/src/test/ui/duplicate/duplicate-type-parameter.stderr +++ b/src/test/ui/duplicate/duplicate-type-parameter.stderr @@ -1,4 +1,4 @@ -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:1:12 | LL | type Foo<T,T> = Option<T>; @@ -6,7 +6,7 @@ LL | type Foo<T,T> = Option<T>; | | | first use of `T` -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:4:14 | LL | struct Bar<T,T>(T); @@ -14,7 +14,7 @@ LL | struct Bar<T,T>(T); | | | first use of `T` -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:7:14 | LL | struct Baz<T,T> { @@ -22,7 +22,7 @@ LL | struct Baz<T,T> { | | | first use of `T` -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:12:12 | LL | enum Boo<T,T> { @@ -30,7 +30,7 @@ LL | enum Boo<T,T> { | | | first use of `T` -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:18:11 | LL | fn quux<T,T>(x: T) {} @@ -38,7 +38,7 @@ LL | fn quux<T,T>(x: T) {} | | | first use of `T` -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:21:13 | LL | trait Qux<T,T> {} @@ -46,7 +46,7 @@ LL | trait Qux<T,T> {} | | | first use of `T` -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/duplicate-type-parameter.rs:24:8 | LL | impl<T,T> Qux<T,T> for Option<T> {} diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index c94fa497678..27f281ee437 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -1,26 +1,26 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/E0401.rs:4:39 | LL | fn foo<T>(x: T) { | - type variable from outer function LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) { //~ ERROR E0401 - | --------------------------- ^ use of type variable from outer function + | --------------------------- ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `bfnr<U, V: Baz<U>, W: Fn(), T>` + | help: try using a local generic parameter instead: `bfnr<U, V: Baz<U>, W: Fn(), T>` -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/E0401.rs:9:16 | LL | fn foo<T>(x: T) { | - type variable from outer function ... LL | fn baz<U, - | --- try adding a local type parameter in this method instead + | --- try adding a local generic parameter in this method instead ... LL | (y: T) { //~ ERROR E0401 - | ^ use of type variable from outer function + | ^ use of generic parameter from outer function -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/E0401.rs:22:25 | LL | impl<T> Iterator for A<T> { @@ -29,7 +29,7 @@ LL | impl<T> Iterator for A<T> { LL | fn helper(sel: &Self) -> u8 { //~ ERROR E0401 | ^^^^ | | - | use of type variable from outer function + | use of generic parameter from outer function | use a type here instead error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0403.stderr b/src/test/ui/error-codes/E0403.stderr index 919a82dbe1a..b9246475029 100644 --- a/src/test/ui/error-codes/E0403.stderr +++ b/src/test/ui/error-codes/E0403.stderr @@ -1,4 +1,4 @@ -error[E0403]: the name `T` is already used for a type parameter in this type parameter list +error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/E0403.rs:1:11 | LL | fn foo<T, T>(s: T, u: T) {} //~ ERROR E0403 diff --git a/src/test/ui/error-codes/E0430.stderr b/src/test/ui/error-codes/E0430.stderr index 0151cde887f..78e4e43ac2f 100644 --- a/src/test/ui/error-codes/E0430.stderr +++ b/src/test/ui/error-codes/E0430.stderr @@ -10,15 +10,13 @@ error[E0252]: the name `fmt` is defined multiple times --> $DIR/E0430.rs:1:22 | LL | use std::fmt::{self, self}; //~ ERROR E0430 - | ---- ^^^^ `fmt` reimported here - | | + | ------^^^^ + | | | | + | | | `fmt` reimported here + | | help: remove unnecessary import | previous import of the module `fmt` here | = note: `fmt` 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 - | -LL | use std::fmt::{self, self as other_fmt}; //~ ERROR E0430 - | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0446.rs b/src/test/ui/error-codes/E0446.rs index 33bd6144716..f61c7e54616 100644 --- a/src/test/ui/error-codes/E0446.rs +++ b/src/test/ui/error-codes/E0446.rs @@ -1,4 +1,4 @@ -mod Foo { +mod foo { struct Bar(u32); pub fn bar() -> Bar { //~ ERROR E0446 diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 8f381320cf9..9c7399515f4 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -1,8 +1,8 @@ -error[E0446]: private type `Foo::Bar` in public interface +error[E0446]: private type `foo::Bar` in public interface --> $DIR/E0446.rs:4:5 | LL | struct Bar(u32); - | - `Foo::Bar` declared as private + | - `foo::Bar` declared as private LL | LL | / pub fn bar() -> Bar { //~ ERROR E0446 LL | | Bar(0) diff --git a/src/test/ui/error-codes/E0451.rs b/src/test/ui/error-codes/E0451.rs index 7c1c326fb5b..aa8f051afa7 100644 --- a/src/test/ui/error-codes/E0451.rs +++ b/src/test/ui/error-codes/E0451.rs @@ -1,4 +1,4 @@ -mod Bar { +mod bar { pub struct Foo { pub a: isize, b: isize, @@ -10,10 +10,10 @@ mod Bar { ); } -fn pat_match(foo: Bar::Foo) { - let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451 +fn pat_match(foo: bar::Foo) { + let bar::Foo{a, b} = foo; //~ ERROR E0451 } fn main() { - let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 + let f = bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 } diff --git a/src/test/ui/error-codes/E0451.stderr b/src/test/ui/error-codes/E0451.stderr index 11bc7e31803..11f08677246 100644 --- a/src/test/ui/error-codes/E0451.stderr +++ b/src/test/ui/error-codes/E0451.stderr @@ -1,13 +1,13 @@ -error[E0451]: field `b` of struct `Bar::Foo` is private - --> $DIR/E0451.rs:14:23 +error[E0451]: field `b` of struct `bar::Foo` is private + --> $DIR/E0451.rs:14:21 | -LL | let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451 - | ^^^ field `b` is private +LL | let bar::Foo{a, b} = foo; //~ ERROR E0451 + | ^ field `b` is private -error[E0451]: field `b` of struct `Bar::Foo` is private +error[E0451]: field `b` of struct `bar::Foo` is private --> $DIR/E0451.rs:18:29 | -LL | let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 +LL | let f = bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 | ^^^^ field `b` is private error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs index cf320b2747c..ee48f951629 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs @@ -5,7 +5,7 @@ macro_rules! bar { () => { // more layers don't help: - #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps + #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps macro_rules! baz { () => {} } diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr index 7cdf743b279..802c74239d7 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr @@ -1,8 +1,8 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:8:9 | -LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | bar!(); | ------- in this macro invocation diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs index c9ea6c338b5..ede969097d5 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs @@ -1,7 +1,7 @@ // checks that this attribute is caught on non-macro items. // this needs a different test since this is done after expansion -#[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps +#[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps struct S; fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr index 485c00ad42b..d619f1e3239 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr @@ -1,8 +1,8 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-struct.rs:4:1 | -LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs index bea60fc012e..0a1b6acd9bf 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs @@ -1,6 +1,6 @@ #![allow(unused_macros)] -#[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps +#[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps macro_rules! foo { () => {} } diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr index 0533d071de3..aa4f6648c4f 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr @@ -1,8 +1,8 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable.rs:3:1 | -LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.rs b/src/test/ui/feature-gates/feature-gate-const_generics.rs new file mode 100644 index 00000000000..a8a4ed57722 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-const_generics.rs @@ -0,0 +1,6 @@ +fn foo<const X: ()>() {} //~ ERROR const generics are unstable +//~^ const generics in any position are currently unsupported + +struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr new file mode 100644 index 00000000000..905cc07b6a1 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr @@ -0,0 +1,25 @@ +error[E0658]: const generics are unstable (see issue #44580) + --> $DIR/feature-gate-const_generics.rs:1:14 + | +LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable + | ^ + | + = help: add #![feature(const_generics)] to the crate attributes to enable + +error[E0658]: const generics are unstable (see issue #44580) + --> $DIR/feature-gate-const_generics.rs:4:18 + | +LL | struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable + | ^ + | + = help: add #![feature(const_generics)] to the crate attributes to enable + +error: const generics in any position are currently unsupported + --> $DIR/feature-gate-const_generics.rs:1:14 + | +LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable + | ^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-repr_align_enum.rs b/src/test/ui/feature-gates/feature-gate-repr_align_enum.rs new file mode 100644 index 00000000000..f8e68a9de01 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-repr_align_enum.rs @@ -0,0 +1,10 @@ +#[repr(align(16))] +struct Foo(u64); + +#[repr(align(8))] //~ ERROR `#[repr(align(x))]` on enums is experimental (see issue #57996) +enum Bar { + Foo { foo: Foo }, + Baz, +} + +fn main() { } diff --git a/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr b/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr new file mode 100644 index 00000000000..6def25f9651 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr @@ -0,0 +1,11 @@ +error[E0658]: `#[repr(align(x))]` on enums is experimental (see issue #57996) + --> $DIR/feature-gate-repr_align_enum.rs:4:1 + | +LL | #[repr(align(8))] //~ ERROR `#[repr(align(x))]` on enums is experimental (see issue #57996) + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(repr_align_enum)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs index 00606af9048..7ae53020fe0 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs +++ b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs @@ -6,12 +6,12 @@ use self::foo::S; mod foo { use std::cell::{UnsafeCell}; - static mut count : UnsafeCell<u64> = UnsafeCell::new(1); + static mut COUNT : UnsafeCell<u64> = UnsafeCell::new(1); pub struct S { pub a: u8, pub b: String, secret_uid: u64 } pub fn make_secrets(a: u8, b: String) -> S { - let val = unsafe { let p = count.get(); let val = *p; *p = val + 1; val }; + let val = unsafe { let p = COUNT.get(); let val = *p; *p = val + 1; val }; println!("creating {}, uid {}", b, val); S { a: a, b: b, secret_uid: val } } diff --git a/src/test/ui/impl-trait/bindings.rs b/src/test/ui/impl-trait/bindings.rs index 899303646d6..91d092634a9 100644 --- a/src/test/ui/impl-trait/bindings.rs +++ b/src/test/ui/impl-trait/bindings.rs @@ -2,27 +2,27 @@ fn a<T: Clone>(x: T) { const foo: impl Clone = x; -//~^ ERROR can't capture dynamic environment in a fn item + //~^ ERROR attempt to use a non-constant value in a constant } fn b<T: Clone>(x: T) { let _ = move || { const foo: impl Clone = x; -//~^ ERROR can't capture dynamic environment in a fn item + //~^ ERROR attempt to use a non-constant value in a constant }; } trait Foo<T: Clone> { fn a(x: T) { const foo: impl Clone = x; -//~^ ERROR can't capture dynamic environment in a fn item + //~^ ERROR attempt to use a non-constant value in a constant } } impl<T: Clone> Foo<T> for i32 { fn a(x: T) { const foo: impl Clone = x; -//~^ ERROR can't capture dynamic environment in a fn item + //~^ ERROR attempt to use a non-constant value in a constant } } diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr index 2a9be7a270a..a5bf583afea 100644 --- a/src/test/ui/impl-trait/bindings.stderr +++ b/src/test/ui/impl-trait/bindings.stderr @@ -1,35 +1,27 @@ -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/bindings.rs:4:29 | LL | const foo: impl Clone = x; - | ^ - | - = help: use the `|| { ... }` closure form instead + | ^ non-constant value -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/bindings.rs:10:33 | LL | const foo: impl Clone = x; - | ^ - | - = help: use the `|| { ... }` closure form instead + | ^ non-constant value -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/bindings.rs:17:33 | LL | const foo: impl Clone = x; - | ^ - | - = help: use the `|| { ... }` closure form instead + | ^ non-constant value -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/bindings.rs:24:33 | LL | const foo: impl Clone = x; - | ^ - | - = help: use the `|| { ... }` closure form instead + | ^ non-constant value error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0434`. +For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr index acd66826fdf..29660d908e4 100644 --- a/src/test/ui/imports/duplicate.stderr +++ b/src/test/ui/imports/duplicate.stderr @@ -4,13 +4,12 @@ error[E0252]: the name `foo` is defined multiple times LL | use a::foo; | ------ previous import of the value `foo` here LL | use a::foo; //~ ERROR the name `foo` is defined multiple times - | ^^^^^^ `foo` reimported here + | ----^^^^^^- + | | | + | | `foo` reimported here + | help: remove unnecessary import | = 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 - | -LL | use a::foo as other_foo; //~ ERROR the name `foo` is defined multiple times - | ^^^^^^^^^^^^^^^^^^^ error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:46:15 diff --git a/src/test/ui/imports/unused.stderr b/src/test/ui/imports/unused.stderr index b56e930158c..fa82e974e1e 100644 --- a/src/test/ui/imports/unused.stderr +++ b/src/test/ui/imports/unused.stderr @@ -2,7 +2,7 @@ error: unused import: `super::f` --> $DIR/unused.rs:7:24 | LL | pub(super) use super::f; //~ ERROR unused - | ^^^^^^^^ + | ---------------^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/unused.rs:1:9 diff --git a/src/test/ui/inner-static-type-parameter.rs b/src/test/ui/inner-static-type-parameter.rs index 60b4c5b8131..c08ccd29d80 100644 --- a/src/test/ui/inner-static-type-parameter.rs +++ b/src/test/ui/inner-static-type-parameter.rs @@ -4,7 +4,7 @@ enum Bar<T> { What } //~ ERROR parameter `T` is never used fn foo<T>() { static a: Bar<T> = Bar::What; -//~^ ERROR can't use type parameters from outer function +//~^ ERROR can't use generic parameters from outer function } fn main() { diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr index 2f2856edb0c..87fb364954d 100644 --- a/src/test/ui/inner-static-type-parameter.stderr +++ b/src/test/ui/inner-static-type-parameter.stderr @@ -1,12 +1,12 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/inner-static-type-parameter.rs:6:19 | LL | fn foo<T>() { | --- - type variable from outer function | | - | try adding a local type parameter in this method instead + | try adding a local generic parameter in this method instead LL | static a: Bar<T> = Bar::What; - | ^ use of type variable from outer function + | ^ use of generic parameter from outer function error[E0392]: parameter `T` is never used --> $DIR/inner-static-type-parameter.rs:3:10 diff --git a/src/test/ui/internal/auxiliary/internal_unstable.rs b/src/test/ui/internal/auxiliary/internal_unstable.rs index 7cf54c3e6a6..7c79dcb7522 100644 --- a/src/test/ui/internal/auxiliary/internal_unstable.rs +++ b/src/test/ui/internal/auxiliary/internal_unstable.rs @@ -23,14 +23,14 @@ pub struct Bar { } #[stable(feature = "stable", since = "1.0.0")] -#[allow_internal_unstable] +#[allow_internal_unstable(function)] #[macro_export] macro_rules! call_unstable_allow { () => { $crate::unstable() } } #[stable(feature = "stable", since = "1.0.0")] -#[allow_internal_unstable] +#[allow_internal_unstable(struct_field)] #[macro_export] macro_rules! construct_unstable_allow { ($e: expr) => { @@ -39,21 +39,21 @@ macro_rules! construct_unstable_allow { } #[stable(feature = "stable", since = "1.0.0")] -#[allow_internal_unstable] +#[allow_internal_unstable(method)] #[macro_export] macro_rules! call_method_allow { ($e: expr) => { $e.method() } } #[stable(feature = "stable", since = "1.0.0")] -#[allow_internal_unstable] +#[allow_internal_unstable(struct_field, struct2_field)] #[macro_export] macro_rules! access_field_allow { ($e: expr) => { $e.x } } #[stable(feature = "stable", since = "1.0.0")] -#[allow_internal_unstable] +#[allow_internal_unstable()] #[macro_export] macro_rules! pass_through_allow { ($e: expr) => { $e } diff --git a/src/test/ui/internal/internal-unstable.rs b/src/test/ui/internal/internal-unstable.rs index 34fef33bfeb..e09a5d89172 100644 --- a/src/test/ui/internal/internal-unstable.rs +++ b/src/test/ui/internal/internal-unstable.rs @@ -13,7 +13,7 @@ macro_rules! foo { }} } -#[allow_internal_unstable] +#[allow_internal_unstable(function)] macro_rules! bar { ($e: expr) => {{ foo!($e, diff --git a/src/test/ui/issues/auxiliary/issue-52891.rs b/src/test/ui/issues/auxiliary/issue-52891.rs new file mode 100644 index 00000000000..07598118322 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-52891.rs @@ -0,0 +1,33 @@ +pub mod a { + pub mod inner { + } +} + +pub mod b { + pub mod inner { + } +} + +pub mod c {} + +pub mod d {} + +pub mod e {} + +pub mod f {} + +pub mod g {} + +pub mod h {} + +pub mod i {} + +pub mod j {} + +pub mod k {} + +pub mod l {} + +pub mod m {} + +pub mod n {} diff --git a/src/test/ui/issues/issue-12796.rs b/src/test/ui/issues/issue-12796.rs index acd4584c737..942d6b9a568 100644 --- a/src/test/ui/issues/issue-12796.rs +++ b/src/test/ui/issues/issue-12796.rs @@ -1,7 +1,7 @@ trait Trait { fn outer(&self) { fn inner(_: &Self) { - //~^ ERROR can't use type parameters from outer function + //~^ ERROR can't use generic parameters from outer function } } } diff --git a/src/test/ui/issues/issue-12796.stderr b/src/test/ui/issues/issue-12796.stderr index 4bc29fd37dc..a01fd2d6542 100644 --- a/src/test/ui/issues/issue-12796.stderr +++ b/src/test/ui/issues/issue-12796.stderr @@ -1,10 +1,10 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/issue-12796.rs:3:22 | LL | fn inner(_: &Self) { | ^^^^ | | - | use of type variable from outer function + | use of generic parameter from outer function | can't use `Self` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-3.rs b/src/test/ui/issues/issue-20616-3.rs index e84506ee249..9bfd5bf2313 100644 --- a/src/test/ui/issues/issue-20616-3.rs +++ b/src/test/ui/issues/issue-20616-3.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -12,7 +10,8 @@ type Type_1_<'a, T> = &'a T; //type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` +type Type_3<T> = Box<T,,>; +//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,` //type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,` diff --git a/src/test/ui/issues/issue-20616-3.stderr b/src/test/ui/issues/issue-20616-3.stderr index 5247298b7cc..f51fb949c74 100644 --- a/src/test/ui/issues/issue-20616-3.stderr +++ b/src/test/ui/issues/issue-20616-3.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-3.rs:15:24 +error: expected one of `>`, const, identifier, lifetime, or type, found `,` + --> $DIR/issue-20616-3.rs:13:24 | -LL | type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` - | ^ expected one of `>`, identifier, lifetime, or type here +LL | type Type_3<T> = Box<T,,>; + | ^ expected one of `>`, const, identifier, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-4.rs b/src/test/ui/issues/issue-20616-4.rs index 785a6fa7d9a..e9a34a04667 100644 --- a/src/test/ui/issues/issue-20616-4.rs +++ b/src/test/ui/issues/issue-20616-4.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -16,7 +14,7 @@ type Type_1_<'a, T> = &'a T; type Type_4<T> = Type_1_<'static,, T>; -//~^ error: expected one of `>`, identifier, lifetime, or type, found `,` +//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; diff --git a/src/test/ui/issues/issue-20616-4.stderr b/src/test/ui/issues/issue-20616-4.stderr index 74c38d9e97d..22a655465e8 100644 --- a/src/test/ui/issues/issue-20616-4.stderr +++ b/src/test/ui/issues/issue-20616-4.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-4.rs:18:34 +error: expected one of `>`, const, identifier, lifetime, or type, found `,` + --> $DIR/issue-20616-4.rs:16:34 | LL | type Type_4<T> = Type_1_<'static,, T>; - | ^ expected one of `>`, identifier, lifetime, or type here + | ^ expected one of `>`, const, identifier, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-5.rs b/src/test/ui/issues/issue-20616-5.rs index 71dcc1f3a02..23862516d2c 100644 --- a/src/test/ui/issues/issue-20616-5.rs +++ b/src/test/ui/issues/issue-20616-5.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -22,7 +20,7 @@ type Type_5_<'a> = Type_1_<'a, ()>; type Type_5<'a> = Type_1_<'a, (),,>; -//~^ error: expected one of `>`, identifier, lifetime, or type, found `,` +//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,` //type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` diff --git a/src/test/ui/issues/issue-20616-5.stderr b/src/test/ui/issues/issue-20616-5.stderr index 38457beadc4..d83fc41f43e 100644 --- a/src/test/ui/issues/issue-20616-5.stderr +++ b/src/test/ui/issues/issue-20616-5.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-5.rs:24:34 +error: expected one of `>`, const, identifier, lifetime, or type, found `,` + --> $DIR/issue-20616-5.rs:22:34 | LL | type Type_5<'a> = Type_1_<'a, (),,>; - | ^ expected one of `>`, identifier, lifetime, or type here + | ^ expected one of `>`, const, identifier, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-6.rs b/src/test/ui/issues/issue-20616-6.rs index da32da48852..dc327f3f788 100644 --- a/src/test/ui/issues/issue-20616-6.rs +++ b/src/test/ui/issues/issue-20616-6.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -25,7 +23,7 @@ type Type_5_<'a> = Type_1_<'a, ()>; type Type_6 = Type_5_<'a,,>; -//~^ error: expected one of `>`, identifier, lifetime, or type, found `,` +//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,` //type Type_7 = Box<(),,>; // error: expected type, found `,` diff --git a/src/test/ui/issues/issue-20616-6.stderr b/src/test/ui/issues/issue-20616-6.stderr index 55b1d031a39..0740df59523 100644 --- a/src/test/ui/issues/issue-20616-6.stderr +++ b/src/test/ui/issues/issue-20616-6.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-6.rs:27:26 +error: expected one of `>`, const, identifier, lifetime, or type, found `,` + --> $DIR/issue-20616-6.rs:25:26 | LL | type Type_6 = Type_5_<'a,,>; - | ^ expected one of `>`, identifier, lifetime, or type here + | ^ expected one of `>`, const, identifier, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-7.rs b/src/test/ui/issues/issue-20616-7.rs index feaaff2c890..ffd1620c1d3 100644 --- a/src/test/ui/issues/issue-20616-7.rs +++ b/src/test/ui/issues/issue-20616-7.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -27,7 +25,8 @@ type Type_5_<'a> = Type_1_<'a, ()>; //type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` +type Type_7 = Box<(),,>; +//~^ error: expected one of `>`, const, identifier, lifetime, or type, found `,` //type Type_8<'a,,> = &'a (); // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-7.stderr b/src/test/ui/issues/issue-20616-7.stderr index 8b5f67c703f..c0e108375be 100644 --- a/src/test/ui/issues/issue-20616-7.stderr +++ b/src/test/ui/issues/issue-20616-7.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-7.rs:30:22 +error: expected one of `>`, const, identifier, lifetime, or type, found `,` + --> $DIR/issue-20616-7.rs:28:22 | -LL | type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` - | ^ expected one of `>`, identifier, lifetime, or type here +LL | type Type_7 = Box<(),,>; + | ^ expected one of `>`, const, identifier, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-8.rs b/src/test/ui/issues/issue-20616-8.rs index 2fc7243559a..c9e8b61e50b 100644 --- a/src/test/ui/issues/issue-20616-8.rs +++ b/src/test/ui/issues/issue-20616-8.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -30,7 +28,8 @@ type Type_5_<'a> = Type_1_<'a, ()>; //type Type_7 = Box<(),,>; // error: expected type, found `,` -type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,` +type Type_8<'a,,> = &'a (); +//~^ error: expected one of `>`, `const`, identifier, or lifetime, found `,` //type Type_9<T,,> = Box<T>; // error: expected identifier, found `,` diff --git a/src/test/ui/issues/issue-20616-8.stderr b/src/test/ui/issues/issue-20616-8.stderr index cdeb544f07c..0ef9192f1e7 100644 --- a/src/test/ui/issues/issue-20616-8.stderr +++ b/src/test/ui/issues/issue-20616-8.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, or lifetime, found `,` - --> $DIR/issue-20616-8.rs:33:16 +error: expected one of `>`, `const`, identifier, or lifetime, found `,` + --> $DIR/issue-20616-8.rs:31:16 | -LL | type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,` - | ^ expected one of `>`, identifier, or lifetime here +LL | type Type_8<'a,,> = &'a (); + | ^ expected one of `>`, `const`, identifier, or lifetime here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-9.rs b/src/test/ui/issues/issue-20616-9.rs index b14a5b0ff36..1c509f26fd6 100644 --- a/src/test/ui/issues/issue-20616-9.rs +++ b/src/test/ui/issues/issue-20616-9.rs @@ -1,8 +1,6 @@ // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time - - type Type_1_<'a, T> = &'a T; @@ -33,4 +31,5 @@ type Type_5_<'a> = Type_1_<'a, ()>; //type Type_8<'a,,> = &'a (); // error: expected identifier, found `,` -type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, identifier, or lifetime, found `,` +type Type_9<T,,> = Box<T>; +//~^ error: expected one of `>`, `const`, identifier, or lifetime, found `,` diff --git a/src/test/ui/issues/issue-20616-9.stderr b/src/test/ui/issues/issue-20616-9.stderr index dfe705c6f12..5fd1400a2e8 100644 --- a/src/test/ui/issues/issue-20616-9.stderr +++ b/src/test/ui/issues/issue-20616-9.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, or lifetime, found `,` - --> $DIR/issue-20616-9.rs:36:15 +error: expected one of `>`, `const`, identifier, or lifetime, found `,` + --> $DIR/issue-20616-9.rs:34:15 | -LL | type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, identifier, or lifetime, found `,` - | ^ expected one of `>`, identifier, or lifetime here +LL | type Type_9<T,,> = Box<T>; + | ^ expected one of `>`, `const`, identifier, or lifetime here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20797.rs b/src/test/ui/issues/issue-20797.rs index ce8564ffe43..e504b4705da 100644 --- a/src/test/ui/issues/issue-20797.rs +++ b/src/test/ui/issues/issue-20797.rs @@ -17,7 +17,7 @@ impl PathExtensions for PathBuf {} /// A strategy for acquiring more subpaths to walk. pub trait Strategy { type P: PathExtensions; - /// Get additional subpaths from a given path. + /// Gets additional subpaths from a given path. fn get_more(&self, item: &Self::P) -> io::Result<Vec<Self::P>>; /// Determine whether a path should be walked further. /// This is run against each item from `get_more()`. @@ -44,7 +44,7 @@ pub struct Subpaths<S: Strategy> { } impl<S: Strategy> Subpaths<S> { - /// Create a directory walker with a root path and strategy. + /// Creates a directory walker with a root path and strategy. pub fn new(p: &S::P, strategy: S) -> io::Result<Subpaths<S>> { let stack = strategy.get_more(p)?; Ok(Subpaths { stack: stack, strategy: strategy }) @@ -52,7 +52,7 @@ impl<S: Strategy> Subpaths<S> { } impl<S: Default + Strategy> Subpaths<S> { - /// Create a directory walker with a root path and a default strategy. + /// Creates a directory walker with a root path and a default strategy. pub fn walk(p: &S::P) -> io::Result<Subpaths<S>> { Subpaths::new(p, Default::default()) } diff --git a/src/test/ui/issues/issue-26886.stderr b/src/test/ui/issues/issue-26886.stderr index 08faa9c9ca2..70dacb353fe 100644 --- a/src/test/ui/issues/issue-26886.stderr +++ b/src/test/ui/issues/issue-26886.stderr @@ -4,13 +4,12 @@ error[E0252]: the name `Arc` is defined multiple times LL | use std::sync::{self, Arc}; | --- previous import of the type `Arc` here LL | use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times - | ^^^^^^^^^^^^^^ `Arc` reimported here + | ----^^^^^^^^^^^^^^- + | | | + | | `Arc` reimported here + | help: remove unnecessary import | = 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 - | -LL | 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:4:5 @@ -19,13 +18,12 @@ LL | use std::sync::{self, Arc}; | ---- previous import of the module `sync` here ... LL | use std::sync; //~ ERROR the name `sync` is defined multiple times - | ^^^^^^^^^ `sync` reimported here + | ----^^^^^^^^^- + | | | + | | `sync` reimported here + | help: remove unnecessary import | = 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 - | -LL | use std::sync as other_sync; //~ ERROR the name `sync` is defined multiple times - | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-27433.rs b/src/test/ui/issues/issue-27433.rs index 2cc7d05e7c6..156ae68efe2 100644 --- a/src/test/ui/issues/issue-27433.rs +++ b/src/test/ui/issues/issue-27433.rs @@ -1,5 +1,5 @@ fn main() { let foo = 42u32; const FOO : u32 = foo; - //~^ ERROR can't capture dynamic environment + //~^ ERROR attempt to use a non-constant value in a constant } diff --git a/src/test/ui/issues/issue-27433.stderr b/src/test/ui/issues/issue-27433.stderr index 78a193dd99a..e232d17e6d7 100644 --- a/src/test/ui/issues/issue-27433.stderr +++ b/src/test/ui/issues/issue-27433.stderr @@ -1,11 +1,9 @@ -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-27433.rs:3:23 | LL | const FOO : u32 = foo; - | ^^^ - | - = help: use the `|| { ... }` closure form instead + | ^^^ non-constant value error: aborting due to previous error -For more information about this error, try `rustc --explain E0434`. +For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/issues/issue-3021-c.rs b/src/test/ui/issues/issue-3021-c.rs index 491336206ca..94ed1fdf781 100644 --- a/src/test/ui/issues/issue-3021-c.rs +++ b/src/test/ui/issues/issue-3021-c.rs @@ -1,8 +1,8 @@ fn siphash<T>() { trait U { - fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function - //~^ ERROR can't use type parameters from outer function + fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function + //~^ ERROR can't use generic parameters from outer function } } diff --git a/src/test/ui/issues/issue-3021-c.stderr b/src/test/ui/issues/issue-3021-c.stderr index 323ce4fa306..5eadf7837c7 100644 --- a/src/test/ui/issues/issue-3021-c.stderr +++ b/src/test/ui/issues/issue-3021-c.stderr @@ -1,24 +1,24 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/issue-3021-c.rs:4:24 | LL | fn siphash<T>() { | - type variable from outer function ... -LL | fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function - | - ^ use of type variable from outer function +LL | fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function + | - ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `g<T>` + | help: try using a local generic parameter instead: `g<T>` -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/issue-3021-c.rs:4:30 | LL | fn siphash<T>() { | - type variable from outer function ... -LL | fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function - | - ^ use of type variable from outer function +LL | fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function + | - ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `g<T>` + | help: try using a local generic parameter instead: `g<T>` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-30730.stderr b/src/test/ui/issues/issue-30730.stderr index 0a901076f46..3cfadd33b8f 100644 --- a/src/test/ui/issues/issue-30730.stderr +++ b/src/test/ui/issues/issue-30730.stderr @@ -2,7 +2,7 @@ error: unused import: `std::thread` --> $DIR/issue-30730.rs:3:5 | LL | use std::thread; - | ^^^^^^^^^^^ + | ----^^^^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/issue-30730.rs:2:9 diff --git a/src/test/ui/issues/issue-3214.rs b/src/test/ui/issues/issue-3214.rs index 85eae2686e6..9a727aa3057 100644 --- a/src/test/ui/issues/issue-3214.rs +++ b/src/test/ui/issues/issue-3214.rs @@ -1,6 +1,6 @@ fn foo<T>() { struct Foo { - x: T, //~ ERROR can't use type parameters from outer function + x: T, //~ ERROR can't use generic parameters from outer function } impl<T> Drop for Foo<T> { diff --git a/src/test/ui/issues/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr index 4ecea4f9800..e6526bad3e0 100644 --- a/src/test/ui/issues/issue-3214.stderr +++ b/src/test/ui/issues/issue-3214.stderr @@ -1,13 +1,13 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/issue-3214.rs:3:12 | LL | fn foo<T>() { | --- - type variable from outer function | | - | try adding a local type parameter in this method instead + | try adding a local generic parameter in this method instead LL | struct Foo { -LL | x: T, //~ ERROR can't use type parameters from outer function - | ^ use of type variable from outer function +LL | x: T, //~ ERROR can't use generic parameters from outer function + | ^ use of generic parameter from outer function error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/issue-3214.rs:6:26 diff --git a/src/test/ui/issues/issue-3521-2.rs b/src/test/ui/issues/issue-3521-2.rs index 39f7fcb8337..871394f9eae 100644 --- a/src/test/ui/issues/issue-3521-2.rs +++ b/src/test/ui/issues/issue-3521-2.rs @@ -2,7 +2,7 @@ fn main() { let foo = 100; static y: isize = foo + 1; - //~^ ERROR can't capture dynamic environment + //~^ ERROR attempt to use a non-constant value in a constant println!("{}", y); } diff --git a/src/test/ui/issues/issue-3521-2.stderr b/src/test/ui/issues/issue-3521-2.stderr index 1464fd74bba..d54bbbcdc33 100644 --- a/src/test/ui/issues/issue-3521-2.stderr +++ b/src/test/ui/issues/issue-3521-2.stderr @@ -1,11 +1,9 @@ -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3521-2.rs:4:23 | LL | static y: isize = foo + 1; - | ^^^ - | - = help: use the `|| { ... }` closure form instead + | ^^^ non-constant value error: aborting due to previous error -For more information about this error, try `rustc --explain E0434`. +For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/issues/issue-3668-2.rs b/src/test/ui/issues/issue-3668-2.rs index 265a884ded7..525f6f5684e 100644 --- a/src/test/ui/issues/issue-3668-2.rs +++ b/src/test/ui/issues/issue-3668-2.rs @@ -1,6 +1,6 @@ fn f(x:isize) { static child: isize = x + 1; - //~^ ERROR can't capture dynamic environment + //~^ ERROR attempt to use a non-constant value in a constant } fn main() {} diff --git a/src/test/ui/issues/issue-3668-2.stderr b/src/test/ui/issues/issue-3668-2.stderr index 8dd6f49d8de..d6a6e837960 100644 --- a/src/test/ui/issues/issue-3668-2.stderr +++ b/src/test/ui/issues/issue-3668-2.stderr @@ -1,11 +1,9 @@ -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3668-2.rs:2:27 | LL | static child: isize = x + 1; - | ^ - | - = help: use the `|| { ... }` closure form instead + | ^ non-constant value error: aborting due to previous error -For more information about this error, try `rustc --explain E0434`. +For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/issues/issue-3668.rs b/src/test/ui/issues/issue-3668.rs index 3f61b1b02e7..0e1f19a75ba 100644 --- a/src/test/ui/issues/issue-3668.rs +++ b/src/test/ui/issues/issue-3668.rs @@ -6,7 +6,7 @@ trait PTrait { impl PTrait for P { fn getChildOption(&self) -> Option<Box<P>> { static childVal: Box<P> = self.child.get(); - //~^ ERROR can't capture dynamic environment + //~^ ERROR attempt to use a non-constant value in a constant panic!(); } } diff --git a/src/test/ui/issues/issue-3668.stderr b/src/test/ui/issues/issue-3668.stderr index 7f974de9da8..98cd3631a53 100644 --- a/src/test/ui/issues/issue-3668.stderr +++ b/src/test/ui/issues/issue-3668.stderr @@ -1,11 +1,9 @@ -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-3668.rs:8:34 | LL | static childVal: Box<P> = self.child.get(); - | ^^^^ - | - = help: use the `|| { ... }` closure form instead + | ^^^^ non-constant value error: aborting due to previous error -For more information about this error, try `rustc --explain E0434`. +For more information about this error, try `rustc --explain E0435`. diff --git a/src/test/ui/issues/issue-45829/import-twice.stderr b/src/test/ui/issues/issue-45829/import-twice.stderr index 374b809647e..2a1ac576511 100644 --- a/src/test/ui/issues/issue-45829/import-twice.stderr +++ b/src/test/ui/issues/issue-45829/import-twice.stderr @@ -2,15 +2,13 @@ error[E0252]: the name `A` is defined multiple times --> $DIR/import-twice.rs:6:14 | LL | use foo::{A, A}; - | - ^ `A` reimported here - | | + | ---^ + | || | + | || `A` reimported here + | |help: remove unnecessary import | previous import of the type `A` 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 - | -LL | use foo::{A, A as OtherA}; - | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-48636.fixed b/src/test/ui/issues/issue-48636.fixed index 39e6c98b1f5..87c19a32d4c 100644 --- a/src/test/ui/issues/issue-48636.fixed +++ b/src/test/ui/issues/issue-48636.fixed @@ -4,8 +4,9 @@ struct S { x: u8, - /// The id of the parent core + /// The ID of the parent core y: u8, } //~^^^ ERROR found a documentation comment that doesn't document anything + fn main() {} diff --git a/src/test/ui/issues/issue-48636.rs b/src/test/ui/issues/issue-48636.rs index bcf57772b51..8610dc2f72e 100644 --- a/src/test/ui/issues/issue-48636.rs +++ b/src/test/ui/issues/issue-48636.rs @@ -4,8 +4,9 @@ struct S { x: u8 - /// The id of the parent core + /// The ID of the parent core y: u8, } //~^^^ ERROR found a documentation comment that doesn't document anything + fn main() {} diff --git a/src/test/ui/issues/issue-48636.stderr b/src/test/ui/issues/issue-48636.stderr index de335d2c29b..462723d1d93 100644 --- a/src/test/ui/issues/issue-48636.stderr +++ b/src/test/ui/issues/issue-48636.stderr @@ -3,7 +3,7 @@ error[E0585]: found a documentation comment that doesn't document anything | LL | x: u8 | - help: missing comma here: `,` -LL | /// The id of the parent core +LL | /// The ID of the parent core | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: doc comments must come before what they document, maybe a comment was intended with `//`? diff --git a/src/test/ui/issues/issue-49934.rs b/src/test/ui/issues/issue-49934.rs index 59ca6cc292d..ad410f30c04 100644 --- a/src/test/ui/issues/issue-49934.rs +++ b/src/test/ui/issues/issue-49934.rs @@ -30,12 +30,12 @@ fn main() { #[derive(Debug)] //~ WARN unused attribute let _ = "Hello, world!"; - // fold_expr + // visit_expr let _ = #[derive(Debug)] "Hello, world!"; //~^ WARN unused attribute let _ = [ - // fold_opt_expr + // filter_map_expr #[derive(Debug)] //~ WARN unused attribute "Hello, world!" ]; diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.rs b/src/test/ui/issues/issue-52126-assign-op-invariance.rs index b974a8d4bda..c96cfdf3cd1 100644 --- a/src/test/ui/issues/issue-52126-assign-op-invariance.rs +++ b/src/test/ui/issues/issue-52126-assign-op-invariance.rs @@ -27,7 +27,7 @@ impl<'l> AddAssign for Counter<'l> } } -/// often times crashes, if not prints invalid strings +/// Often crashes, if not prints invalid strings. pub fn panics() { let mut acc = Counter{map: HashMap::new()}; for line in vec!["123456789".to_string(), "12345678".to_string()] { diff --git a/src/test/ui/issues/issue-52891.fixed b/src/test/ui/issues/issue-52891.fixed new file mode 100644 index 00000000000..e694b5c9b15 --- /dev/null +++ b/src/test/ui/issues/issue-52891.fixed @@ -0,0 +1,37 @@ +// aux-build:issue-52891.rs +// run-rustfix + +#![allow(warnings)] + +extern crate issue_52891; + +// Check that we don't suggest renaming duplicate imports but instead +// suggest removing one. + +use issue_52891::a; + //~ ERROR `a` is defined multiple times + +use issue_52891::{b, c}; //~ ERROR `a` is defined multiple times +use issue_52891::{d, e}; //~ ERROR `a` is defined multiple times +use issue_52891::{f, g}; //~ ERROR `a` is defined multiple times + +use issue_52891::{//~ ERROR `a` is defined multiple times + h, + i}; +use issue_52891::{j, + //~ ERROR `a` is defined multiple times + k}; +use issue_52891::{l, + m}; //~ ERROR `a` is defined multiple times + +use issue_52891::a::inner; +use issue_52891::b::inner as other_inner; //~ ERROR `inner` is defined multiple times + + +//~^ ERROR `issue_52891` is defined multiple times + + +#[macro_use] +use issue_52891::n; //~ ERROR `n` is defined multiple times + +fn main() {} diff --git a/src/test/ui/issues/issue-52891.rs b/src/test/ui/issues/issue-52891.rs new file mode 100644 index 00000000000..cd4b40629ab --- /dev/null +++ b/src/test/ui/issues/issue-52891.rs @@ -0,0 +1,38 @@ +// aux-build:issue-52891.rs +// run-rustfix + +#![allow(warnings)] + +extern crate issue_52891; + +// Check that we don't suggest renaming duplicate imports but instead +// suggest removing one. + +use issue_52891::a; +use issue_52891::a; //~ ERROR `a` is defined multiple times + +use issue_52891::{a, b, c}; //~ ERROR `a` is defined multiple times +use issue_52891::{d, a, e}; //~ ERROR `a` is defined multiple times +use issue_52891::{f, g, a}; //~ ERROR `a` is defined multiple times + +use issue_52891::{a, //~ ERROR `a` is defined multiple times + h, + i}; +use issue_52891::{j, + a, //~ ERROR `a` is defined multiple times + k}; +use issue_52891::{l, + m, + a}; //~ ERROR `a` is defined multiple times + +use issue_52891::a::inner; +use issue_52891::b::inner; //~ ERROR `inner` is defined multiple times + +use issue_52891::{self}; +//~^ ERROR `issue_52891` is defined multiple times + +use issue_52891::n; +#[macro_use] +use issue_52891::n; //~ ERROR `n` is defined multiple times + +fn main() {} diff --git a/src/test/ui/issues/issue-52891.stderr b/src/test/ui/issues/issue-52891.stderr new file mode 100644 index 00000000000..65b2b9460bc --- /dev/null +++ b/src/test/ui/issues/issue-52891.stderr @@ -0,0 +1,145 @@ +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:12:5 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +LL | use issue_52891::a; //~ ERROR `a` is defined multiple times + | ----^^^^^^^^^^^^^^- + | | | + | | `a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:14:19 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +... +LL | use issue_52891::{a, b, c}; //~ ERROR `a` is defined multiple times + | ^-- + | | + | `a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:15:22 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +... +LL | use issue_52891::{d, a, e}; //~ ERROR `a` is defined multiple times + | ^-- + | | + | `a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:16:25 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +... +LL | use issue_52891::{f, g, a}; //~ ERROR `a` is defined multiple times + | --^ + | | | + | | `a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:18:19 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +... +LL | use issue_52891::{a, //~ ERROR `a` is defined multiple times + | ^-- + | | + | `a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:22:5 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +... +LL | a, //~ ERROR `a` is defined multiple times + | ^-- + | | + | `a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `a` is defined multiple times + --> $DIR/issue-52891.rs:26:5 + | +LL | use issue_52891::a; + | -------------- previous import of the module `a` here +... +LL | m, + | ______- +LL | | a}; //~ ERROR `a` is defined multiple times + | | ^ + | | | + | |_____`a` reimported here + | help: remove unnecessary import + | + = note: `a` must be defined only once in the type namespace of this module + +error[E0252]: the name `inner` is defined multiple times + --> $DIR/issue-52891.rs:29:5 + | +LL | use issue_52891::a::inner; + | --------------------- previous import of the module `inner` here +LL | use issue_52891::b::inner; //~ ERROR `inner` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^ `inner` reimported here + | + = note: `inner` 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 + | +LL | use issue_52891::b::inner as other_inner; //~ ERROR `inner` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0254]: the name `issue_52891` is defined multiple times + --> $DIR/issue-52891.rs:31:19 + | +LL | extern crate issue_52891; + | ------------------------- previous import of the extern crate `issue_52891` here +... +LL | use issue_52891::{self}; + | ------------------^^^^-- + | | | + | | `issue_52891` reimported here + | help: remove unnecessary import + | + = note: `issue_52891` must be defined only once in the type namespace of this module + +error[E0252]: the name `n` is defined multiple times + --> $DIR/issue-52891.rs:36:5 + | +LL | use issue_52891::n; + | ------------------- + | | | + | | previous import of the module `n` here + | help: remove unnecessary import +LL | #[macro_use] +LL | use issue_52891::n; //~ ERROR `n` is defined multiple times + | ^^^^^^^^^^^^^^ `n` reimported here + | + = note: `n` must be defined only once in the type namespace of this module + +error: aborting due to 10 previous errors + +Some errors occurred: E0252, E0254. +For more information about an error, try `rustc --explain E0252`. diff --git a/src/test/ui/issues/issue-5997-enum.rs b/src/test/ui/issues/issue-5997-enum.rs index 0987117ecd4..3ff4e036c60 100644 --- a/src/test/ui/issues/issue-5997-enum.rs +++ b/src/test/ui/issues/issue-5997-enum.rs @@ -1,6 +1,6 @@ fn f<Z>() -> bool { enum E { V(Z) } - //~^ ERROR can't use type parameters from outer function + //~^ ERROR can't use generic parameters from outer function true } diff --git a/src/test/ui/issues/issue-5997-enum.stderr b/src/test/ui/issues/issue-5997-enum.stderr index 5c26dc92c85..5c778143e13 100644 --- a/src/test/ui/issues/issue-5997-enum.stderr +++ b/src/test/ui/issues/issue-5997-enum.stderr @@ -1,12 +1,12 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/issue-5997-enum.rs:2:16 | LL | fn f<Z>() -> bool { | - - type variable from outer function | | - | try adding a local type parameter in this method instead + | try adding a local generic parameter in this method instead LL | enum E { V(Z) } - | ^ use of type variable from outer function + | ^ use of generic parameter from outer function error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5997-struct.rs b/src/test/ui/issues/issue-5997-struct.rs index 04ac489a55c..6cf510b0a9d 100644 --- a/src/test/ui/issues/issue-5997-struct.rs +++ b/src/test/ui/issues/issue-5997-struct.rs @@ -1,5 +1,5 @@ fn f<T>() -> bool { - struct S(T); //~ ERROR can't use type parameters from outer function + struct S(T); //~ ERROR can't use generic parameters from outer function true } diff --git a/src/test/ui/issues/issue-5997-struct.stderr b/src/test/ui/issues/issue-5997-struct.stderr index 1d05d13242e..a60987b3f98 100644 --- a/src/test/ui/issues/issue-5997-struct.stderr +++ b/src/test/ui/issues/issue-5997-struct.stderr @@ -1,12 +1,12 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/issue-5997-struct.rs:2:14 | LL | fn f<T>() -> bool { | - - type variable from outer function | | - | try adding a local type parameter in this method instead -LL | struct S(T); //~ ERROR can't use type parameters from outer function - | ^ use of type variable from outer function + | try adding a local generic parameter in this method instead +LL | struct S(T); //~ ERROR can't use generic parameters from outer function + | ^ use of generic parameter from outer function error: aborting due to previous error diff --git a/src/test/ui/lifetime-before-type-params.stderr b/src/test/ui/lifetime-before-type-params.stderr index 7ac8dffdfbe..3cef5db66c6 100644 --- a/src/test/ui/lifetime-before-type-params.stderr +++ b/src/test/ui/lifetime-before-type-params.stderr @@ -2,41 +2,25 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/lifetime-before-type-params.rs:2:13 | LL | fn first<T, 'a, 'b>() {} - | ^^ ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | fn first<'a, 'b, T>() {} - | ^^^ ^^^ -- + | ----^^--^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: lifetime parameters must be declared prior to type parameters --> $DIR/lifetime-before-type-params.rs:4:18 | LL | fn second<'a, T, 'b>() {} - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | fn second<'a, 'b, T>() {} - | ^^^ -- + | --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: lifetime parameters must be declared prior to type parameters --> $DIR/lifetime-before-type-params.rs:6:16 | LL | fn third<T, U, 'a>() {} - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | fn third<'a, T, U>() {} - | ^^^ -- + | -------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/lifetime-before-type-params.rs:8:18 | LL | fn fourth<'a, T, 'b, U, 'c, V>() {} - | ^^ ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | fn fourth<'a, 'b, 'c, T, U, V>() {} - | ^^^ ^^^ -- -- + | --------^^-----^^---- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, 'c, T, U, V>` error[E0601]: `main` function not found in crate `lifetime_before_type_params` | diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr index 170b98a12a8..e588d24517c 100644 --- a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr +++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr @@ -2,7 +2,7 @@ error: unused import: `a::x` --> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9 | LL | use a::x; //~ ERROR: unused import - | ^^^^ + | ----^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9 @@ -14,7 +14,7 @@ error: unused import: `a::y` --> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9 | LL | use a::y; //~ ERROR: unused import - | ^^^^ + | ----^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12 diff --git a/src/test/ui/lint/lint-unused-imports.rs b/src/test/ui/lint/lint-unused-imports.rs index 489252479fe..9c5b206203c 100644 --- a/src/test/ui/lint/lint-unused-imports.rs +++ b/src/test/ui/lint/lint-unused-imports.rs @@ -6,7 +6,7 @@ use bar::c::cc as cal; use std::mem::*; // shouldn't get errors for not using // everything imported use std::fmt::{}; -//~^ ERROR unused import: `use std::fmt::{};` +//~^ ERROR unused import: `std::fmt::{}` // Should get errors for both 'Some' and 'None' use std::option::Option::{Some, None}; diff --git a/src/test/ui/lint/lint-unused-imports.stderr b/src/test/ui/lint/lint-unused-imports.stderr index 214f4a472dc..7970b0201db 100644 --- a/src/test/ui/lint/lint-unused-imports.stderr +++ b/src/test/ui/lint/lint-unused-imports.stderr @@ -1,8 +1,8 @@ -error: unused import: `use std::fmt::{};` - --> $DIR/lint-unused-imports.rs:8:1 +error: unused import: `std::fmt::{}` + --> $DIR/lint-unused-imports.rs:8:5 | LL | use std::fmt::{}; - | ^^^^^^^^^^^^^^^^^ + | ----^^^^^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/lint-unused-imports.rs:1:9 @@ -14,37 +14,39 @@ error: unused imports: `None`, `Some` --> $DIR/lint-unused-imports.rs:12:27 | LL | use std::option::Option::{Some, None}; - | ^^^^ ^^^^ + | --------------------------^^^^--^^^^-- help: remove the whole `use` item error: unused import: `test::A` --> $DIR/lint-unused-imports.rs:15:5 | LL | use test::A; //~ ERROR unused import: `test::A` - | ^^^^^^^ + | ----^^^^^^^- help: remove the whole `use` item error: unused import: `bar` --> $DIR/lint-unused-imports.rs:24:18 | LL | use test2::{foo, bar}; //~ ERROR unused import: `bar` - | ^^^ + | --^^^ + | | + | help: remove the unused import error: unused import: `foo::Square` --> $DIR/lint-unused-imports.rs:52:13 | LL | use foo::Square; //~ ERROR unused import: `foo::Square` - | ^^^^^^^^^^^ + | ----^^^^^^^^^^^- help: remove the whole `use` item error: unused import: `self::g` --> $DIR/lint-unused-imports.rs:68:9 | LL | use self::g; //~ ERROR unused import: `self::g` - | ^^^^^^^ + | ----^^^^^^^- help: remove the whole `use` item error: unused import: `test2::foo` --> $DIR/lint-unused-imports.rs:77:9 | LL | use test2::foo; //~ ERROR unused import: `test2::foo` - | ^^^^^^^^^^ + | ----^^^^^^^^^^- help: remove the whole `use` item error: unused import: `test::B2` --> $DIR/lint-unused-imports.rs:20:5 diff --git a/src/test/ui/lint/lints-in-foreign-macros.stderr b/src/test/ui/lint/lints-in-foreign-macros.stderr index 8287ca5692b..b808ca708a3 100644 --- a/src/test/ui/lint/lints-in-foreign-macros.stderr +++ b/src/test/ui/lint/lints-in-foreign-macros.stderr @@ -2,7 +2,7 @@ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:11:16 | LL | () => {use std::string::ToString;} //~ WARN: unused import - | ^^^^^^^^^^^^^^^^^^^^^ + | ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item ... LL | mod a { foo!(); } | ------- in this macro invocation @@ -17,13 +17,13 @@ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:16:18 | LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import - | ^^^^^^^^^^^^^^^^^^^^^ + | ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:17:19 | LL | mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import - | ^^^^^^^^^^^^^^^^^^^^^ + | ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item warning: missing documentation for crate --> $DIR/lints-in-foreign-macros.rs:4:1 diff --git a/src/test/ui/macros/macro-follow.rs b/src/test/ui/macros/macro-follow.rs index f4a1931da5a..10b44e00175 100644 --- a/src/test/ui/macros/macro-follow.rs +++ b/src/test/ui/macros/macro-follow.rs @@ -12,11 +12,11 @@ macro_rules! follow_pat { ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` - ($p:pat $p:pat) => {}; //~ERROR `$p:pat` is followed by `$p:pat` + ($p:pat $q:pat) => {}; //~ERROR `$p:pat` is followed by `$q:pat` ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` - ($p:pat $p:path) => {}; //~ERROR `$p:pat` is followed by `$p:path` + ($p:pat $q:path) => {}; //~ERROR `$p:pat` is followed by `$q:path` ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` @@ -37,7 +37,7 @@ macro_rules! follow_expr { ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` - ($e:expr $e:expr) => {}; //~ERROR `$e:expr` is followed by `$e:expr` + ($e:expr $f:expr) => {}; //~ERROR `$e:expr` is followed by `$f:expr` ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` @@ -57,12 +57,12 @@ macro_rules! follow_ty { ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` - ($t:ty $t:ty) => {}; //~ERROR `$t:ty` is followed by `$t:ty` + ($t:ty $r:ty) => {}; //~ERROR `$t:ty` is followed by `$r:ty` ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` ($t:ty $b:block) => {}; // ok (RFC 1494) ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` - ($t:ty $t:tt) => {}; //~ERROR `$t:ty` is followed by `$t:tt` + ($t:ty $r:tt) => {}; //~ERROR `$t:ty` is followed by `$r:tt` ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` } @@ -82,7 +82,7 @@ macro_rules! follow_stmt { ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` - ($s:stmt $s:stmt) => {}; //~ERROR `$s:stmt` is followed by `$s:stmt` + ($s:stmt $t:stmt) => {}; //~ERROR `$s:stmt` is followed by `$t:stmt` ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` @@ -97,11 +97,11 @@ macro_rules! follow_path { ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` - ($p:path $p:pat) => {}; //~ERROR `$p:path` is followed by `$p:pat` + ($p:path $q:pat) => {}; //~ERROR `$p:path` is followed by `$q:pat` ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` - ($p:path $p:path) => {}; //~ERROR `$p:path` is followed by `$p:path` + ($p:path $q:path) => {}; //~ERROR `$p:path` is followed by `$q:path` ($p:path $b:block) => {}; // ok (RFC 1494) ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` diff --git a/src/test/ui/macros/macro-follow.stderr b/src/test/ui/macros/macro-follow.stderr index 4aea5cc5de6..e3302eac4ac 100644 --- a/src/test/ui/macros/macro-follow.stderr +++ b/src/test/ui/macros/macro-follow.stderr @@ -54,10 +54,10 @@ LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` -error: `$p:pat` is followed by `$p:pat`, which is not allowed for `pat` fragments +error: `$p:pat` is followed by `$q:pat`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:15:13 | -LL | ($p:pat $p:pat) => {}; //~ERROR `$p:pat` is followed by `$p:pat` +LL | ($p:pat $q:pat) => {}; //~ERROR `$p:pat` is followed by `$q:pat` | ^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -86,10 +86,10 @@ LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` -error: `$p:pat` is followed by `$p:path`, which is not allowed for `pat` fragments +error: `$p:pat` is followed by `$q:path`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:19:13 | -LL | ($p:pat $p:path) => {}; //~ERROR `$p:pat` is followed by `$p:path` +LL | ($p:pat $q:path) => {}; //~ERROR `$p:pat` is followed by `$q:path` | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -230,10 +230,10 @@ LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` | = note: allowed there are: `=>`, `,` or `;` -error: `$e:expr` is followed by `$e:expr`, which is not allowed for `expr` fragments +error: `$e:expr` is followed by `$f:expr`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:40:14 | -LL | ($e:expr $e:expr) => {}; //~ERROR `$e:expr` is followed by `$e:expr` +LL | ($e:expr $f:expr) => {}; //~ERROR `$e:expr` is followed by `$f:expr` | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -350,10 +350,10 @@ LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` -error: `$t:ty` is followed by `$t:ty`, which is not allowed for `ty` fragments +error: `$t:ty` is followed by `$r:ty`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:60:12 | -LL | ($t:ty $t:ty) => {}; //~ERROR `$t:ty` is followed by `$t:ty` +LL | ($t:ty $r:ty) => {}; //~ERROR `$t:ty` is followed by `$r:ty` | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -382,10 +382,10 @@ LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` -error: `$t:ty` is followed by `$t:tt`, which is not allowed for `ty` fragments +error: `$t:ty` is followed by `$r:tt`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:65:12 | -LL | ($t:ty $t:tt) => {}; //~ERROR `$t:ty` is followed by `$t:tt` +LL | ($t:ty $r:tt) => {}; //~ERROR `$t:ty` is followed by `$r:tt` | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -518,10 +518,10 @@ LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` | = note: allowed there are: `=>`, `,` or `;` -error: `$s:stmt` is followed by `$s:stmt`, which is not allowed for `stmt` fragments +error: `$s:stmt` is followed by `$t:stmt`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:85:14 | -LL | ($s:stmt $s:stmt) => {}; //~ERROR `$s:stmt` is followed by `$s:stmt` +LL | ($s:stmt $t:stmt) => {}; //~ERROR `$s:stmt` is followed by `$t:stmt` | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -606,10 +606,10 @@ LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` -error: `$p:path` is followed by `$p:pat`, which is not allowed for `path` fragments +error: `$p:path` is followed by `$q:pat`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:100:14 | -LL | ($p:path $p:pat) => {}; //~ERROR `$p:path` is followed by `$p:pat` +LL | ($p:path $q:pat) => {}; //~ERROR `$p:path` is followed by `$q:pat` | ^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -638,10 +638,10 @@ LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` -error: `$p:path` is followed by `$p:path`, which is not allowed for `path` fragments +error: `$p:path` is followed by `$q:path`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:104:14 | -LL | ($p:path $p:path) => {}; //~ERROR `$p:path` is followed by `$p:path` +LL | ($p:path $q:path) => {}; //~ERROR `$p:path` is followed by `$q:path` | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.rs b/src/test/ui/macros/macro-multiple-matcher-bindings.rs new file mode 100644 index 00000000000..9e0fa388716 --- /dev/null +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.rs @@ -0,0 +1,25 @@ +// Test that duplicate matcher binding names are caught at declaration time, rather than at macro +// invocation time. +// +// FIXME(mark-i-m): Update this when it becomes a hard error. + +// compile-pass + +#![allow(unused_macros)] + +macro_rules! foo1 { + ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding + ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding +} + +macro_rules! foo2 { + ($a:ident) => {}; // OK + ($a:path) => {}; // OK +} + +macro_rules! foo3 { + ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding + ($($a:ident)+ # $($($a:path),+);*) => {}; //~WARNING duplicate matcher binding +} + +fn main() {} diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr new file mode 100644 index 00000000000..bc78b471a2d --- /dev/null +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr @@ -0,0 +1,37 @@ +warning: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:11:6 + | +LL | ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding + | ^^^^^^^^ ^^^^^^^^ + | + = note: #[warn(duplicate_matcher_binding_name)] 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 #57593 <https://github.com/rust-lang/rust/issues/57593> + +warning: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:12:6 + | +LL | ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding + | ^^^^^^^^ ^^^^^^^ + | + = 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 #57593 <https://github.com/rust-lang/rust/issues/57593> + +warning: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:21:6 + | +LL | ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding + | ^^^^^^^^ ^^^^^^^^ + | + = 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 #57593 <https://github.com/rust-lang/rust/issues/57593> + +warning: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:22:8 + | +LL | ($($a:ident)+ # $($($a:path),+);*) => {}; //~WARNING duplicate matcher binding + | ^^^^^^^^ ^^^^^^^ + | + = 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 #57593 <https://github.com/rust-lang/rust/issues/57593> + diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs new file mode 100644 index 00000000000..a5dae1c71cd --- /dev/null +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs @@ -0,0 +1,177 @@ +#![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize, unsized_locals)] + +// This tests a few edge-cases around `arbitrary_self_types`. Most specifically, +// it checks that the `ObjectCandidate` you get from method matching can't +// match a trait with the same DefId as a supertrait but a bad type parameter. + +use std::marker::PhantomData; + +mod internal { + use std::ops::{CoerceUnsized, Deref, DispatchFromDyn}; + use std::marker::{PhantomData, Unsize}; + + pub struct Smaht<T: ?Sized, MISC>(pub Box<T>, pub PhantomData<MISC>); + + impl<T: ?Sized, MISC> Deref for Smaht<T, MISC> { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } + } + impl<T: ?Sized + Unsize<U>, U: ?Sized, MISC> CoerceUnsized<Smaht<U, MISC>> + for Smaht<T, MISC> + {} + impl<T: ?Sized + Unsize<U>, U: ?Sized, MISC> DispatchFromDyn<Smaht<U, MISC>> + for Smaht<T, MISC> + {} + + pub trait Foo: X<u32> {} + pub trait X<T> { + fn foo(self: Smaht<Self, T>) -> T; + } + + impl X<u32> for () { + fn foo(self: Smaht<Self, u32>) -> u32 { + 0 + } + } + + pub trait Marker {} + impl Marker for dyn Foo {} + impl<T: Marker + ?Sized> X<u64> for T { + fn foo(self: Smaht<Self, u64>) -> u64 { + 1 + } + } + + impl Deref for dyn Foo { + type Target = (); + fn deref(&self) -> &() { &() } + } + + impl Foo for () {} +} + +pub trait FinalFoo { + fn foo(&self) -> u8; +} + +impl FinalFoo for () { + fn foo(&self) -> u8 { 0 } +} + +mod nuisance_foo { + pub trait NuisanceFoo { + fn foo(self); + } + + impl<T: ?Sized> NuisanceFoo for T { + fn foo(self) {} + } +} + + +fn objectcandidate_impl() { + let x: internal::Smaht<(), u32> = internal::Smaht(Box::new(()), PhantomData); + let x: internal::Smaht<dyn internal::Foo, u32> = x; + + // This picks `<dyn internal::Foo as X<u32>>::foo` via `ObjectCandidate`. + // + // The `TraitCandidate` is not relevant because `X` is not in scope. + let z = x.foo(); + + // Observe the type of `z` is `u32` + let _seetype: () = z; //~ ERROR mismatched types + //~| expected (), found u32 +} + +fn traitcandidate_impl() { + use internal::X; + + let x: internal::Smaht<(), u64> = internal::Smaht(Box::new(()), PhantomData); + let x: internal::Smaht<dyn internal::Foo, u64> = x; + + // This picks `<dyn internal::Foo as X<u64>>::foo` via `TraitCandidate`. + // + // The `ObjectCandidate` does not apply, as it only applies to + // `X<u32>` (and not `X<u64>`). + let z = x.foo(); + + // Observe the type of `z` is `u64` + let _seetype: () = z; //~ ERROR mismatched types + //~| expected (), found u64 +} + +fn traitcandidate_impl_with_nuisance() { + use internal::X; + use nuisance_foo::NuisanceFoo; + + let x: internal::Smaht<(), u64> = internal::Smaht(Box::new(()), PhantomData); + let x: internal::Smaht<dyn internal::Foo, u64> = x; + + // This picks `<dyn internal::Foo as X<u64>>::foo` via `TraitCandidate`. + // + // The `ObjectCandidate` does not apply, as it only applies to + // `X<u32>` (and not `X<u64>`). + // + // The NuisanceFoo impl has the same priority as the `X` impl, + // so we get a conflict. + let z = x.foo(); //~ ERROR multiple applicable items in scope +} + + +fn neither_impl() { + let x: internal::Smaht<(), u64> = internal::Smaht(Box::new(()), PhantomData); + let x: internal::Smaht<dyn internal::Foo, u64> = x; + + // This can't pick the `TraitCandidate` impl, because `Foo` is not + // imported. However, this also can't pick the `ObjectCandidate` + // impl, because it only applies to `X<u32>` (and not `X<u64>`). + // + // Therefore, neither of the candidates is applicable, and we pick + // the `FinalFoo` impl after another deref, which will return `u8`. + let z = x.foo(); + + // Observe the type of `z` is `u8` + let _seetype: () = z; //~ ERROR mismatched types + //~| expected (), found u8 +} + +fn both_impls() { + use internal::X; + + let x: internal::Smaht<(), u32> = internal::Smaht(Box::new(()), PhantomData); + let x: internal::Smaht<dyn internal::Foo, u32> = x; + + // This can pick both the `TraitCandidate` and the `ObjectCandidate` impl. + // + // However, the `ObjectCandidate` is considered an "inherent candidate", + // and therefore has priority over both the `TraitCandidate` as well as + // any other "nuisance" candidate" (if present). + let z = x.foo(); + + // Observe the type of `z` is `u32` + let _seetype: () = z; //~ ERROR mismatched types + //~| expected (), found u32 +} + + +fn both_impls_with_nuisance() { + // Similar to the `both_impls` example, except with a nuisance impl to + // make sure the `ObjectCandidate` indeed has a higher priority. + + use internal::X; + use nuisance_foo::NuisanceFoo; + + let x: internal::Smaht<(), u32> = internal::Smaht(Box::new(()), PhantomData); + let x: internal::Smaht<dyn internal::Foo, u32> = x; + let z = x.foo(); + + // Observe the type of `z` is `u32` + let _seetype: () = z; //~ ERROR mismatched types + //~| expected (), found u32 +} + +fn main() { +} diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr new file mode 100644 index 00000000000..2d8449b96de --- /dev/null +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -0,0 +1,72 @@ +error[E0308]: mismatched types + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24 + | +LL | let _seetype: () = z; //~ ERROR mismatched types + | ^ expected (), found u32 + | + = note: expected type `()` + found type `u32` + +error[E0308]: mismatched types + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24 + | +LL | let _seetype: () = z; //~ ERROR mismatched types + | ^ expected (), found u64 + | + = note: expected type `()` + found type `u64` + +error[E0034]: multiple applicable items in scope + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15 + | +LL | let z = x.foo(); //~ ERROR multiple applicable items in scope + | ^^^ multiple `foo` found + | +note: candidate #1 is defined in an impl of the trait `internal::X` for the type `_` + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:43:9 + | +LL | fn foo(self: Smaht<Self, u64>) -> u64 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `nuisance_foo::NuisanceFoo` for the type `_` + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:70:9 + | +LL | fn foo(self) {} + | ^^^^^^^^^^^^ +note: candidate #3 is defined in the trait `FinalFoo` + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:57:5 + | +LL | fn foo(&self) -> u8; + | ^^^^^^^^^^^^^^^^^^^^ + = help: to disambiguate the method call, write `FinalFoo::foo(x)` instead + +error[E0308]: mismatched types + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24 + | +LL | let _seetype: () = z; //~ ERROR mismatched types + | ^ expected (), found u8 + | + = note: expected type `()` + found type `u8` + +error[E0308]: mismatched types + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24 + | +LL | let _seetype: () = z; //~ ERROR mismatched types + | ^ expected (), found u32 + | + = note: expected type `()` + found type `u32` + +error[E0308]: mismatched types + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24 + | +LL | let _seetype: () = z; //~ ERROR mismatched types + | ^ expected (), found u32 + | + = note: expected type `()` + found type `u32` + +error: aborting due to 6 previous errors + +Some errors occurred: E0034, E0308. +For more information about an error, try `rustc --explain E0034`. diff --git a/src/test/ui/methods/method-trait-object-with-hrtb.rs b/src/test/ui/methods/method-trait-object-with-hrtb.rs new file mode 100644 index 00000000000..da2f13f5a2f --- /dev/null +++ b/src/test/ui/methods/method-trait-object-with-hrtb.rs @@ -0,0 +1,41 @@ +// compile-pass + +// Check that method probing ObjectCandidate works in the presence of +// auto traits and/or HRTBs. + +mod internal { + pub trait MyObject<'a> { + type Output; + + fn foo(&self) -> Self::Output; + } + + impl<'a> MyObject<'a> for () { + type Output = &'a u32; + + fn foo(&self) -> Self::Output { &4 } + } +} + +fn t1(d: &dyn for<'a> internal::MyObject<'a, Output=&'a u32>) { + d.foo(); +} + +fn t2(d: &dyn internal::MyObject<'static, Output=&'static u32>) { + d.foo(); +} + +fn t3(d: &(dyn for<'a> internal::MyObject<'a, Output=&'a u32> + Sync)) { + d.foo(); +} + +fn t4(d: &(dyn internal::MyObject<'static, Output=&'static u32> + Sync)) { + d.foo(); +} + +fn main() { + t1(&()); + t2(&()); + t3(&()); + t4(&()); +} diff --git a/src/test/ui/nested-ty-params.rs b/src/test/ui/nested-ty-params.rs index 102f8d02ee4..85413acdb14 100644 --- a/src/test/ui/nested-ty-params.rs +++ b/src/test/ui/nested-ty-params.rs @@ -1,4 +1,4 @@ -// error-pattern:can't use type parameters from outer function +// error-pattern:can't use generic parameters from outer function fn hd<U>(v: Vec<U> ) -> U { fn hd1(w: [U]) -> U { return w[0]; } diff --git a/src/test/ui/nested-ty-params.stderr b/src/test/ui/nested-ty-params.stderr index 617eddf6525..37adeffb9b0 100644 --- a/src/test/ui/nested-ty-params.stderr +++ b/src/test/ui/nested-ty-params.stderr @@ -1,22 +1,22 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/nested-ty-params.rs:3:16 | LL | fn hd<U>(v: Vec<U> ) -> U { | - type variable from outer function LL | fn hd1(w: [U]) -> U { return w[0]; } - | --- ^ use of type variable from outer function + | --- ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `hd1<U>` + | help: try using a local generic parameter instead: `hd1<U>` -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/nested-ty-params.rs:3:23 | LL | fn hd<U>(v: Vec<U> ) -> U { | - type variable from outer function LL | fn hd1(w: [U]) -> U { return w[0]; } - | --- ^ use of type variable from outer function + | --- ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `hd1<U>` + | help: try using a local generic parameter instead: `hd1<U>` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/issue-57960.rs b/src/test/ui/nll/issue-57960.rs new file mode 100644 index 00000000000..0b52e46c459 --- /dev/null +++ b/src/test/ui/nll/issue-57960.rs @@ -0,0 +1,39 @@ +// run-pass + +#![allow(dead_code)] + +trait Range { + const FIRST: u8; + const LAST: u8; +} + +struct OneDigit; +impl Range for OneDigit { + const FIRST: u8 = 0; + const LAST: u8 = 9; +} + +struct TwoDigits; +impl Range for TwoDigits { + const FIRST: u8 = 10; + const LAST: u8 = 99; +} + +struct ThreeDigits; +impl Range for ThreeDigits { + const FIRST: u8 = 100; + const LAST: u8 = 255; +} + +fn digits(x: u8) -> u32 { + match x { + OneDigit::FIRST...OneDigit::LAST => 1, + TwoDigits::FIRST...TwoDigits::LAST => 2, + ThreeDigits::FIRST...ThreeDigits::LAST => 3, + _ => unreachable!(), + } +} + +fn main() { + assert_eq!(digits(100), 3); +} diff --git a/src/test/ui/nll/issue-58053.rs b/src/test/ui/nll/issue-58053.rs new file mode 100644 index 00000000000..d4338905ed2 --- /dev/null +++ b/src/test/ui/nll/issue-58053.rs @@ -0,0 +1,14 @@ +#![allow(warnings)] +#![feature(nll)] + +fn main() { + let i = &3; + + let f = |x: &i32| -> &i32 { x }; + //~^ ERROR lifetime may not live long enough + let j = f(i); + + let g = |x: &i32| { x }; + //~^ ERROR lifetime may not live long enough + let k = g(i); +} diff --git a/src/test/ui/nll/issue-58053.stderr b/src/test/ui/nll/issue-58053.stderr new file mode 100644 index 00000000000..9048983318b --- /dev/null +++ b/src/test/ui/nll/issue-58053.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/issue-58053.rs:7:33 + | +LL | let f = |x: &i32| -> &i32 { x }; + | - ---- ^ returning this value requires that `'1` must outlive `'2` + | | | + | | return type of closure is &'2 i32 + | let's call the lifetime of this reference `'1` + +error: lifetime may not live long enough + --> $DIR/issue-58053.rs:11:25 + | +LL | let g = |x: &i32| { x }; + | - - ^ returning this value requires that `'1` must outlive `'2` + | | | + | | return type of closure is &'2 i32 + | let's call the lifetime of this reference `'1` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/user-annotations/issue-55241.rs b/src/test/ui/nll/user-annotations/issue-55241.rs index e5600803df8..d7686b9dc94 100644 --- a/src/test/ui/nll/user-annotations/issue-55241.rs +++ b/src/test/ui/nll/user-annotations/issue-55241.rs @@ -18,7 +18,7 @@ pub trait NodeCodec<H: Hasher> { } pub trait Trie<H: Hasher, C: NodeCodec<H>> { - /// Return the root of the trie. + /// Returns the root of the trie. fn root(&self) -> &H::Out; /// Is the trie empty? diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs index 6843c4bfa99..846db63024c 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.rs +++ b/src/test/ui/on-unimplemented/bad-annotation.rs @@ -10,7 +10,7 @@ trait Foo<Bar, Baz, Quux> #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] trait MyFromIterator<A> { - /// Build a container with elements from an external iterator. + /// Builds a container with elements from an external iterator. fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self; } diff --git a/src/test/ui/on-unimplemented/on-trait.rs b/src/test/ui/on-unimplemented/on-trait.rs index 22afda16f43..109cb5ba969 100644 --- a/src/test/ui/on-unimplemented/on-trait.rs +++ b/src/test/ui/on-unimplemented/on-trait.rs @@ -15,7 +15,7 @@ fn foobar<U: Clone, T: Foo<u8, U, u32>>() -> T { #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] trait MyFromIterator<A> { - /// Build a container with elements from an external iterator. + /// Builds a container with elements from an external iterator. fn my_from_iter<T: Iterator<Item=A>>(iterator: T) -> Self; } diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index 92d8cbc100a..76f7af38e77 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -1,3 +1,9 @@ +error: unexpected token: `;` + --> $DIR/parser-recovery-2.rs:12:15 + | +LL | let x = y.; //~ ERROR unexpected token + | ^ + error: incorrect close delimiter: `)` --> $DIR/parser-recovery-2.rs:8:5 | @@ -7,12 +13,6 @@ LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope LL | ) //~ ERROR incorrect close delimiter: `)` | ^ incorrect close delimiter -error: unexpected token: `;` - --> $DIR/parser-recovery-2.rs:12:15 - | -LL | let x = y.; //~ ERROR unexpected token - | ^ - error[E0425]: cannot find function `foo` in this scope --> $DIR/parser-recovery-2.rs:7:17 | diff --git a/src/test/ui/parser/bounds-lifetime.rs b/src/test/ui/parser/bounds-lifetime.rs index 89a969bb2e2..9225cfce94e 100644 --- a/src/test/ui/parser/bounds-lifetime.rs +++ b/src/test/ui/parser/bounds-lifetime.rs @@ -6,6 +6,6 @@ type A = for<'a: 'b + 'c> fn(); // OK (rejected later by ast_validation) type A = for<'a: 'b,> fn(); // OK(rejected later by ast_validation) type A = for<'a: 'b +> fn(); // OK (rejected later by ast_validation) type A = for<'a, T> fn(); // OK (rejected later by ast_validation) -type A = for<,> fn(); //~ ERROR expected one of `>`, identifier, or lifetime, found `,` +type A = for<,> fn(); //~ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,` fn main() {} diff --git a/src/test/ui/parser/bounds-lifetime.stderr b/src/test/ui/parser/bounds-lifetime.stderr index f39e5beb6ac..191ea3ebd07 100644 --- a/src/test/ui/parser/bounds-lifetime.stderr +++ b/src/test/ui/parser/bounds-lifetime.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, or lifetime, found `,` +error: expected one of `>`, `const`, identifier, or lifetime, found `,` --> $DIR/bounds-lifetime.rs:9:14 | -LL | type A = for<,> fn(); //~ ERROR expected one of `>`, identifier, or lifetime, found `,` - | ^ expected one of `>`, identifier, or lifetime here +LL | type A = for<,> fn(); //~ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,` + | ^ expected one of `>`, `const`, identifier, or lifetime here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-10636-2.rs b/src/test/ui/parser/issue-10636-2.rs index a02fd41b349..6fb63639d5f 100644 --- a/src/test/ui/parser/issue-10636-2.rs +++ b/src/test/ui/parser/issue-10636-2.rs @@ -5,7 +5,7 @@ pub fn trace_option(option: Option<isize>) { option.map(|some| 42; //~^ ERROR: expected one of -} //~ ERROR: incorrect close delimiter +} //~^ ERROR: expected expression, found `)` fn main() {} diff --git a/src/test/ui/parser/issue-10636-2.stderr b/src/test/ui/parser/issue-10636-2.stderr index 9b3115cb3f4..38d57ce5723 100644 --- a/src/test/ui/parser/issue-10636-2.stderr +++ b/src/test/ui/parser/issue-10636-2.stderr @@ -1,25 +1,17 @@ -error: incorrect close delimiter: `}` - --> $DIR/issue-10636-2.rs:8:1 - | -LL | pub fn trace_option(option: Option<isize>) { - | - close delimiter possibly meant for this -LL | option.map(|some| 42; - | - un-closed delimiter -... -LL | } //~ ERROR: incorrect close delimiter - | ^ incorrect close delimiter - error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` --> $DIR/issue-10636-2.rs:5:25 | LL | option.map(|some| 42; - | ^ expected one of `)`, `,`, `.`, `?`, or an operator here + | - ^ + | | | + | | help: `)` may belong here + | unclosed delimiter error: expected expression, found `)` --> $DIR/issue-10636-2.rs:8:1 | -LL | } //~ ERROR: incorrect close delimiter +LL | } | ^ expected expression -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issue-14303-enum.stderr b/src/test/ui/parser/issue-14303-enum.stderr index a31429e7228..bcecd75b1ab 100644 --- a/src/test/ui/parser/issue-14303-enum.stderr +++ b/src/test/ui/parser/issue-14303-enum.stderr @@ -2,11 +2,7 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/issue-14303-enum.rs:1:15 | LL | enum X<'a, T, 'b> { - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | enum X<'a, 'b, T> { - | ^^^ -- + | --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-fn-def.stderr b/src/test/ui/parser/issue-14303-fn-def.stderr index 4582aeef428..082c37e0be7 100644 --- a/src/test/ui/parser/issue-14303-fn-def.stderr +++ b/src/test/ui/parser/issue-14303-fn-def.stderr @@ -2,11 +2,7 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/issue-14303-fn-def.rs:1:15 | LL | fn foo<'a, T, 'b>(x: &'a T) {} - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | fn foo<'a, 'b, T>(x: &'a T) {} - | ^^^ -- + | --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-fncall.rs b/src/test/ui/parser/issue-14303-fncall.rs index 17b9b766b21..39694198cdb 100644 --- a/src/test/ui/parser/issue-14303-fncall.rs +++ b/src/test/ui/parser/issue-14303-fncall.rs @@ -11,7 +11,7 @@ fn foo<'a, 'b>(start: &'a usize, end: &'a usize) { let _x = (*start..*end) .map(|x| S { a: start, b: end }) .collect::<Vec<S<_, 'a>>>(); - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime arguments must be declared prior to type arguments } fn main() {} diff --git a/src/test/ui/parser/issue-14303-fncall.stderr b/src/test/ui/parser/issue-14303-fncall.stderr index 2a736491594..8ef9f1a1a6c 100644 --- a/src/test/ui/parser/issue-14303-fncall.stderr +++ b/src/test/ui/parser/issue-14303-fncall.stderr @@ -1,12 +1,8 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime arguments must be declared prior to type arguments --> $DIR/issue-14303-fncall.rs:13:29 | LL | .collect::<Vec<S<_, 'a>>>(); - | ^^ must be declared prior to type parameters -help: move the lifetime parameter prior to the first type parameter - | -LL | .collect::<Vec<S<'a, _>>>(); - | ^^^ -- + | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-impl.stderr b/src/test/ui/parser/issue-14303-impl.stderr index a1953396153..3b5615d2a9e 100644 --- a/src/test/ui/parser/issue-14303-impl.stderr +++ b/src/test/ui/parser/issue-14303-impl.stderr @@ -2,11 +2,7 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/issue-14303-impl.rs:3:13 | LL | impl<'a, T, 'b> X<T> {} - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | impl<'a, 'b, T> X<T> {} - | ^^^ -- + | --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-path.rs b/src/test/ui/parser/issue-14303-path.rs index a08c89f3437..386d19859e4 100644 --- a/src/test/ui/parser/issue-14303-path.rs +++ b/src/test/ui/parser/issue-14303-path.rs @@ -8,6 +8,6 @@ mod foo { } fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} -//~^ ERROR lifetime parameters must be declared prior to type parameters +//~^ ERROR lifetime arguments must be declared prior to type arguments fn main() {} diff --git a/src/test/ui/parser/issue-14303-path.stderr b/src/test/ui/parser/issue-14303-path.stderr index fb4fb32e11e..19f2995ebee 100644 --- a/src/test/ui/parser/issue-14303-path.stderr +++ b/src/test/ui/parser/issue-14303-path.stderr @@ -1,14 +1,8 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime arguments must be declared prior to type arguments --> $DIR/issue-14303-path.rs:10:40 | LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} - | ^^ ^^ must be declared prior to type parameters - | | - | must be declared prior to type parameters -help: move the lifetime parameters prior to the first type parameter - | -LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, 'b, 'c, T>) {} - | ^^^ ^^^ -- + | ^^ ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-struct.stderr b/src/test/ui/parser/issue-14303-struct.stderr index 668b8d1de68..dbd0b987dd1 100644 --- a/src/test/ui/parser/issue-14303-struct.stderr +++ b/src/test/ui/parser/issue-14303-struct.stderr @@ -2,11 +2,7 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/issue-14303-struct.rs:1:17 | LL | struct X<'a, T, 'b> { - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | struct X<'a, 'b, T> { - | ^^^ -- + | --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-trait.stderr b/src/test/ui/parser/issue-14303-trait.stderr index 11ce0c44351..7dfa62d823f 100644 --- a/src/test/ui/parser/issue-14303-trait.stderr +++ b/src/test/ui/parser/issue-14303-trait.stderr @@ -2,11 +2,7 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/issue-14303-trait.rs:1:18 | LL | trait Foo<'a, T, 'b> {} - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | trait Foo<'a, 'b, T> {} - | ^^^ -- + | --------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T>` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32214.rs b/src/test/ui/parser/issue-32214.rs index 7e55bc038e7..7191a3234c0 100644 --- a/src/test/ui/parser/issue-32214.rs +++ b/src/test/ui/parser/issue-32214.rs @@ -3,6 +3,6 @@ trait Trait<T> { type Item; } pub fn test<W, I: Trait<Item=(), W> >() {} -//~^ ERROR type parameters must be declared prior to associated type bindings +//~^ ERROR associated type bindings must be declared after generic parameters fn main() { } diff --git a/src/test/ui/parser/issue-32214.stderr b/src/test/ui/parser/issue-32214.stderr index 660e517c85a..7022019a22f 100644 --- a/src/test/ui/parser/issue-32214.stderr +++ b/src/test/ui/parser/issue-32214.stderr @@ -1,12 +1,10 @@ -error: type parameters must be declared prior to associated type bindings - --> $DIR/issue-32214.rs:5:34 +error: associated type bindings must be declared after generic parameters + --> $DIR/issue-32214.rs:5:25 | LL | pub fn test<W, I: Trait<Item=(), W> >() {} - | ^ must be declared prior to associated type bindings -help: move the type parameter prior to the first associated type binding - | -LL | pub fn test<W, I: Trait<W, Item=()> >() {} - | ^^ -- + | -------^^^ + | | + | this associated type binding should be moved after the generic parameters error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr index 805ba8b6baa..abb08209795 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,3 +1,9 @@ +error: unexpected close delimiter: `}` + --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 + | +LL | } //~ ERROR unexpected close delimiter: `}` + | ^ unexpected close delimiter + error: incorrect close delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:4:5 | @@ -7,11 +13,5 @@ LL | bar, "baz", 1, 2.0 LL | } //~ ERROR incorrect close delimiter | ^ incorrect close delimiter -error: unexpected close delimiter: `}` - --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 - | -LL | } //~ ERROR unexpected close delimiter: `}` - | ^ unexpected close delimiter - error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs b/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs index 12de76d9d6d..79d51f5595d 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs +++ b/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs @@ -1 +1 @@ -type mut_box = Box<mut isize>; //~ ERROR expected one of `>`, lifetime, or type, found `mut` +type mut_box = Box<mut isize>; //~ ERROR expected one of `>`, const, lifetime, or type, found `mut` diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr index 0177b19d74e..b2759778d03 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, lifetime, or type, found `mut` +error: expected one of `>`, const, lifetime, or type, found `mut` --> $DIR/removed-syntax-uniq-mut-ty.rs:1:20 | -LL | type mut_box = Box<mut isize>; //~ ERROR expected one of `>`, lifetime, or type, found `mut` - | ^^^ expected one of `>`, lifetime, or type here +LL | type mut_box = Box<mut isize>; //~ ERROR expected one of `>`, const, lifetime, or type, found `mut` + | ^^^ expected one of `>`, const, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/privacy/private-in-public-warn.rs b/src/test/ui/privacy/private-in-public-warn.rs index 29f365b69be..467b8374670 100644 --- a/src/test/ui/privacy/private-in-public-warn.rs +++ b/src/test/ui/privacy/private-in-public-warn.rs @@ -49,6 +49,7 @@ mod traits { pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` in public interface //~| WARNING hard error + //~| WARNING bounds on generic parameters are not enforced in type aliases pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface //~^ WARNING hard error pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in public interface @@ -74,6 +75,7 @@ mod traits_where { pub type Alias<T> where T: PrivTr = T; //~^ ERROR private trait `traits_where::PrivTr` in public interface //~| WARNING hard error + //~| WARNING where clauses are not enforced in type aliases pub trait Tr2<T> where T: PrivTr {} //~^ ERROR private trait `traits_where::PrivTr` in public interface //~| WARNING hard error diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 8f9e7cd74f9..621d9a57fa0 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -112,7 +112,7 @@ LL | pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:52:5 + --> $DIR/private-in-public-warn.rs:53:5 | LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in pu = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:54:5 + --> $DIR/private-in-public-warn.rs:55:5 | LL | pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL | pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:56:5 + --> $DIR/private-in-public-warn.rs:57:5 | LL | / pub trait Tr3 { LL | | //~^ ERROR private trait `traits::PrivTr` in public interface @@ -145,7 +145,7 @@ LL | | } = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:60:9 + --> $DIR/private-in-public-warn.rs:61:9 | LL | fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -154,7 +154,7 @@ LL | fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:63:5 + --> $DIR/private-in-public-warn.rs:64:5 | LL | impl<T: PrivTr> Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -163,7 +163,7 @@ LL | impl<T: PrivTr> Pub<T> {} //~ ERROR private trait `traits::PrivTr` in p = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:65:5 + --> $DIR/private-in-public-warn.rs:66:5 | LL | impl<T: PrivTr> PubTr for Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -172,7 +172,7 @@ LL | impl<T: PrivTr> PubTr for Pub<T> {} //~ ERROR private trait `traits::Pr = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:74:5 + --> $DIR/private-in-public-warn.rs:75:5 | LL | pub type Alias<T> where T: PrivTr = T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | pub type Alias<T> where T: PrivTr = T; = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:77:5 + --> $DIR/private-in-public-warn.rs:79:5 | LL | pub trait Tr2<T> where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ LL | pub trait Tr2<T> where T: PrivTr {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:81:9 + --> $DIR/private-in-public-warn.rs:83:9 | LL | fn f<T>(arg: T) where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL | fn f<T>(arg: T) where T: PrivTr {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:85:5 + --> $DIR/private-in-public-warn.rs:87:5 | LL | impl<T> Pub<T> where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -208,7 +208,7 @@ LL | impl<T> Pub<T> where T: PrivTr {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:88:5 + --> $DIR/private-in-public-warn.rs:90:5 | LL | impl<T> PubTr for Pub<T> where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -217,7 +217,7 @@ LL | impl<T> PubTr for Pub<T> where T: PrivTr {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `generics::PrivTr<generics::Pub>` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:99:5 + --> $DIR/private-in-public-warn.rs:101:5 | LL | pub trait Tr1: PrivTr<Pub> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -226,7 +226,7 @@ LL | pub trait Tr1: PrivTr<Pub> {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private type `generics::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:102:5 + --> $DIR/private-in-public-warn.rs:104:5 | LL | pub trait Tr2: PubTr<Priv> {} //~ ERROR private type `generics::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -235,7 +235,7 @@ LL | pub trait Tr2: PubTr<Priv> {} //~ ERROR private type `generics::Priv` i = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private type `generics::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:104:5 + --> $DIR/private-in-public-warn.rs:106:5 | LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -244,7 +244,7 @@ LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Pr = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private type `generics::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:106:5 + --> $DIR/private-in-public-warn.rs:108:5 | LL | pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR private type `generics::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL | pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR private type `generics::Pr = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error[E0446]: private type `impls::Priv` in public interface - --> $DIR/private-in-public-warn.rs:133:9 + --> $DIR/private-in-public-warn.rs:135:9 | LL | struct Priv; | - `impls::Priv` declared as private @@ -262,7 +262,7 @@ LL | type Alias = Priv; //~ ERROR private type `impls::Priv` in public i | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `aliases_pub::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:204:9 + --> $DIR/private-in-public-warn.rs:206:9 | LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^ @@ -271,7 +271,7 @@ LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` i = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:208:9 + --> $DIR/private-in-public-warn.rs:210:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -280,7 +280,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:211:9 + --> $DIR/private-in-public-warn.rs:213:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -289,7 +289,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:214:9 + --> $DIR/private-in-public-warn.rs:216:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -298,7 +298,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:217:9 + --> $DIR/private-in-public-warn.rs:219:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -307,7 +307,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:247:5 + --> $DIR/private-in-public-warn.rs:249:5 | LL | pub trait Tr1: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL | pub trait Tr1: PrivUseAliasTr {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private trait `aliases_priv::PrivTr1<aliases_priv::Priv2>` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:250:5 + --> $DIR/private-in-public-warn.rs:252:5 | LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {} = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> error: private type `aliases_priv::Priv2` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:250:5 + --> $DIR/private-in-public-warn.rs:252:5 | LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -333,6 +333,23 @@ LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {} = 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 #34537 <https://github.com/rust-lang/rust/issues/34537> +warning: bounds on generic parameters are not enforced in type aliases + --> $DIR/private-in-public-warn.rs:50:23 + | +LL | pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` in public interface + | ^^^^^^ + | + = note: #[warn(type_alias_bounds)] on by default + = help: the bound will not be checked when the type alias is used, and should be removed + +warning: where clauses are not enforced in type aliases + --> $DIR/private-in-public-warn.rs:75:29 + | +LL | pub type Alias<T> where T: PrivTr = T; + | ^^^^^^^^^ + | + = help: the clause will not be checked when the type alias is used, and should be removed + error: aborting due to 36 previous errors For more information about this error, try `rustc --explain E0446`. diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs index 69b60a56c67..d98cf5991ef 100644 --- a/src/test/ui/privacy/private-inferred-type.rs +++ b/src/test/ui/privacy/private-inferred-type.rs @@ -1,4 +1,3 @@ -#![feature(associated_consts)] #![feature(decl_macro)] #![allow(private_in_public)] @@ -15,6 +14,7 @@ mod m { pub struct PubTupleStruct(u8); impl PubTupleStruct { fn method() {} } + #[derive(Clone, Copy)] struct Priv; pub type Alias = Priv; pub struct Pub<T = Alias>(pub T); diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr index 103c78126a8..2dfe2a94c88 100644 --- a/src/test/ui/proc-macro/shadow.stderr +++ b/src/test/ui/proc-macro/shadow.stderr @@ -1,17 +1,16 @@ error[E0259]: the name `derive_a` is defined multiple times --> $DIR/shadow.rs:6:1 | -LL | extern crate derive_a; - | ---------------------- previous import of the extern crate `derive_a` here -LL | #[macro_use] -LL | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times - | ^^^^^^^^^^^^^^^^^^^^^^ `derive_a` reimported here +LL | extern crate derive_a; + | ---------------------- previous import of the extern crate `derive_a` here +LL | / #[macro_use] +LL | | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times + | | ^^^^^^^^^^^^^^^^^^^^^- + | |_|____________________| + | | help: remove unnecessary import + | `derive_a` reimported here | = note: `derive_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 - | -LL | extern crate derive_a as other_derive_a; //~ ERROR the name `derive_a` is defined multiple times - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/repr/repr-align.rs b/src/test/ui/repr/repr-align.rs index 78ed6c7e1c4..9ce89e82ca2 100644 --- a/src/test/ui/repr/repr-align.rs +++ b/src/test/ui/repr/repr-align.rs @@ -1,3 +1,4 @@ +#![feature(repr_align_enum)] #![allow(dead_code)] #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer @@ -12,4 +13,7 @@ struct C(i32); #[repr(align(536870912))] // ok: this is the largest accepted alignment struct D(i32); +#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two +enum E { Left, Right } + fn main() {} diff --git a/src/test/ui/repr/repr-align.stderr b/src/test/ui/repr/repr-align.stderr index e8dbf74232b..f1a5d88ace1 100644 --- a/src/test/ui/repr/repr-align.stderr +++ b/src/test/ui/repr/repr-align.stderr @@ -1,21 +1,27 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:3:8 + --> $DIR/repr-align.rs:4:8 | LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer | ^^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:6:8 + --> $DIR/repr-align.rs:7:8 | LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two | ^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:9:8 + --> $DIR/repr-align.rs:10:8 | LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 | ^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0589]: invalid `repr(align)` attribute: not a power of two + --> $DIR/repr-align.rs:16:8 + | +LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two + | ^^^^^^^^^ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0589`. diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr index 2852d122e5e..1b4b058b783 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr @@ -4,13 +4,12 @@ error[E0252]: the name `transmute` is defined multiple times LL | use std::mem::transmute; | ------------------- previous import of the value `transmute` here LL | use std::mem::transmute; - | ^^^^^^^^^^^^^^^^^^^ `transmute` reimported here + | ----^^^^^^^^^^^^^^^^^^^- + | | | + | | `transmute` reimported here + | help: remove unnecessary import | = 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 - | -LL | use std::mem::transmute as other_transmute; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs index 112427a3fce..c77a66524f7 100644 --- a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs +++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs @@ -6,7 +6,7 @@ trait TraitA<A> { fn outer(&self) { enum Foo<B> { Variance(A) - //~^ ERROR can't use type parameters from outer function + //~^ ERROR can't use generic parameters from outer function } } } @@ -14,21 +14,21 @@ trait TraitA<A> { trait TraitB<A> { fn outer(&self) { struct Foo<B>(A); - //~^ ERROR can't use type parameters from outer function + //~^ ERROR can't use generic parameters from outer function } } trait TraitC<A> { fn outer(&self) { struct Foo<B> { a: A } - //~^ ERROR can't use type parameters from outer function + //~^ ERROR can't use generic parameters from outer function } } trait TraitD<A> { fn outer(&self) { fn foo<B>(a: A) { } - //~^ ERROR can't use type parameters from outer function + //~^ ERROR can't use generic parameters from outer function } } diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr index 8eca720d88e..f6b8abf4057 100644 --- a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr +++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr @@ -1,44 +1,44 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/resolve-type-param-in-item-in-trait.rs:8:22 | LL | trait TraitA<A> { | - type variable from outer function LL | fn outer(&self) { - | ----- try adding a local type parameter in this method instead + | ----- try adding a local generic parameter in this method instead LL | enum Foo<B> { LL | Variance(A) - | ^ use of type variable from outer function + | ^ use of generic parameter from outer function -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/resolve-type-param-in-item-in-trait.rs:16:23 | LL | trait TraitB<A> { | - type variable from outer function LL | fn outer(&self) { - | ----- try adding a local type parameter in this method instead + | ----- try adding a local generic parameter in this method instead LL | struct Foo<B>(A); - | ^ use of type variable from outer function + | ^ use of generic parameter from outer function -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/resolve-type-param-in-item-in-trait.rs:23:28 | LL | trait TraitC<A> { | - type variable from outer function LL | fn outer(&self) { - | ----- try adding a local type parameter in this method instead + | ----- try adding a local generic parameter in this method instead LL | struct Foo<B> { a: A } - | ^ use of type variable from outer function + | ^ use of generic parameter from outer function -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/resolve-type-param-in-item-in-trait.rs:30:22 | LL | trait TraitD<A> { | - type variable from outer function LL | fn outer(&self) { LL | fn foo<B>(a: A) { } - | ------ ^ use of type variable from outer function + | ------ ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `foo<B, A>` + | help: try using a local generic parameter instead: `foo<B, A>` error: aborting due to 4 previous errors diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index 86cf71117a6..b1ca0bbfc57 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -17,7 +17,7 @@ pub mod raw { //~| expected type `()` //~| found type `std::result::Result<bool, std::io::Error>` //~| expected one of - } else { //~ ERROR: incorrect close delimiter: `}` + } else { //~^ ERROR: expected one of //~| unexpected token Ok(false); diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index 2164d27a051..a6bb83c71f3 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,19 +1,11 @@ -error: incorrect close delimiter: `}` - --> $DIR/token-error-correct-3.rs:20:9 - | -LL | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` - | - close delimiter possibly meant for this -LL | callback(path.as_ref(); //~ ERROR expected one of - | - un-closed delimiter -... -LL | } else { //~ ERROR: incorrect close delimiter: `}` - | ^ incorrect close delimiter - error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` --> $DIR/token-error-correct-3.rs:14:35 | LL | callback(path.as_ref(); //~ ERROR expected one of - | ^ expected one of `)`, `,`, `.`, `?`, or an operator here + | - ^ + | | | + | | help: `)` may belong here + | unclosed delimiter error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` --> $DIR/token-error-correct-3.rs:20:9 @@ -21,7 +13,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | - expected one of `.`, `;`, `?`, `}`, or an operator here ... -LL | } else { //~ ERROR: incorrect close delimiter: `}` +LL | } else { | ^ unexpected token error[E0425]: cannot find function `is_directory` in this scope @@ -41,7 +33,7 @@ LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mis = note: expected type `()` found type `std::result::Result<bool, std::io::Error>` -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0308, E0425. For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs index b97e22f7d91..d64907780ef 100644 --- a/src/test/ui/resolve/token-error-correct.rs +++ b/src/test/ui/resolve/token-error-correct.rs @@ -2,6 +2,8 @@ fn main() { foo(bar(; - //~^ ERROR: expected expression, found `;` + //~^ ERROR cannot find function `bar` in this scope } //~^ ERROR: incorrect close delimiter: `}` + +fn foo(_: usize) {} diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index 0a4590461b5..b0827ea7367 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -5,15 +5,16 @@ LL | fn main() { | - close delimiter possibly meant for this LL | foo(bar(; | - un-closed delimiter -LL | //~^ ERROR: expected expression, found `;` +LL | //~^ ERROR cannot find function `bar` in this scope LL | } | ^ incorrect close delimiter -error: expected expression, found `;` - --> $DIR/token-error-correct.rs:4:13 +error[E0425]: cannot find function `bar` in this scope + --> $DIR/token-error-correct.rs:4:9 | LL | foo(bar(; - | ^ expected expression + | ^^^ not found in this scope error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.stderr b/src/test/ui/rfc-2166-underscore-imports/basic.stderr index 30803591926..c7b36eaf2e7 100644 --- a/src/test/ui/rfc-2166-underscore-imports/basic.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/basic.stderr @@ -2,7 +2,7 @@ warning: unused import: `m::Tr1 as _` --> $DIR/basic.rs:26:9 | LL | use m::Tr1 as _; //~ WARN unused import - | ^^^^^^^^^^^ + | ----^^^^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/basic.rs:4:9 @@ -14,5 +14,5 @@ warning: unused import: `S as _` --> $DIR/basic.rs:27:9 | LL | use S as _; //~ WARN unused import - | ^^^^^^ + | ----^^^^^^- help: remove the whole `use` item diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr index 4163c287607..0bbc17276d9 100644 --- a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr @@ -2,7 +2,7 @@ error: unused import: `core::any` --> $DIR/unused-2018.rs:6:9 | LL | use core::any; //~ ERROR unused import: `core::any` - | ^^^^^^^^^ + | ----^^^^^^^^^- help: remove the whole `use` item | note: lint level defined here --> $DIR/unused-2018.rs:3:9 @@ -14,7 +14,7 @@ error: unused import: `core` --> $DIR/unused-2018.rs:10:9 | LL | use core; //~ ERROR unused import: `core` - | ^^^^ + | ----^^^^- help: remove the whole `use` item error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs index 158ebc7d388..afc27701920 100644 --- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs +++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs @@ -3,7 +3,7 @@ trait Foo { type Bar<,>; - //~^ ERROR expected one of `>`, identifier, or lifetime, found `,` + //~^ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,` } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr index 2a01b2a3f0f..5b98302924e 100644 --- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr @@ -1,8 +1,8 @@ -error: expected one of `>`, identifier, or lifetime, found `,` +error: expected one of `>`, `const`, identifier, or lifetime, found `,` --> $DIR/empty_generics.rs:5:14 | LL | type Bar<,>; - | ^ expected one of `>`, identifier, or lifetime here + | ^ expected one of `>`, `const`, identifier, or lifetime here warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash --> $DIR/empty_generics.rs:1:12 diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr index a730d081b7c..6bd0e9be81f 100644 --- a/src/test/ui/span/multispan-import-lint.stderr +++ b/src/test/ui/span/multispan-import-lint.stderr @@ -10,4 +10,8 @@ note: lint level defined here LL | #![warn(unused)] | ^^^^^^ = note: #[warn(unused_imports)] implied by #[warn(unused)] +help: remove the unused imports + | +LL | use std::cmp::{min}; + | -- -- diff --git a/src/test/ui/stability-in-private-module.rs b/src/test/ui/stability-in-private-module.rs new file mode 100644 index 00000000000..f12e9198b0d --- /dev/null +++ b/src/test/ui/stability-in-private-module.rs @@ -0,0 +1,4 @@ +fn main() { + let _ = std::thread::thread_info::current_thread(); + //~^ERROR module `thread_info` is private +} diff --git a/src/test/ui/stability-in-private-module.stderr b/src/test/ui/stability-in-private-module.stderr new file mode 100644 index 00000000000..c3edd62a15e --- /dev/null +++ b/src/test/ui/stability-in-private-module.stderr @@ -0,0 +1,9 @@ +error[E0603]: module `thread_info` is private + --> $DIR/stability-in-private-module.rs:2:26 + | +LL | let _ = std::thread::thread_info::current_thread(); + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0603`. diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index b36e927b5c0..2d6dee06216 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -2,41 +2,25 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | LL | struct A<T, 'a> { //~ ERROR lifetime parameters must be declared - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | struct A<'a, T> { //~ ERROR lifetime parameters must be declared - | ^^^ -- + | ----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | LL | struct B<T, 'a, U> { //~ ERROR lifetime parameters must be declared - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | struct B<'a, T, U> { //~ ERROR lifetime parameters must be declared - | ^^^ -- + | ----^^---- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | LL | struct C<T, U, 'a> { //~ ERROR lifetime parameters must be declared - | ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | struct C<'a, T, U> { //~ ERROR lifetime parameters must be declared - | ^^^ -- + | -------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | LL | struct D<T, U, 'a, 'b, V, 'c> { //~ ERROR lifetime parameters must be declared - | ^^ ^^ ^^ -help: move the lifetime parameter prior to the first type parameter - | -LL | struct D<'a, 'b, 'c, T, U, V> { //~ ERROR lifetime parameters must be declared - | ^^^ ^^^ ^^^ -- -- + | -------^^--^^-----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, 'c, T, U, V>` error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-move-types.rs b/src/test/ui/suggestions/suggest-move-types.rs index fd10ba4350c..890950ea08c 100644 --- a/src/test/ui/suggestions/suggest-move-types.rs +++ b/src/test/ui/suggestions/suggest-move-types.rs @@ -25,19 +25,20 @@ trait ThreeWithLifetime<'a, 'b, 'c, T, U, V> { type C; } -struct A<T, M: One<A=(), T>> { //~ ERROR type parameters must be declared +struct A<T, M: One<A=(), T>> { //~ ERROR associated type bindings must be declared after generic parameters m: M, t: T, } struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> { -//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order +//~^ ERROR associated type bindings must be declared after generic parameters +//~^^ ERROR lifetime arguments must be declared prior to type arguments m: M, t: &'a T, } -struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { //~ ERROR type parameters must be declared +struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { //~ ERROR associated type bindings must be declared after generic parameters m: M, t: T, u: U, @@ -45,14 +46,15 @@ struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { //~ ERROR type paramete } struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> { -//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order +//~^ ERROR associated type bindings must be declared after generic parameters +//~^^ ERROR lifetime arguments must be declared prior to type arguments m: M, t: &'a T, u: &'b U, v: &'c V, } -struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { //~ ERROR type parameters must be declared +struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { //~ ERROR associated type bindings must be declared after generic parameters m: M, t: T, u: U, @@ -60,14 +62,15 @@ struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { //~ ERROR type paramete } struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> { -//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order +//~^ ERROR associated type bindings must be declared after generic parameters +//~^^ ERROR lifetime arguments must be declared prior to type arguments m: M, t: &'a T, u: &'b U, v: &'c V, } -struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { //~ ERROR type parameters must be declared +struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { //~ ERROR associated type bindings must be declared after generic parameters m: M, t: T, u: U, @@ -75,7 +78,8 @@ struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { //~ ERROR type paramete } struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> { -//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order +//~^ ERROR associated type bindings must be declared after generic parameters +//~^^ ERROR lifetime arguments must be declared prior to type arguments m: M, t: &'a T, u: &'b U, diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index 3643d9a9124..0901b71911d 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -1,107 +1,102 @@ -error: type parameters must be declared prior to associated type bindings - --> $DIR/suggest-move-types.rs:28:26 +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:28:20 | -LL | struct A<T, M: One<A=(), T>> { //~ ERROR type parameters must be declared - | ^ must be declared prior to associated type bindings -help: move the type parameter prior to the first associated type binding - | -LL | struct A<T, M: One<T, A=()>> { //~ ERROR type parameters must be declared - | ^^ -- +LL | struct A<T, M: One<A=(), T>> { //~ ERROR associated type bindings must be declared after generic parameters + | ----^^^ + | | + | this associated type binding should be moved after the generic parameters -error: generic arguments must declare lifetimes, types and associated type bindings in that order - --> $DIR/suggest-move-types.rs:34:46 +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:34:37 | LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> { - | ^ ^^ must be declared prior to type parameters - | | - | must be declared prior to associated type bindings -help: move the parameters - | -LL | struct Al<'a, T, M: OneWithLifetime<'a, T, A=()>> { - | ^^^ ^^ -- + | ----^^^^^^^ + | | + | this associated type binding should be moved after the generic parameters -error: type parameters must be declared prior to associated type bindings - --> $DIR/suggest-move-types.rs:40:46 - | -LL | struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { //~ ERROR type parameters must be declared - | ^ ^ ^ must be declared prior to associated type bindings - | | | - | | must be declared prior to associated type bindings - | must be declared prior to associated type bindings -help: move the type parameters prior to the first associated type binding - | -LL | struct B<T, U, V, M: Three<T, U, V, A=(), B=(), C=()>> { //~ ERROR type parameters must be declared - | ^^ ^^ ^^ -- +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:41:28 + | +LL | struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { //~ ERROR associated type bindings must be declared after generic parameters + | ----^^----^^----^^^^^^^^^ + | | | | + | | | this associated type binding should be moved after the generic parameters + | | this associated type binding should be moved after the generic parameters + | this associated type binding should be moved after the generic parameters -error: generic arguments must declare lifetimes, types and associated type bindings in that order - --> $DIR/suggest-move-types.rs:47:80 +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:48:53 | LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> { - | ^ ^ ^ ^^ ^^ ^^ must be declared prior to type parameters - | | | | | | - | | | | | must be declared prior to type parameters - | | | | must be declared prior to type parameters - | | | must be declared prior to associated type bindings - | | must be declared prior to associated type bindings - | must be declared prior to associated type bindings -help: move the parameters - | -LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A=(), B=(), C=()>> { - | ^^^ ^^^ ^^^ ^^ ^^ ^^ -- + | ----^^----^^----^^^^^^^^^^^^^^^^^^^^^ + | | | | + | | | this associated type binding should be moved after the generic parameters + | | this associated type binding should be moved after the generic parameters + | this associated type binding should be moved after the generic parameters -error: type parameters must be declared prior to associated type bindings - --> $DIR/suggest-move-types.rs:55:49 - | -LL | struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { //~ ERROR type parameters must be declared - | ^ ^ must be declared prior to associated type bindings - | | - | must be declared prior to associated type bindings -help: move the type parameters prior to the first associated type binding - | -LL | struct C<T, U, V, M: Three<T, U, V, A=(), B=(), C=()>> { //~ ERROR type parameters must be declared - | ^^ ^^ -- +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:57:28 + | +LL | struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { //~ ERROR associated type bindings must be declared after generic parameters + | ^^^----^^----^^----^^^^^^ + | | | | + | | | this associated type binding should be moved after the generic parameters + | | this associated type binding should be moved after the generic parameters + | this associated type binding should be moved after the generic parameters -error: generic arguments must declare lifetimes, types and associated type bindings in that order - --> $DIR/suggest-move-types.rs:62:56 +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:64:53 | LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> { - | ^^ ^ ^^ ^ ^^ must be declared prior to type parameters - | | | | | - | | | | must be declared prior to associated type bindings - | | | must be declared prior to type parameters - | | must be declared prior to associated type bindings - | must be declared prior to type parameters -help: move the parameters + | ^^^^^^^----^^----^^----^^^^^^^^^^^^^^ + | | | | + | | | this associated type binding should be moved after the generic parameters + | | this associated type binding should be moved after the generic parameters + | this associated type binding should be moved after the generic parameters + +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:73:28 + | +LL | struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { //~ ERROR associated type bindings must be declared after generic parameters + | ^^^----^^----^^^^^----^^^ + | | | | + | | | this associated type binding should be moved after the generic parameters + | | this associated type binding should be moved after the generic parameters + | this associated type binding should be moved after the generic parameters + +error: associated type bindings must be declared after generic parameters + --> $DIR/suggest-move-types.rs:80:53 | -LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A=(), B=(), C=()>> { - | ^^^ ^^^ ^^^ -- ^^ ^^ -- +LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> { + | ^^^^^^^----^^----^^^^^^^^^----^^^^^^^ + | | | | + | | | this associated type binding should be moved after the generic parameters + | | this associated type binding should be moved after the generic parameters + | this associated type binding should be moved after the generic parameters -error: type parameters must be declared prior to associated type bindings - --> $DIR/suggest-move-types.rs:70:43 +error: lifetime arguments must be declared prior to type arguments + --> $DIR/suggest-move-types.rs:34:46 | -LL | struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { //~ ERROR type parameters must be declared - | ^ ^ must be declared prior to associated type bindings - | | - | must be declared prior to associated type bindings -help: move the type parameters prior to the first associated type binding +LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> { + | ^^ + +error: lifetime arguments must be declared prior to type arguments + --> $DIR/suggest-move-types.rs:48:80 | -LL | struct D<T, U, V, M: Three<T, U, V, A=(), B=(), C=()>> { //~ ERROR type parameters must be declared - | ^^ ^^ -- -- +LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> { + | ^^ ^^ ^^ -error: generic arguments must declare lifetimes, types and associated type bindings in that order - --> $DIR/suggest-move-types.rs:77:56 +error: lifetime arguments must be declared prior to type arguments + --> $DIR/suggest-move-types.rs:64:56 | -LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> { - | ^^ ^ ^^ ^ ^^ must be declared prior to type parameters - | | | | | - | | | | must be declared prior to associated type bindings - | | | must be declared prior to type parameters - | | must be declared prior to associated type bindings - | must be declared prior to type parameters -help: move the parameters +LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> { + | ^^ ^^ ^^ + +error: lifetime arguments must be declared prior to type arguments + --> $DIR/suggest-move-types.rs:80:56 | -LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A=(), B=(), C=()>> { - | ^^^ ^^^ ^^^ -- ^^ ^^ -- -- +LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> { + | ^^ ^^ ^^ -error: aborting due to 8 previous errors +error: aborting due to 12 previous errors diff --git a/src/test/ui/svh/auxiliary/svh-b.rs b/src/test/ui/svh/auxiliary/svh-b.rs index 03869aeb371..57029f70888 100644 --- a/src/test/ui/svh/auxiliary/svh-b.rs +++ b/src/test/ui/svh/auxiliary/svh-b.rs @@ -1,7 +1,7 @@ -//! This is a client of the `a` crate defined in "svn-a-base.rs". The -//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use +//! This is a client of the `a` crate defined in `svn-a-base.rs`. The +//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use //! it by swapping in a different object code library crate built from -//! some variant of "svn-a-base.rs", and then we are checking if the +//! some variant of `svn-a-base.rs`, and then we are checking if the //! compiler properly ignores or accepts the change, based on whether //! the change could affect the downstream crate content or not //! (#14132). diff --git a/src/test/ui/traits/trait-object-vs-lifetime.rs b/src/test/ui/traits/trait-object-vs-lifetime.rs index a12429c868e..36dec21be05 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime.rs @@ -12,6 +12,6 @@ fn main() { //~^ ERROR wrong number of lifetime arguments: expected 1, found 2 //~| ERROR wrong number of type arguments: expected 1, found 0 let _: S<'static +, 'static>; - //~^ ERROR lifetime parameters must be declared prior to type parameters + //~^ ERROR lifetime arguments must be declared prior to type arguments //~| ERROR at least one non-builtin trait is required for an object type } diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr index 4cc96bae5cd..e0c52a72a09 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr @@ -1,12 +1,8 @@ -error: lifetime parameters must be declared prior to type parameters +error: lifetime arguments must be declared prior to type arguments --> $DIR/trait-object-vs-lifetime.rs:14:25 | LL | let _: S<'static +, 'static>; - | ^^^^^^^ must be declared prior to type parameters -help: move the lifetime parameter prior to the first type parameter - | -LL | let _: S<'static, 'static +>; - | ^^^^^^^^ -- + | ^^^^^^^ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-vs-lifetime.rs:9:23 diff --git a/src/test/ui/type/type-arg-out-of-scope.rs b/src/test/ui/type/type-arg-out-of-scope.rs index b96c9bf6a0e..d5b815f6a95 100644 --- a/src/test/ui/type/type-arg-out-of-scope.rs +++ b/src/test/ui/type/type-arg-out-of-scope.rs @@ -1,4 +1,4 @@ -// error-pattern:can't use type parameters from outer function +// error-pattern:can't use generic parameters from outer function fn foo<T>(x: T) { fn bar(f: Box<FnMut(T) -> T>) { } } diff --git a/src/test/ui/type/type-arg-out-of-scope.stderr b/src/test/ui/type/type-arg-out-of-scope.stderr index 62b6a86662d..645cbb33abe 100644 --- a/src/test/ui/type/type-arg-out-of-scope.stderr +++ b/src/test/ui/type/type-arg-out-of-scope.stderr @@ -1,22 +1,22 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/type-arg-out-of-scope.rs:3:25 | LL | fn foo<T>(x: T) { | - type variable from outer function LL | fn bar(f: Box<FnMut(T) -> T>) { } - | --- ^ use of type variable from outer function + | --- ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `bar<T>` + | help: try using a local generic parameter instead: `bar<T>` -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/type-arg-out-of-scope.rs:3:31 | LL | fn foo<T>(x: T) { | - type variable from outer function LL | fn bar(f: Box<FnMut(T) -> T>) { } - | --- ^ use of type variable from outer function + | --- ^ use of generic parameter from outer function | | - | help: try using a local type parameter instead: `bar<T>` + | help: try using a local generic parameter instead: `bar<T>` error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-dependent-def-issue-49241.rs b/src/test/ui/type/type-dependent-def-issue-49241.rs index 4c366a86363..51bd116fbd6 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.rs +++ b/src/test/ui/type/type-dependent-def-issue-49241.rs @@ -1,6 +1,6 @@ fn main() { let v = vec![0]; - const l: usize = v.count(); //~ ERROR can't capture dynamic environment in a fn item + const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant let s: [u32; l] = v.into_iter().collect(); //~^ ERROR evaluation of constant value failed } diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr index 8783959f45f..0af777fdcf9 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.stderr +++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr @@ -1,10 +1,8 @@ -error[E0434]: can't capture dynamic environment in a fn item +error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-dependent-def-issue-49241.rs:3:22 | -LL | const l: usize = v.count(); //~ ERROR can't capture dynamic environment in a fn item - | ^ - | - = help: use the `|| { ... }` closure form instead +LL | const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant + | ^ non-constant value error[E0080]: evaluation of constant value failed --> $DIR/type-dependent-def-issue-49241.rs:4:18 @@ -14,5 +12,5 @@ LL | let s: [u32; l] = v.into_iter().collect(); error: aborting due to 2 previous errors -Some errors occurred: E0080, E0434. +Some errors occurred: E0080, E0435. For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr index 012d3c3a751..e8679a3726d 100644 --- a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr +++ b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr @@ -4,13 +4,12 @@ error[E0254]: the name `core` is defined multiple times LL | extern crate core; | ------------------ previous import of the extern crate `core` here LL | use core; - | ^^^^ `core` reimported here + | ----^^^^- + | | | + | | `core` reimported here + | help: remove unnecessary import | = note: `core` 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 - | -LL | use core as other_core; - | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/use-self-in-inner-fn.rs b/src/test/ui/use-self-in-inner-fn.rs index cde96dc778b..eccb315feb1 100644 --- a/src/test/ui/use-self-in-inner-fn.rs +++ b/src/test/ui/use-self-in-inner-fn.rs @@ -4,8 +4,8 @@ impl A { //~^ NOTE `Self` type implicitly declared here, by this `impl` fn banana(&mut self) { fn peach(this: &Self) { - //~^ ERROR can't use type parameters from outer function - //~| NOTE use of type variable from outer function + //~^ ERROR can't use generic parameters from outer function + //~| NOTE use of generic parameter from outer function //~| NOTE use a type here instead } } diff --git a/src/test/ui/use-self-in-inner-fn.stderr b/src/test/ui/use-self-in-inner-fn.stderr index a613804b803..96609349924 100644 --- a/src/test/ui/use-self-in-inner-fn.stderr +++ b/src/test/ui/use-self-in-inner-fn.stderr @@ -1,4 +1,4 @@ -error[E0401]: can't use type parameters from outer function +error[E0401]: can't use generic parameters from outer function --> $DIR/use-self-in-inner-fn.rs:6:25 | LL | impl A { @@ -7,7 +7,7 @@ LL | impl A { LL | fn peach(this: &Self) { | ^^^^ | | - | use of type variable from outer function + | use of generic parameter from outer function | use a type here instead error: aborting due to previous error diff --git a/src/test/ui/use/use-mod.stderr b/src/test/ui/use/use-mod.stderr index 9ab873b3598..c23ab34eae6 100644 --- a/src/test/ui/use/use-mod.stderr +++ b/src/test/ui/use/use-mod.stderr @@ -20,13 +20,12 @@ LL | self, | ---- previous import of the module `bar` here ... LL | self - | ^^^^ `bar` reimported here + | ^^^^ + | | + | `bar` reimported here + | help: remove unnecessary import | = 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 - | -LL | self as other_bar - | error: aborting due to 3 previous errors diff --git a/src/test/ui/use/use-nested-groups-unused-imports.rs b/src/test/ui/use/use-nested-groups-unused-imports.rs index 5bdc7b2c03f..5fe85954dc8 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.rs +++ b/src/test/ui/use/use-nested-groups-unused-imports.rs @@ -18,7 +18,7 @@ use foo::{Foo, bar::{baz::{}, foobar::*}, *}; use foo::bar::baz::{*, *}; //~^ ERROR unused import: `*` use foo::{}; - //~^ ERROR unused import: `use foo::{};` + //~^ ERROR unused import: `foo::{}` fn main() { let _: Bar; diff --git a/src/test/ui/use/use-nested-groups-unused-imports.stderr b/src/test/ui/use/use-nested-groups-unused-imports.stderr index f60c7f50237..6af6f449de5 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.stderr +++ b/src/test/ui/use/use-nested-groups-unused-imports.stderr @@ -2,7 +2,7 @@ error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*` --> $DIR/use-nested-groups-unused-imports.rs:16:11 | LL | use foo::{Foo, bar::{baz::{}, foobar::*}, *}; - | ^^^ ^^^^^^^ ^^^^^^^^^ ^ + | ----------^^^--------^^^^^^^--^^^^^^^^^---^-- help: remove the whole `use` item | note: lint level defined here --> $DIR/use-nested-groups-unused-imports.rs:3:9 @@ -14,13 +14,15 @@ error: unused import: `*` --> $DIR/use-nested-groups-unused-imports.rs:18:24 | LL | use foo::bar::baz::{*, *}; - | ^ + | --^ + | | + | help: remove the unused import -error: unused import: `use foo::{};` - --> $DIR/use-nested-groups-unused-imports.rs:20:1 +error: unused import: `foo::{}` + --> $DIR/use-nested-groups-unused-imports.rs:20:5 | LL | use foo::{}; - | ^^^^^^^^^^^^ + | ----^^^^^^^- help: remove the whole `use` item error: aborting due to 3 previous errors diff --git a/src/test/ui/use/use-paths-as-items.stderr b/src/test/ui/use/use-paths-as-items.stderr index 5bcdf937d56..00f468cdf31 100644 --- a/src/test/ui/use/use-paths-as-items.stderr +++ b/src/test/ui/use/use-paths-as-items.stderr @@ -4,13 +4,12 @@ error[E0252]: the name `mem` is defined multiple times LL | use std::{mem, ptr}; | --- previous import of the module `mem` here LL | use std::mem; //~ ERROR the name `mem` is defined multiple times - | ^^^^^^^^ `mem` reimported here + | ----^^^^^^^^- + | | | + | | `mem` reimported here + | help: remove unnecessary import | = note: `mem` 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 - | -LL | use std::mem as other_mem; //~ ERROR the name `mem` is defined multiple times - | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error |
