diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.next.stderr b/tests/ui/abi/invalid-self-parameter-type-56806.next.stderr new file mode 100644 index 0000000000000..2881d01ba23dc --- /dev/null +++ b/tests/ui/abi/invalid-self-parameter-type-56806.next.stderr @@ -0,0 +1,18 @@ +error[E0391]: cycle detected when checking if trait `Trait` is dyn-compatible + --> $DIR/invalid-self-parameter-type-56806.rs:11:1 + | +LL | pub trait Trait { + | ^^^^^^^^^^^^^^^ + | + = note: ...which requires determining dyn-compatibility of trait `Trait`... + = note: ...which again requires checking if trait `Trait` is dyn-compatible, completing the cycle +note: cycle used when checking that `Trait::dyn_instead_of_self` is well-formed + --> $DIR/invalid-self-parameter-type-56806.rs:12:5 + | +LL | fn dyn_instead_of_self(self: Box); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see and + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.stderr b/tests/ui/abi/invalid-self-parameter-type-56806.old.stderr similarity index 91% rename from tests/ui/abi/invalid-self-parameter-type-56806.stderr rename to tests/ui/abi/invalid-self-parameter-type-56806.old.stderr index ac249b8f10880..a034de9c3bcb3 100644 --- a/tests/ui/abi/invalid-self-parameter-type-56806.stderr +++ b/tests/ui/abi/invalid-self-parameter-type-56806.old.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>` - --> $DIR/invalid-self-parameter-type-56806.rs:3:34 + --> $DIR/invalid-self-parameter-type-56806.rs:12:34 | LL | fn dyn_instead_of_self(self: Box); | ^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.rs b/tests/ui/abi/invalid-self-parameter-type-56806.rs index 60229df300577..ac25489f59b32 100644 --- a/tests/ui/abi/invalid-self-parameter-type-56806.rs +++ b/tests/ui/abi/invalid-self-parameter-type-56806.rs @@ -1,7 +1,17 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + // https://github.com/rust-lang/rust/issues/56806 +// +// This results in a query cycle with the new solver. Let's not +// bother with this when stabilizing the new solver. For more context, +// see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/dyn.20compatibility.20check.20in.20object.20candidate.20causes.20cycle/with/627370998 + pub trait Trait { fn dyn_instead_of_self(self: Box); - //~^ ERROR invalid `self` parameter type + //[old]~^ ERROR: invalid `self` parameter type + //[next]~^^^ ERROR: cycle detected when checking if trait `Trait` is dyn-compatible } pub fn main() {} diff --git a/tests/ui/async-await/inference_var_self_argument.next.stderr b/tests/ui/async-await/inference_var_self_argument.next.stderr new file mode 100644 index 0000000000000..1d321b9f34fde --- /dev/null +++ b/tests/ui/async-await/inference_var_self_argument.next.stderr @@ -0,0 +1,18 @@ +error[E0391]: cycle detected when checking if trait `Foo` is dyn-compatible + --> $DIR/inference_var_self_argument.rs:13:1 + | +LL | trait Foo { + | ^^^^^^^^^ + | + = note: ...which requires determining dyn-compatibility of trait `Foo`... + = note: ...which again requires checking if trait `Foo` is dyn-compatible, completing the cycle +note: cycle used when checking that `Foo::foo` is well-formed + --> $DIR/inference_var_self_argument.rs:15:5 + | +LL | async fn foo(self: &dyn Foo) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see and + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/async-await/inference_var_self_argument.stderr b/tests/ui/async-await/inference_var_self_argument.old.stderr similarity index 88% rename from tests/ui/async-await/inference_var_self_argument.stderr rename to tests/ui/async-await/inference_var_self_argument.old.stderr index c4240a095e685..9460138d450a1 100644 --- a/tests/ui/async-await/inference_var_self_argument.stderr +++ b/tests/ui/async-await/inference_var_self_argument.old.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `&dyn Foo` - --> $DIR/inference_var_self_argument.rs:5:24 + --> $DIR/inference_var_self_argument.rs:15:24 | LL | async fn foo(self: &dyn Foo) { | ^^^^^^^^ @@ -8,17 +8,18 @@ LL | async fn foo(self: &dyn Foo) { = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/inference_var_self_argument.rs:5:33 + --> $DIR/inference_var_self_argument.rs:15:33 | LL | async fn foo(self: &dyn Foo) { | ^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/inference_var_self_argument.rs:5:14 + --> $DIR/inference_var_self_argument.rs:15:14 | LL | trait Foo { | --- this trait is not dyn compatible... +LL | LL | async fn foo(self: &dyn Foo) { | ^^^ ...because method `foo` is `async` = help: consider moving `foo` to another trait diff --git a/tests/ui/async-await/inference_var_self_argument.rs b/tests/ui/async-await/inference_var_self_argument.rs index d03f2b5c50bff..b07303476c4a4 100644 --- a/tests/ui/async-await/inference_var_self_argument.rs +++ b/tests/ui/async-await/inference_var_self_argument.rs @@ -1,10 +1,20 @@ -//! This is a regression test for an ICE. +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ edition: 2021 +// This is a regression test for an ICE. +// +// This results in a query cycle with the new solver. Let's not +// bother with this when stabilizing the new solver. For more context, +// see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/dyn.20compatibility.20check.20in.20object.20candidate.20causes.20cycle/with/627370998 + + trait Foo { + //[next]~^ ERROR: cycle detected when checking if trait `Foo` is dyn-compatible async fn foo(self: &dyn Foo) { - //~^ ERROR: `Foo` is not dyn compatible - //~| ERROR invalid `self` parameter type: `&dyn Foo` + //[old]~^ ERROR: `Foo` is not dyn compatible + //[old]~| ERROR: invalid `self` parameter type: `&dyn Foo` todo!() } } diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds.rs b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs index 3f9246f68fcd3..bd819e42a49da 100644 --- a/tests/ui/borrowck/alias-liveness/escaping-bounds.rs +++ b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // Ensure that we don't ICE when an alias that has escaping bound vars is @@ -16,7 +19,7 @@ fn foo<'a, 'b, T: Foo>(_: ::Assoc<'a, 'b>) {} fn test<'b, T: Foo>() { let y: MentionsLifetimeAndType<'_, for<'a> fn(::Assoc<'a, 'b>)> = - MentionsLifetimeAndType(&(), foo); + MentionsLifetimeAndType(&(), foo::); } fn main() {} diff --git a/tests/ui/delegation/fn-header.next.stderr b/tests/ui/delegation/fn-header.next.stderr new file mode 100644 index 0000000000000..adca7d80a9b1d --- /dev/null +++ b/tests/ui/delegation/fn-header.next.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/fn-header.rs:23:17 + | +LL | reuse to_reuse::async_fn; + | ^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/delegation/fn-header.rs b/tests/ui/delegation/fn-header.rs index 16e3c10136ce0..8aae776e295ff 100644 --- a/tests/ui/delegation/fn-header.rs +++ b/tests/ui/delegation/fn-header.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#304 +//@[old] check-pass //@ edition:2018 //@ aux-crate:fn_header_aux=fn-header-aux.rs //@ ignore-backends: gcc diff --git a/tests/ui/delegation/impl-trait.next.stderr b/tests/ui/delegation/impl-trait.next.stderr new file mode 100644 index 0000000000000..84e1e8ec4453a --- /dev/null +++ b/tests/ui/delegation/impl-trait.next.stderr @@ -0,0 +1,19 @@ +error[E0282]: type annotations needed + --> $DIR/impl-trait.rs:13:17 + | +LL | reuse to_reuse::foo; + | ^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error[E0282]: type annotations needed + --> $DIR/impl-trait.rs:23:21 + | +LL | reuse to_reuse::foo; + | ^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/delegation/impl-trait.rs b/tests/ui/delegation/impl-trait.rs index cb86a048a18e9..3b0d1a0383549 100644 --- a/tests/ui/delegation/impl-trait.rs +++ b/tests/ui/delegation/impl-trait.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#304 +//@[old] check-pass #![feature(fn_delegation)] diff --git a/tests/ui/impl-trait/member-constraints/incomplete-constraint.next.stderr b/tests/ui/impl-trait/member-constraints/incomplete-constraint.next.stderr new file mode 100644 index 0000000000000..d00ac00232591 --- /dev/null +++ b/tests/ui/impl-trait/member-constraints/incomplete-constraint.next.stderr @@ -0,0 +1,26 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/incomplete-constraint.rs:15:5 + | +LL | new_defining_use(rpit1::<'a, 'b>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'b ()`, got `&'static ()` + | +note: previous use here + --> $DIR/incomplete-constraint.rs:14:1 + | +LL | fn rpit1<'a, 'b: 'b>(x: &'b ()) -> impl Sized + use<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: concrete type differs from previous defining opaque type use + --> $DIR/incomplete-constraint.rs:21:5 + | +LL | new_defining_use(rpit2::<'a>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Inv<'a, 'static>`, got `Inv<'a, 'a>` + | +note: previous use here + --> $DIR/incomplete-constraint.rs:20:1 + | +LL | fn rpit2<'a>(_: ()) -> impl Sized + use<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs b/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs index 4c085cc1eedf8..e619a07e1f435 100644 --- a/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs +++ b/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs @@ -1,5 +1,8 @@ -//@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#227 +//@[old] check-pass // These functions currently do not normalize the opaque type but will do // so in the future. At this point we've got a new use of the opaque with fully diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr new file mode 100644 index 0000000000000..1459453b6d8f6 --- /dev/null +++ b/tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/recursive-impl-trait-type-direct.rs:13:14 + | +LL | fn test() -> impl Sized { + | ^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs b/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs index 1d82f89d7a1a3..6234c1c71b946 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs +++ b/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs @@ -1,8 +1,17 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[old] check-pass #![allow(unconditional_recursion)] +// The new solver does not allow unconstrained opaque types and unlike +// the old solver, does not fall back to `()` here. +// +// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/144. + fn test() -> impl Sized { + //[next]~^ ERROR: type annotations needed test() } diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.next.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.next.stderr new file mode 100644 index 0000000000000..5e1bae55aee06 --- /dev/null +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.next.stderr @@ -0,0 +1,18 @@ +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs:11:4 + | +LL | fn foo() -> Foo { + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs:8:16 + | +LL | pub type Foo = impl PartialEq<(Foo, i32)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Foo == _` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs index 662c7ee2ecf0b..85f53be6b1bca 100644 --- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs @@ -1,6 +1,9 @@ #![feature(type_alias_impl_trait)] - -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#143 +//@[old] check-pass pub type Foo = impl PartialEq<(Foo, i32)>; diff --git a/tests/ui/implied-bounds/gluon_salsa.next.stderr b/tests/ui/implied-bounds/gluon_salsa.next.stderr new file mode 100644 index 0000000000000..dfeb8456ea067 --- /dev/null +++ b/tests/ui/implied-bounds/gluon_salsa.next.stderr @@ -0,0 +1,13 @@ +error[E0309]: the associated type `>::SendDb` may not live long enough + --> $DIR/gluon_salsa.rs:46:26 + | +LL | pub fn get_async<'a>(&'a mut self) { + | -- ^^^^^^^^^^^^ ...so that the type `QueryTable<'me, Q, >::SendDb>` will meet its required lifetime bounds + | | + | the associated type `>::SendDb` must be valid for the lifetime `'a` as defined here... + | + = help: consider adding an explicit lifetime bound `>::SendDb: 'a`... + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/implied-bounds/gluon_salsa.rs b/tests/ui/implied-bounds/gluon_salsa.rs index cc6352c4a32e9..338b6fe5fb5c8 100644 --- a/tests/ui/implied-bounds/gluon_salsa.rs +++ b/tests/ui/implied-bounds/gluon_salsa.rs @@ -1,6 +1,20 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[old] check-pass + // Related to Bevy regression #115559, found in // a crater run on #118553. +// +// Normalizing when computing implied bounds and normalizing the +// signature when checking that it is well-formed happen separately. +// +// In the old solver both use the projection_cache so the resulting type +// has the same unconstrained infer var. +// +// The new solver does not have any per-infcx caches, so the unconstrained +// variables differ, causing lexical region error to fail to prove the relevant +// type outlives. pub trait QueryBase { type Db; @@ -30,6 +44,7 @@ where // to work we may have to structurally resolve regions as the actually used vars may // otherwise be semantically equal but structurally different. pub fn get_async<'a>(&'a mut self) { + //[next]~^ ERROR: the associated type `>::SendDb` may not live long enough panic!(); } } diff --git a/tests/ui/transmutability/alignment/align-pass.next.stderr b/tests/ui/transmutability/alignment/align-pass.next.stderr new file mode 100644 index 0000000000000..2095e97cc3915 --- /dev/null +++ b/tests/ui/transmutability/alignment/align-pass.next.stderr @@ -0,0 +1,29 @@ +error[E0277]: `&[u16; 0]` cannot be safely transmuted into `&[u8; 0]` + --> $DIR/align-pass.rs:25:56 + | +LL | assert::is_maybe_transmutable::<&'static [u16; 0], &'static [u8; 0]>(); + | ^^^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static [u16; 0], Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static [u8; 0]` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/align-pass.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` +help: consider removing the leading `&`-reference + | +LL - assert::is_maybe_transmutable::<&'static [u16; 0], &'static [u8; 0]>(); +LL + assert::is_maybe_transmutable::<&'static [u16; 0], [u8; 0]>(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/alignment/align-pass.rs b/tests/ui/transmutability/alignment/align-pass.rs index feecf5edaa1ac..fa40c3a3ade43 100644 --- a/tests/ui/transmutability/alignment/align-pass.rs +++ b/tests/ui/transmutability/alignment/align-pass.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/accept_assume_lifetime_extension.next.stderr b/tests/ui/transmutability/references/accept_assume_lifetime_extension.next.stderr new file mode 100644 index 0000000000000..4c469fd2222e3 --- /dev/null +++ b/tests/ui/transmutability/references/accept_assume_lifetime_extension.next.stderr @@ -0,0 +1,138 @@ +error[E0277]: `&u8` cannot be safely transmuted into `&u8` + --> $DIR/accept_assume_lifetime_extension.rs:24:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<&u8, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `&u8` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `&&u8` cannot be safely transmuted into `&&u8` + --> $DIR/accept_assume_lifetime_extension.rs:32:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<&&u8, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `&&u8` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `(&u8,)` cannot be safely transmuted into `(&u8,)` + --> $DIR/accept_assume_lifetime_extension.rs:40:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<(&u8,), std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `(&u8,)` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `(&u8, u8)` cannot be safely transmuted into `(&u8, u8)` + --> $DIR/accept_assume_lifetime_extension.rs:44:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<(&u8, u8), std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `(&u8, u8)` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `r#struct::Struct<'_>` cannot be safely transmuted into `r#struct::Struct<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:54:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `r#struct::Struct<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:51:5 + | +LL | struct Struct<'a>(&'a u8); + | ^^^^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `Single<'_>` cannot be safely transmuted into `Single<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:66:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `Single<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:61:5 + | +LL | enum Single<'a> { + | ^^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `Multi<'_>` cannot be safely transmuted into `Multi<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:76:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `Multi<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:69:5 + | +LL | enum Multi<'a> { + | ^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `&u8` cannot be safely transmuted into `&u8` + --> $DIR/accept_assume_lifetime_extension.rs:84:18 + | +LL | unsafe { extend_hrtb(src) } + | ^^^^^^^^^^^^---^ + | | | + | | `&u8` doesn't satisfy the trait bound + | unsatisfied trait bound + | + = help: the nightly-only, unstable trait `for<'b> std::mem::TransmuteFrom<&u8, std::mem::Assume { alignment: false, lifetimes: true, safety: false, validity: false }>` is not implemented for `&'b u8` +note: required by a bound in `extend_hrtb` + --> $DIR/accept_assume_lifetime_extension.rs:89:25 + | +LL | unsafe fn extend_hrtb<'a>(src: &'a u8) -> &'static u8 +LL | where +LL | for<'b> &'b u8: TransmuteFrom<&'a u8, { Assume::LIFETIMES }>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extend_hrtb` + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs b/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs index edad02fc96d22..86feb3c40eb7d 100644 --- a/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs +++ b/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass //! Accept lifetime extensions with `Assume::LIFETIMES`. diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.next.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.next.stderr new file mode 100644 index 0000000000000..32156298a1f6f --- /dev/null +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.next.stderr @@ -0,0 +1,24 @@ +error[E0277]: `&A` cannot be safely transmuted into `&B` + --> $DIR/recursive-wrapper-types-bit-compatible.rs:27:49 + | +LL | assert::is_maybe_transmutable::<&'static A, &'static B>(); + | ^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static A, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static B` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/recursive-wrapper-types-bit-compatible.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs index 8e2da3518a961..f1bb503549968 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.next.stderr b/tests/ui/transmutability/references/recursive-wrapper-types.next.stderr new file mode 100644 index 0000000000000..8ea346d7c08b5 --- /dev/null +++ b/tests/ui/transmutability/references/recursive-wrapper-types.next.stderr @@ -0,0 +1,45 @@ +error[E0277]: `&A` cannot be safely transmuted into `&B` + --> $DIR/recursive-wrapper-types.rs:27:49 + | +LL | assert::is_maybe_transmutable::<&'static A, &'static B>(); + | ^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static A, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static B` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/recursive-wrapper-types.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `&B` cannot be safely transmuted into `&A` + --> $DIR/recursive-wrapper-types.rs:28:49 + | +LL | assert::is_maybe_transmutable::<&'static B, &'static A>(); + | ^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static B, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static A` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/recursive-wrapper-types.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.rs b/tests/ui/transmutability/references/recursive-wrapper-types.rs index 53dedeb6388f5..7ff458aa2512b 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/u8-to-unit.next.stderr b/tests/ui/transmutability/references/u8-to-unit.next.stderr new file mode 100644 index 0000000000000..0897833202826 --- /dev/null +++ b/tests/ui/transmutability/references/u8-to-unit.next.stderr @@ -0,0 +1,29 @@ +error[E0277]: `&u8` cannot be safely transmuted into `&Unit` + --> $DIR/u8-to-unit.rs:26:50 + | +LL | assert::is_maybe_transmutable::<&'static u8, &'static Unit>(); + | ^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static u8, Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `&'static Unit` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/u8-to-unit.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` +help: consider removing the leading `&`-reference + | +LL - assert::is_maybe_transmutable::<&'static u8, &'static Unit>(); +LL + assert::is_maybe_transmutable::<&'static u8, Unit>(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/u8-to-unit.rs b/tests/ui/transmutability/references/u8-to-unit.rs index 98deb6457cb07..df124cafda3d6 100644 --- a/tests/ui/transmutability/references/u8-to-unit.rs +++ b/tests/ui/transmutability/references/u8-to-unit.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/unit-to-itself.next.stderr b/tests/ui/transmutability/references/unit-to-itself.next.stderr new file mode 100644 index 0000000000000..4a15b3b3d5c30 --- /dev/null +++ b/tests/ui/transmutability/references/unit-to-itself.next.stderr @@ -0,0 +1,29 @@ +error[E0277]: `&Unit` cannot be safely transmuted into `&Unit` + --> $DIR/unit-to-itself.rs:26:52 + | +LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); + | ^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static Unit, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static Unit` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/unit-to-itself.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` +help: consider removing the leading `&`-reference + | +LL - assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); +LL + assert::is_maybe_transmutable::<&'static Unit, Unit>(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/unit-to-itself.rs b/tests/ui/transmutability/references/unit-to-itself.rs index 789455c03ea17..87d001222f96e 100644 --- a/tests/ui/transmutability/references/unit-to-itself.rs +++ b/tests/ui/transmutability/references/unit-to-itself.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.next.stderr b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.next.stderr new file mode 100644 index 0000000000000..2cbaa71262cea --- /dev/null +++ b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.next.stderr @@ -0,0 +1,18 @@ +error[E0277]: `&mut Src` cannot be safely transmuted into `&mut u8` + --> $DIR/should_accept_if_ref_src_has_safety_invariant.rs:29:41 + | +LL | assert::is_transmutable::<&mut Src, &mut Dst>(); + | ^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&mut Src, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&mut u8` +note: required by a bound in `is_transmutable` + --> $DIR/should_accept_if_ref_src_has_safety_invariant.rs:19:14 + | +LL | pub fn is_transmutable() +LL | where +LL | Dst: TransmuteFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs index eca7a06559d21..32d70c3298eda 100644 --- a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass //! When safety is assumed, a transmutation over exclusive references should be //! accepted if the source type potentially carries safety invariants. diff --git a/tests/ui/transmutability/transmute-higher-ranked.next.stderr b/tests/ui/transmutability/transmute-higher-ranked.next.stderr new file mode 100644 index 0000000000000..9d86559f62bcc --- /dev/null +++ b/tests/ui/transmutability/transmute-higher-ranked.next.stderr @@ -0,0 +1,18 @@ +error[E0277]: `&&u32` cannot be safely transmuted into `&&i32` + --> $DIR/transmute-higher-ranked.rs:21:5 + | +LL | transmute(); + | ^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `for<'a> TransmuteFrom<&'a &'a u32, Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `&'a &'a i32` +note: required by a bound in `transmute` + --> $DIR/transmute-higher-ranked.rs:16:26 + | +LL | pub fn transmute() +LL | where +LL | for<'a> &'a &'a i32: TransmuteFrom<&'a &'a u32>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/transmute-higher-ranked.rs b/tests/ui/transmutability/transmute-higher-ranked.rs index f0fe02a7908ee..fc0753942906a 100644 --- a/tests/ui/transmutability/transmute-higher-ranked.rs +++ b/tests/ui/transmutability/transmute-higher-ranked.rs @@ -1,7 +1,11 @@ // Ensure we don't ICE when transmuting higher-ranked types via a // higher-ranked transmute goal. -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] diff --git a/tests/ui/type-alias-impl-trait/struct-assignment-validity.next.stderr b/tests/ui/type-alias-impl-trait/struct-assignment-validity.next.stderr new file mode 100644 index 0000000000000..78724a5ccec1c --- /dev/null +++ b/tests/ui/type-alias-impl-trait/struct-assignment-validity.next.stderr @@ -0,0 +1,23 @@ +error[E0391]: cycle detected when computing type of `::Assoc::{opaque#0}` + --> $DIR/struct-assignment-validity.rs:21:18 + | +LL | type Assoc = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which requires computing type of opaque `::Assoc::{opaque#0}`... +note: ...which requires borrow-checking `::foo`... + --> $DIR/struct-assignment-validity.rs:22:5 + | +LL | / fn foo() -> Foo +LL | | where +LL | | Self::Assoc:, + | |_____________________^ + = note: ...which requires promoting constants in MIR for `::foo`... + = note: ...which requires normalizing `::Assoc`... + = note: ...which again requires computing type of `::Assoc::{opaque#0}`, completing the cycle + = note: cycle used when checking that `::Assoc::{opaque#0}` is well-formed + = note: for more information, see and + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs b/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs index c52dbd3253905..608c804be9c94 100644 --- a/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs +++ b/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs @@ -1,5 +1,9 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#303 //@ compile-flags: -Zvalidate-mir -//@ check-pass +//@[old] check-pass // Check that we don't cause cycle errors when validating pre-`RevealOpaques` MIR // that assigns opaques through normalized projections.