diff --git a/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr new file mode 100644 index 0000000000000..77fbaf529348c --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr @@ -0,0 +1,8 @@ +error: the type `Foo::Bar>` is not well-formed + --> $DIR/wf-check-skipped.rs:17:14 + | +LL | fn main() -> Foo::Bar::> {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs index 3159500393e6a..5b812a2295ee6 100644 --- a/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs +++ b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs @@ -1,11 +1,13 @@ -//@ known-bug: #100041 -//@ check-pass +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] known-bug: #100041 +//@[current] check-pass +// FIXME(inherent_associated_types): This should fail. #![feature(inherent_associated_types)] #![allow(incomplete_features)] -// FIXME(inherent_associated_types): This should fail. - struct Foo; impl Foo { @@ -13,3 +15,4 @@ impl Foo { } fn main() -> Foo::Bar::> {} +//[next]~^ ERROR the type `Foo::Bar>` is not well-formed diff --git a/tests/ui/associated-types/defaults-unsound-62211-1.stderr b/tests/ui/associated-types/defaults-unsound-62211-1.current.stderr similarity index 89% rename from tests/ui/associated-types/defaults-unsound-62211-1.stderr rename to tests/ui/associated-types/defaults-unsound-62211-1.current.stderr index 5cd1cb4a1a712..9d52e923aded4 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/tests/ui/associated-types/defaults-unsound-62211-1.current.stderr @@ -1,12 +1,12 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-1.rs:20:96 + --> $DIR/defaults-unsound-62211-1.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ `Self` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:20:86 + --> $DIR/defaults-unsound-62211-1.rs:26:86 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -16,13 +16,13 @@ LL | trait UncheckedCopy: Sized + std::fmt::Display { | +++++++++++++++++++ error[E0277]: cannot add-assign `&'static str` to `Self` - --> $DIR/defaults-unsound-62211-1.rs:20:96 + --> $DIR/defaults-unsound-62211-1.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ no implementation for `Self += &'static str` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:20:47 + --> $DIR/defaults-unsound-62211-1.rs:26:47 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -32,13 +32,13 @@ LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { | +++++++++++++++++++++++++ error[E0277]: the trait bound `Self: Deref` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:20:96 + --> $DIR/defaults-unsound-62211-1.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ the trait `Deref` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:20:25 + --> $DIR/defaults-unsound-62211-1.rs:26:25 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -48,13 +48,13 @@ LL | trait UncheckedCopy: Sized + Deref { | +++++++ error[E0277]: the trait bound `Self: Copy` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:20:96 + --> $DIR/defaults-unsound-62211-1.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ the trait `Copy` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-1.rs:20:18 + --> $DIR/defaults-unsound-62211-1.rs:26:18 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ required by this bound in `UncheckedCopy::Output` diff --git a/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr b/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr new file mode 100644 index 0000000000000..834ae00a8d85b --- /dev/null +++ b/tests/ui/associated-types/defaults-unsound-62211-1.next.stderr @@ -0,0 +1,13 @@ +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing + --> $DIR/defaults-unsound-62211-1.rs:52:5 + | +LL | drop(origin); + | ^^^^^------^ + | | + | argument has type `::Output` + | + = note: use `let _ = ...` to ignore the expression or result + = note: `#[warn(dropping_copy_types)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/associated-types/defaults-unsound-62211-1.rs b/tests/ui/associated-types/defaults-unsound-62211-1.rs index fa6a208b4f1ba..d9cf5aa97acdf 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-1.rs +++ b/tests/ui/associated-types/defaults-unsound-62211-1.rs @@ -1,3 +1,9 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] known-bug: rust-lang/trait-system-refactor-initiative#46 +//@[next] check-pass + //! Regression test for https://github.com/rust-lang/rust/issues/62211 //! //! The old implementation of defaults did not check whether the provided @@ -18,10 +24,10 @@ trait UncheckedCopy: Sized { // This Output is said to be Copy. Yet we default to Self // and it's accepted, not knowing if Self ineed is Copy type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; - //~^ ERROR the trait bound `Self: Copy` is not satisfied - //~| ERROR the trait bound `Self: Deref` is not satisfied - //~| ERROR cannot add-assign `&'static str` to `Self` - //~| ERROR `Self` doesn't implement `std::fmt::Display` + //[current]~^ ERROR the trait bound `Self: Copy` is not satisfied + //[current]~| ERROR the trait bound `Self: Deref` is not satisfied + //[current]~| ERROR cannot add-assign `&'static str` to `Self` + //[current]~| ERROR `Self` doesn't implement `std::fmt::Display` // We said the Output type was Copy, so we can Copy it freely! fn unchecked_copy(other: &Self::Output) -> Self::Output { diff --git a/tests/ui/associated-types/defaults-unsound-62211-2.stderr b/tests/ui/associated-types/defaults-unsound-62211-2.current.stderr similarity index 89% rename from tests/ui/associated-types/defaults-unsound-62211-2.stderr rename to tests/ui/associated-types/defaults-unsound-62211-2.current.stderr index 89319bb7563cc..4fd2ca6408a1c 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/tests/ui/associated-types/defaults-unsound-62211-2.current.stderr @@ -1,12 +1,12 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-2.rs:20:96 + --> $DIR/defaults-unsound-62211-2.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ `Self` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:20:86 + --> $DIR/defaults-unsound-62211-2.rs:26:86 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -16,13 +16,13 @@ LL | trait UncheckedCopy: Sized + std::fmt::Display { | +++++++++++++++++++ error[E0277]: cannot add-assign `&'static str` to `Self` - --> $DIR/defaults-unsound-62211-2.rs:20:96 + --> $DIR/defaults-unsound-62211-2.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ no implementation for `Self += &'static str` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:20:47 + --> $DIR/defaults-unsound-62211-2.rs:26:47 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -32,13 +32,13 @@ LL | trait UncheckedCopy: Sized + AddAssign<&'static str> { | +++++++++++++++++++++++++ error[E0277]: the trait bound `Self: Deref` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:20:96 + --> $DIR/defaults-unsound-62211-2.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ the trait `Deref` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:20:25 + --> $DIR/defaults-unsound-62211-2.rs:26:25 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output` @@ -48,13 +48,13 @@ LL | trait UncheckedCopy: Sized + Deref { | +++++++ error[E0277]: the trait bound `Self: Copy` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:20:96 + --> $DIR/defaults-unsound-62211-2.rs:26:96 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ the trait `Copy` is not implemented for `Self` | note: required by a bound in `UncheckedCopy::Output` - --> $DIR/defaults-unsound-62211-2.rs:20:18 + --> $DIR/defaults-unsound-62211-2.rs:26:18 | LL | type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; | ^^^^ required by this bound in `UncheckedCopy::Output` diff --git a/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr b/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr new file mode 100644 index 0000000000000..0f944a18ed58b --- /dev/null +++ b/tests/ui/associated-types/defaults-unsound-62211-2.next.stderr @@ -0,0 +1,13 @@ +warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing + --> $DIR/defaults-unsound-62211-2.rs:52:5 + | +LL | drop(origin); + | ^^^^^------^ + | | + | argument has type `::Output` + | + = note: use `let _ = ...` to ignore the expression or result + = note: `#[warn(dropping_copy_types)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/associated-types/defaults-unsound-62211-2.rs b/tests/ui/associated-types/defaults-unsound-62211-2.rs index c13ec776afe2b..6cbac1bf2364a 100644 --- a/tests/ui/associated-types/defaults-unsound-62211-2.rs +++ b/tests/ui/associated-types/defaults-unsound-62211-2.rs @@ -1,3 +1,9 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] known-bug: rust-lang/trait-system-refactor-initiative#46 +//@[next] check-pass + //! Regression test for https://github.com/rust-lang/rust/issues/62211 //! //! The old implementation of defaults did not check whether the provided @@ -18,10 +24,10 @@ trait UncheckedCopy: Sized { // This Output is said to be Copy. Yet we default to Self // and it's accepted, not knowing if Self ineed is Copy type Output: Copy + Deref + AddAssign<&'static str> + From + Display = Self; - //~^ ERROR the trait bound `Self: Copy` is not satisfied - //~| ERROR the trait bound `Self: Deref` is not satisfied - //~| ERROR cannot add-assign `&'static str` to `Self` - //~| ERROR `Self` doesn't implement `std::fmt::Display` + //[current]~^ ERROR the trait bound `Self: Copy` is not satisfied + //[current]~| ERROR the trait bound `Self: Deref` is not satisfied + //[current]~| ERROR cannot add-assign `&'static str` to `Self` + //[current]~| ERROR `Self` doesn't implement `std::fmt::Display` // We said the Output type was Copy, so we can Copy it freely! fn unchecked_copy(other: &Self::Output) -> Self::Output { diff --git a/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.next.stderr b/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.next.stderr new file mode 100644 index 0000000000000..6e41561f1a7b6 --- /dev/null +++ b/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.next.stderr @@ -0,0 +1,9 @@ +error[E0284]: type annotations needed: cannot satisfy ` as Object>::Output == T` + --> $DIR/indirect-impl-for-trait-obj-coherence.rs:25:41 + | +LL | foo::, U>(x) + | ^ cannot satisfy ` as Object>::Output == T` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.rs b/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.rs index 201a46a166a87..0b66a6e783032 100644 --- a/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.rs +++ b/tests/ui/coherence/indirect-impl-for-trait-obj-coherence.rs @@ -1,5 +1,8 @@ -//@ check-pass -//@ known-bug: #57893 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-pass +//@[current] known-bug: #57893 // Should fail. Because we see an impl that uses a certain associated type, we // type-check assuming that impl is used. However, this conflicts with the @@ -20,6 +23,7 @@ fn foo(x: >::Output) -> U { #[allow(dead_code)] fn transmute(x: T) -> U { foo::, U>(x) + //[next]~^ ERROR type annotations needed: cannot satisfy ` as Object>::Output == T` } fn main() {} diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr similarity index 83% rename from tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr rename to tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr index 314a5509da8bc..2097115af0096 100644 --- a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr @@ -1,16 +1,16 @@ error[E0277]: the trait bound `::Bar<()>: Eq` is not satisfied - --> $DIR/assume-gat-normalization-for-nested-goals.rs:6:30 + --> $DIR/assume-gat-normalization-for-nested-goals.rs:10:30 | LL | type Bar: Baz = i32; | ^^^ the trait `Eq` is not implemented for `::Bar<()>`, which is required by `i32: Baz` | note: required for `i32` to implement `Baz` - --> $DIR/assume-gat-normalization-for-nested-goals.rs:13:23 + --> $DIR/assume-gat-normalization-for-nested-goals.rs:17:23 | LL | impl Baz for i32 where T::Bar<()>: Eq {} | ^^^^^^ ^^^ ------- unsatisfied trait bound introduced here note: required by a bound in `Foo::Bar` - --> $DIR/assume-gat-normalization-for-nested-goals.rs:6:18 + --> $DIR/assume-gat-normalization-for-nested-goals.rs:10:18 | LL | type Bar: Baz = i32; | ^^^^^^^^^ required by this bound in `Foo::Bar` diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs index fade3c441abec..56b50594e5239 100644 --- a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs @@ -1,4 +1,8 @@ -//@ known-bug: #117606 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] known-bug: #117606 +//@[next] check-pass #![feature(associated_type_defaults)] diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.next-solver.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.next-solver.stderr new file mode 100644 index 0000000000000..85c5dad7fc01a --- /dev/null +++ b/tests/ui/generic-associated-types/issue-90014-tait2.next-solver.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/issue-90014-tait2.rs:27:9 + | +LL | fn make_fut(&self) -> Box Trait<'a, Thing = Fut<'a>>> { + | ------------------------------------------- expected `Box<(dyn for<'a> Trait<'a, Thing = Fut<'a>> + 'static)>` because of return type +LL | Box::new((async { () },)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box>>`, found `Box<(...,)>` + | + = note: expected struct `Box<(dyn for<'a> Trait<'a, Thing = Fut<'a>> + 'static)>` + found struct `Box<({async block@$DIR/issue-90014-tait2.rs:27:19: 27:31},)>` + = help: `({async block@$DIR/issue-90014-tait2.rs:27:19: 27:31},)` implements `Trait` so you could box the found value and coerce it to the trait object `Box`, you will have to change the expected type as well + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/pointee-tail-is-generic.rs b/tests/ui/traits/pointee-tail-is-generic.rs index e33b2b2f2bc9d..14bdf0880c73b 100644 --- a/tests/ui/traits/pointee-tail-is-generic.rs +++ b/tests/ui/traits/pointee-tail-is-generic.rs @@ -4,10 +4,12 @@ #![feature(ptr_metadata)] #![feature(type_alias_impl_trait)] -type Opaque = impl std::future::Future; +mod opaque { + pub type Opaque = impl std::future::Future; -fn opaque() -> Opaque { - async {} + fn opaque() -> Opaque { + async {} + } } fn a() { @@ -16,7 +18,7 @@ fn a() { // tail of ADT (which is a type param) is known to be sized is_thin::>(); // opaque type is known to be sized - is_thin::(); + is_thin::(); } fn a2() { diff --git a/tests/ui/typeck/issue-103899.rs b/tests/ui/typeck/issue-103899.rs index 5876a34ef55c5..38882e9dc54da 100644 --- a/tests/ui/typeck/issue-103899.rs +++ b/tests/ui/typeck/issue-103899.rs @@ -1,7 +1,11 @@ -//@ check-fail -//@ failure-status: 101 -//@ dont-check-compiler-stderr -//@ known-bug: #103899 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-fail +//@[current] failure-status: 101 +//@[current] dont-check-compiler-stderr +//@[current] known-bug: #103899 trait BaseWithAssoc { type Assoc; diff --git a/tests/ui/wf/wf-normalization-sized.next.stderr b/tests/ui/wf/wf-normalization-sized.next.stderr new file mode 100644 index 0000000000000..599b1f3d45e66 --- /dev/null +++ b/tests/ui/wf/wf-normalization-sized.next.stderr @@ -0,0 +1,30 @@ +error: the type `<[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize` is not well-formed + --> $DIR/wf-normalization-sized.rs:19:10 + | +LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the type `<[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize` is not well-formed + --> $DIR/wf-normalization-sized.rs:19:10 + | +LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: the type ` as WellUnformed>::RequestNormalize` is not well-formed + --> $DIR/wf-normalization-sized.rs:22:10 + | +LL | const _: as WellUnformed>::RequestNormalize = (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the type ` as WellUnformed>::RequestNormalize` is not well-formed + --> $DIR/wf-normalization-sized.rs:22:10 + | +LL | const _: as WellUnformed>::RequestNormalize = (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/wf/wf-normalization-sized.rs b/tests/ui/wf/wf-normalization-sized.rs index e14be6b62bb26..e6e24ff9e8588 100644 --- a/tests/ui/wf/wf-normalization-sized.rs +++ b/tests/ui/wf/wf-normalization-sized.rs @@ -1,5 +1,8 @@ -//@ check-pass -//@ known-bug: #100041 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-pass +//@[current] known-bug: #100041 // Should fail. Normalization can bypass well-formedness checking. // `[[[[[[u8]]]]]]` is not a well-formed type since size of type `[u8]` cannot @@ -14,6 +17,10 @@ impl WellUnformed for T { } const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); +//[next]~^ the type +//[next]~| the type const _: as WellUnformed>::RequestNormalize = (); +//[next]~^ the type +//[next]~| the type fn main() {}