diff options
Diffstat (limited to 'tests')
22 files changed, 121 insertions, 70 deletions
diff --git a/tests/ui/dep-graph/dep-graph-dump.rs b/tests/ui/dep-graph/dep-graph-dump.rs new file mode 100644 index 00000000000..cbc4def0e03 --- /dev/null +++ b/tests/ui/dep-graph/dep-graph-dump.rs @@ -0,0 +1,6 @@ +// Test dump-dep-graph requires query-dep-graph enabled + +// incremental +// compile-flags: -Z dump-dep-graph + +fn main() {} diff --git a/tests/ui/dep-graph/dep-graph-dump.stderr b/tests/ui/dep-graph/dep-graph-dump.stderr new file mode 100644 index 00000000000..ea44b8bb075 --- /dev/null +++ b/tests/ui/dep-graph/dep-graph-dump.stderr @@ -0,0 +1,2 @@ +error: can't dump dependency graph without `-Z query-dep-graph` + diff --git a/tests/ui/errors/auxiliary/remapped_dep.rs b/tests/ui/errors/auxiliary/remapped_dep.rs new file mode 100644 index 00000000000..ef26f1cd883 --- /dev/null +++ b/tests/ui/errors/auxiliary/remapped_dep.rs @@ -0,0 +1,3 @@ +// compile-flags: --remap-path-prefix={{src-base}}/errors/auxiliary=remapped-aux + +pub struct SomeStruct {} // This line should be show as part of the error. diff --git a/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr b/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr new file mode 100644 index 00000000000..2584e3e88a6 --- /dev/null +++ b/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr @@ -0,0 +1,14 @@ +error[E0423]: expected value, found struct `remapped_dep::SomeStruct` + --> $DIR/remap-path-prefix-reverse.rs:22:13 + | +LL | let _ = remapped_dep::SomeStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `remapped_dep::SomeStruct {}` + | + ::: remapped-aux/remapped_dep.rs:3:1 + | +LL | pub struct SomeStruct {} // This line should be show as part of the error. + | --------------------- `remapped_dep::SomeStruct` defined here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr b/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr new file mode 100644 index 00000000000..e710183322a --- /dev/null +++ b/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr @@ -0,0 +1,14 @@ +error[E0423]: expected value, found struct `remapped_dep::SomeStruct` + --> remapped/errors/remap-path-prefix-reverse.rs:22:13 + | +LL | let _ = remapped_dep::SomeStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `remapped_dep::SomeStruct {}` + | + ::: remapped-aux/remapped_dep.rs:3:1 + | +LL | pub struct SomeStruct {} // This line should be show as part of the error. + | --------------------- `remapped_dep::SomeStruct` defined here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/errors/remap-path-prefix-reverse.rs b/tests/ui/errors/remap-path-prefix-reverse.rs new file mode 100644 index 00000000000..635c4164e0f --- /dev/null +++ b/tests/ui/errors/remap-path-prefix-reverse.rs @@ -0,0 +1,23 @@ +// aux-build:remapped_dep.rs +// compile-flags: --remap-path-prefix={{src-base}}/errors/auxiliary=remapped-aux + +// The remapped paths are not normalized by compiletest. +// normalize-stderr-test: "\\(errors)" -> "/$1" + +// revisions: local-self remapped-self +// [remapped-self]compile-flags: --remap-path-prefix={{src-base}}=remapped + +// The paths from `remapped-self` aren't recognized by compiletest, so we +// cannot use line-specific patterns for the actual error. +// error-pattern: E0423 + +// Verify that the expected source code is shown. +// error-pattern: pub struct SomeStruct {} // This line should be show + +extern crate remapped_dep; + +fn main() { + // The actual error is irrelevant. The important part it that is should show + // a snippet of the dependency's source. + let _ = remapped_dep::SomeStruct; +} diff --git a/tests/ui/remap-path-prefix.rs b/tests/ui/errors/remap-path-prefix.rs index 2eef9709977..29b9c7be301 100644 --- a/tests/ui/remap-path-prefix.rs +++ b/tests/ui/errors/remap-path-prefix.rs @@ -1,5 +1,12 @@ // compile-flags: --remap-path-prefix={{src-base}}=remapped +// The remapped paths are not normalized by compiletest. +// normalize-stderr-test: "\\(errors)" -> "/$1" + +// The remapped paths aren't recognized by compiletest, so we +// cannot use line-specific patterns. +// error-pattern: E0425 + fn main() { // We cannot actually put an ERROR marker here because // the file name in the error message is not what the diff --git a/tests/ui/remap-path-prefix.stderr b/tests/ui/errors/remap-path-prefix.stderr index ad6a35d1256..2f421283e69 100644 --- a/tests/ui/remap-path-prefix.stderr +++ b/tests/ui/errors/remap-path-prefix.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `ferris` in this scope - --> remapped/remap-path-prefix.rs:8:5 + --> remapped/errors/remap-path-prefix.rs:15:5 | LL | ferris | ^^^^^^ not found in this scope diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.rs b/tests/ui/type-alias-impl-trait/bound_reduction2.rs index 4d2890b5de5..0bcc9e002ca 100644 --- a/tests/ui/type-alias-impl-trait/bound_reduction2.rs +++ b/tests/ui/type-alias-impl-trait/bound_reduction2.rs @@ -14,5 +14,5 @@ impl<W> Trait<W> for () {} fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> { () - //~^ ERROR non-defining opaque type use + //~^ ERROR expected generic type parameter, found `<T as TraitWithAssoc>::Assoc` } diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr index c405b1f6af2..3c259bd9e97 100644 --- a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr +++ b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr @@ -1,14 +1,12 @@ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic type parameter, found `<T as TraitWithAssoc>::Assoc` --> $DIR/bound_reduction2.rs:16:5 | +LL | type Foo<V> = impl Trait<V>; + | - this generic parameter must be used with a generic type parameter +... LL | () | ^^ - | -note: used non-generic type `<T as TraitWithAssoc>::Assoc` for generic parameter - --> $DIR/bound_reduction2.rs:9:10 - | -LL | type Foo<V> = impl Trait<V>; - | ^ error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs index f39741a6a62..f5045d382aa 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs @@ -10,12 +10,11 @@ type OneLifetime<'a> = impl Debug; type OneConst<const X: usize> = impl Debug; - // Not defining uses, because they doesn't define *all* possible generics. fn concrete_ty() -> OneTy<u32> { 5u32 - //~^ ERROR non-defining opaque type use in defining scope + //~^ ERROR expected generic type parameter, found `u32` } fn concrete_lifetime() -> OneLifetime<'static> { @@ -25,5 +24,5 @@ fn concrete_lifetime() -> OneLifetime<'static> { fn concrete_const() -> OneConst<{ 123 }> { 7u32 - //~^ ERROR non-defining opaque type use in defining scope + //~^ ERROR expected generic constant parameter, found `123` } diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr index e7565525ad3..564648630b1 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr @@ -1,17 +1,14 @@ -error: non-defining opaque type use in defining scope - --> $DIR/generic_nondefining_use.rs:17:5 +error[E0792]: expected generic type parameter, found `u32` + --> $DIR/generic_nondefining_use.rs:16:5 | +LL | type OneTy<T> = impl Debug; + | - this generic parameter must be used with a generic type parameter +... LL | 5u32 | ^^^^ - | -note: used non-generic type `u32` for generic parameter - --> $DIR/generic_nondefining_use.rs:7:12 - | -LL | type OneTy<T> = impl Debug; - | ^ error: non-defining opaque type use in defining scope - --> $DIR/generic_nondefining_use.rs:22:5 + --> $DIR/generic_nondefining_use.rs:21:5 | LL | type OneLifetime<'a> = impl Debug; | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -19,17 +16,15 @@ LL | type OneLifetime<'a> = impl Debug; LL | 6u32 | ^^^^ -error: non-defining opaque type use in defining scope - --> $DIR/generic_nondefining_use.rs:27:5 +error[E0792]: expected generic constant parameter, found `123` + --> $DIR/generic_nondefining_use.rs:26:5 | +LL | type OneConst<const X: usize> = impl Debug; + | -------------- this generic parameter must be used with a generic constant parameter +... LL | 7u32 | ^^^^ - | -note: used non-generic constant `123` for generic parameter - --> $DIR/generic_nondefining_use.rs:11:15 - | -LL | type OneConst<const X: usize> = impl Debug; - | ^^^^^^^^^^^^^^ error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs index cb90776472b..d3e169a70d3 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs @@ -4,7 +4,7 @@ fn main() { let y = 42; let x = wrong_generic(&y); let z: i32 = x; - //~^ ERROR non-defining opaque type use + //~^ ERROR expected generic type parameter, found `&'static i32 } type WrongGeneric<T> = impl 'static; diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr index ba583241a69..19115fd2866 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr @@ -4,17 +4,14 @@ error: at least one trait must be specified LL | type WrongGeneric<T> = impl 'static; | ^^^^^^^^^^^^ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic type parameter, found `&'static i32` --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | LL | let z: i32 = x; | ^ - | -note: used non-generic type `&'static i32` for generic parameter - --> $DIR/generic_type_does_not_live_long_enough.rs:10:19 - | +... LL | type WrongGeneric<T> = impl 'static; - | ^ + | - this generic parameter must be used with a generic type parameter error[E0310]: the parameter type `T` may not live long enough --> $DIR/generic_type_does_not_live_long_enough.rs:14:5 @@ -29,4 +26,5 @@ LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> { error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0310`. +Some errors have detailed explanations: E0310, E0792. +For more information about an error, try `rustc --explain E0310`. diff --git a/tests/ui/type-alias-impl-trait/issue-60564.rs b/tests/ui/type-alias-impl-trait/issue-60564.rs index 4fc7679311a..c2f4c370807 100644 --- a/tests/ui/type-alias-impl-trait/issue-60564.rs +++ b/tests/ui/type-alias-impl-trait/issue-60564.rs @@ -18,7 +18,7 @@ where type BitsIter = IterBitsIter<T, E, u8>; fn iter_bits(self, n: u8) -> Self::BitsIter { (0u8..n).rev().map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) - //~^ ERROR non-defining opaque type use in defining scope + //~^ ERROR expected generic type parameter, found `u8` } } diff --git a/tests/ui/type-alias-impl-trait/issue-60564.stderr b/tests/ui/type-alias-impl-trait/issue-60564.stderr index bbc93657be3..f8fdb004d09 100644 --- a/tests/ui/type-alias-impl-trait/issue-60564.stderr +++ b/tests/ui/type-alias-impl-trait/issue-60564.stderr @@ -1,14 +1,12 @@ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic type parameter, found `u8` --> $DIR/issue-60564.rs:20:9 | +LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>; + | - this generic parameter must be used with a generic type parameter +... LL | (0u8..n).rev().map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: used non-generic type `u8` for generic parameter - --> $DIR/issue-60564.rs:8:25 - | -LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>; - | ^ error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs index 5223fb1c702..5e0a82a7286 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs @@ -7,7 +7,7 @@ trait Trait<T> {} type Alias<'a, U> = impl Trait<U>; fn f<'a>() -> Alias<'a, ()> {} -//~^ ERROR non-defining opaque type use in defining scope +//~^ ERROR expected generic type parameter, found `()` fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr index 7fb9a0c410e..271743a4010 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr @@ -1,14 +1,12 @@ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic type parameter, found `()` --> $DIR/issue-68368-non-defining-use-2.rs:9:29 | +LL | type Alias<'a, U> = impl Trait<U>; + | - this generic parameter must be used with a generic type parameter +LL | LL | fn f<'a>() -> Alias<'a, ()> {} | ^^ - | -note: used non-generic type `()` for generic parameter - --> $DIR/issue-68368-non-defining-use-2.rs:7:16 - | -LL | type Alias<'a, U> = impl Trait<U>; - | ^ error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs index b50462bf237..3b32260c96f 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs @@ -7,7 +7,7 @@ trait Trait<T> {} type Alias<'a, U> = impl Trait<U>; fn f<'a>() -> Alias<'a, ()> {} -//~^ ERROR non-defining opaque type use in defining scope +//~^ ERROR expected generic type parameter, found `()` fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr index 8059621b61a..4d9a8d6eef9 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr @@ -1,14 +1,12 @@ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic type parameter, found `()` --> $DIR/issue-68368-non-defining-use.rs:9:29 | +LL | type Alias<'a, U> = impl Trait<U>; + | - this generic parameter must be used with a generic type parameter +LL | LL | fn f<'a>() -> Alias<'a, ()> {} | ^^ - | -note: used non-generic type `()` for generic parameter - --> $DIR/issue-68368-non-defining-use.rs:7:16 - | -LL | type Alias<'a, U> = impl Trait<U>; - | ^ error: aborting due to previous error +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs index 428454bc048..7657fe2fb1a 100644 --- a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs +++ b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs @@ -18,6 +18,6 @@ type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; //~^ ERROR use of undeclared lifetime name `'a` fn my_fun() -> Return<()> {} -//~^ ERROR non-defining opaque type use in defining scope +//~^ ERROR expected generic type parameter, found `()` fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr index 7b50c8af26e..d1250786d93 100644 --- a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr +++ b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr @@ -14,18 +14,16 @@ help: consider introducing lifetime `'a` here LL | type Return<'a, A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; | +++ -error: non-defining opaque type use in defining scope +error[E0792]: expected generic type parameter, found `()` --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:20:27 | +LL | type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; + | - this generic parameter must be used with a generic type parameter +... LL | fn my_fun() -> Return<()> {} | ^^ - | -note: used non-generic type `()` for generic parameter - --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:13 - | -LL | type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; - | ^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0261`. +Some errors have detailed explanations: E0261, E0792. +For more information about an error, try `rustc --explain E0261`. |
