diff --git a/tests/ui/associated-inherent-types/normalization-overflow.stderr b/tests/ui/associated-inherent-types/normalization-overflow.current.stderr similarity index 78% rename from tests/ui/associated-inherent-types/normalization-overflow.stderr rename to tests/ui/associated-inherent-types/normalization-overflow.current.stderr index 05aad31c5f419..e3e662788cf09 100644 --- a/tests/ui/associated-inherent-types/normalization-overflow.stderr +++ b/tests/ui/associated-inherent-types/normalization-overflow.current.stderr @@ -1,5 +1,5 @@ error: overflow evaluating associated type `T::This` - --> $DIR/normalization-overflow.rs:9:5 + --> $DIR/normalization-overflow.rs:14:5 | LL | type This = Self::This; | ^^^^^^^^^ diff --git a/tests/ui/associated-inherent-types/normalization-overflow.next.stderr b/tests/ui/associated-inherent-types/normalization-overflow.next.stderr new file mode 100644 index 0000000000000..5f0939b9f7763 --- /dev/null +++ b/tests/ui/associated-inherent-types/normalization-overflow.next.stderr @@ -0,0 +1,9 @@ +error[E0271]: type mismatch resolving `T::This normalizes-to _` + --> $DIR/normalization-overflow.rs:14:5 + | +LL | type This = Self::This; + | ^^^^^^^^^ types differ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-inherent-types/normalization-overflow.rs b/tests/ui/associated-inherent-types/normalization-overflow.rs index 4228238aa7b7a..c5505578f4f00 100644 --- a/tests/ui/associated-inherent-types/normalization-overflow.rs +++ b/tests/ui/associated-inherent-types/normalization-overflow.rs @@ -1,12 +1,19 @@ -#![feature(inherent_associated_types)] +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ [next] compile-flags: -Znext-solver + +#![feature(inherent_associated_types, rustc_attrs)] #![allow(incomplete_features)] +#![rustc_no_implicit_bounds] // FIXME(fmease): I'd prefer to report a cycle error here instead of an overflow one. struct T; impl T { - type This = Self::This; //~ ERROR overflow evaluating associated type `T::This` + type This = Self::This; + //[current]~^ ERROR: overflow evaluating associated type `T::This` + //[next]~^^ ERROR: type mismatch resolving `T::This normalizes-to _` } fn main() {} diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr new file mode 100644 index 0000000000000..1d6ace580951b --- /dev/null +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_new.stderr @@ -0,0 +1,21 @@ +error[E0271]: type mismatch resolving `X3 normalizes-to _` + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 + | +LL | type X1 = X2; + | ^^^^^^^ types differ + +error[E0271]: type mismatch resolving `X1 normalizes-to _` + --> $DIR/infinite-type-alias-mutual-recursion.rs:16:1 + | +LL | type X2 = X3; + | ^^^^^^^ types differ + +error[E0271]: type mismatch resolving `X2 normalizes-to _` + --> $DIR/infinite-type-alias-mutual-recursion.rs:19:1 + | +LL | type X3 = X1; + | ^^^^^^^ types differ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr new file mode 100644 index 0000000000000..c7adc3af02fab --- /dev/null +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.feature_old.stderr @@ -0,0 +1,27 @@ +error[E0275]: overflow normalizing the type alias `X2` + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 + | +LL | type X1 = X2; + | ^^^^^^^ + | + = note: in case this is a recursive type alias, consider using a struct, enum, or union instead + +error[E0275]: overflow normalizing the type alias `X3` + --> $DIR/infinite-type-alias-mutual-recursion.rs:16:1 + | +LL | type X2 = X3; + | ^^^^^^^ + | + = note: in case this is a recursive type alias, consider using a struct, enum, or union instead + +error[E0275]: overflow normalizing the type alias `X1` + --> $DIR/infinite-type-alias-mutual-recursion.rs:19:1 + | +LL | type X3 = X1; + | ^^^^^^^ + | + = note: in case this is a recursive type alias, consider using a struct, enum, or union instead + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated_new.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated_new.stderr new file mode 100644 index 0000000000000..888e1d18dea77 --- /dev/null +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated_new.stderr @@ -0,0 +1,30 @@ +error[E0391]: cycle detected when expanding type alias `X1` + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:11 + | +LL | type X1 = X2; + | ^^ + | +note: ...which requires expanding type alias `X2`... + --> $DIR/infinite-type-alias-mutual-recursion.rs:16:11 + | +LL | type X2 = X3; + | ^^ +note: ...which requires expanding type alias `X3`... + --> $DIR/infinite-type-alias-mutual-recursion.rs:19:11 + | +LL | type X3 = X1; + | ^^ + = note: ...which again requires expanding type alias `X1`, completing the cycle + = note: type aliases cannot be recursive + = help: consider using a struct, enum, or union instead to break the cycle + = help: see for more information +note: cycle used when checking that `X1` is well-formed + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 + | +LL | type X1 = X2; + | ^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated_old.stderr b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated_old.stderr new file mode 100644 index 0000000000000..888e1d18dea77 --- /dev/null +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.gated_old.stderr @@ -0,0 +1,30 @@ +error[E0391]: cycle detected when expanding type alias `X1` + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:11 + | +LL | type X1 = X2; + | ^^ + | +note: ...which requires expanding type alias `X2`... + --> $DIR/infinite-type-alias-mutual-recursion.rs:16:11 + | +LL | type X2 = X3; + | ^^ +note: ...which requires expanding type alias `X3`... + --> $DIR/infinite-type-alias-mutual-recursion.rs:19:11 + | +LL | type X3 = X1; + | ^^ + = note: ...which again requires expanding type alias `X1`, completing the cycle + = note: type aliases cannot be recursive + = help: consider using a struct, enum, or union instead to break the cycle + = help: see for more information +note: cycle used when checking that `X1` is well-formed + --> $DIR/infinite-type-alias-mutual-recursion.rs:12:1 + | +LL | type X1 = X2; + | ^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs index 6a43c4ac78720..24e1318ca3d7d 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs @@ -1,14 +1,23 @@ -//@ revisions: feature gated +//@ revisions: feature_old gated_old feature_new gated_new //@ ignore-parallel-frontend query cycle -#![cfg_attr(feature, feature(lazy_type_alias))] +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ [feature_new] compile-flags: -Znext-solver +//@ [gated_new] compile-flags: -Znext-solver + +#![feature(rustc_attrs)] +#![rustc_no_implicit_bounds] +#![cfg_attr(any(feature_old, feature_new), feature(lazy_type_alias))] #![allow(incomplete_features)] type X1 = X2; -//[gated]~^ ERROR cycle detected when expanding type alias `X1` -//[feature]~^^ ERROR: overflow normalizing the type alias `X2` +//[gated_old,gated_new]~^ ERROR cycle detected when expanding type alias `X1` +//[feature_old]~^^ ERROR: overflow normalizing the type alias `X2` +//[feature_new]~^^^ ERROR: type mismatch resolving `X3 normalizes-to _` type X2 = X3; -//[feature]~^ ERROR: overflow normalizing the type alias `X3` +//[feature_old]~^ ERROR: overflow normalizing the type alias `X3` +//[feature_new]~^^ ERROR: type mismatch resolving `X1 normalizes-to _` type X3 = X1; -//[feature]~^ ERROR: overflow normalizing the type alias `X1` +//[feature_old]~^ ERROR: overflow normalizing the type alias `X1` +//[feature_new]~^^ ERROR: type mismatch resolving `X2 normalizes-to _` fn main() {} diff --git a/tests/ui/traits/assoc-type-hrtb-normalization-30472.rs b/tests/ui/traits/normalize/assoc-type-hrtb-normalization-30472.rs similarity index 100% rename from tests/ui/traits/assoc-type-hrtb-normalization-30472.rs rename to tests/ui/traits/normalize/assoc-type-hrtb-normalization-30472.rs diff --git a/tests/ui/traits/copy-impl-cannot-normalize.rs b/tests/ui/traits/normalize/copy-impl-cannot-normalize.rs similarity index 100% rename from tests/ui/traits/copy-impl-cannot-normalize.rs rename to tests/ui/traits/normalize/copy-impl-cannot-normalize.rs diff --git a/tests/ui/traits/copy-impl-cannot-normalize.stderr b/tests/ui/traits/normalize/copy-impl-cannot-normalize.stderr similarity index 100% rename from tests/ui/traits/copy-impl-cannot-normalize.stderr rename to tests/ui/traits/normalize/copy-impl-cannot-normalize.stderr diff --git a/tests/ui/traits/deep-norm-pending.rs b/tests/ui/traits/normalize/deep-norm-pending.rs similarity index 100% rename from tests/ui/traits/deep-norm-pending.rs rename to tests/ui/traits/normalize/deep-norm-pending.rs diff --git a/tests/ui/traits/deep-norm-pending.stderr b/tests/ui/traits/normalize/deep-norm-pending.stderr similarity index 100% rename from tests/ui/traits/deep-norm-pending.stderr rename to tests/ui/traits/normalize/deep-norm-pending.stderr diff --git a/tests/ui/traits/normalize-associated-type-in-where-clause.rs b/tests/ui/traits/normalize/normalize-associated-type-in-where-clause.rs similarity index 100% rename from tests/ui/traits/normalize-associated-type-in-where-clause.rs rename to tests/ui/traits/normalize/normalize-associated-type-in-where-clause.rs diff --git a/tests/ui/traits/normalize-conflicting-impls.rs b/tests/ui/traits/normalize/normalize-conflicting-impls.rs similarity index 100% rename from tests/ui/traits/normalize-conflicting-impls.rs rename to tests/ui/traits/normalize/normalize-conflicting-impls.rs diff --git a/tests/ui/traits/normalize-conflicting-impls.stderr b/tests/ui/traits/normalize/normalize-conflicting-impls.stderr similarity index 100% rename from tests/ui/traits/normalize-conflicting-impls.stderr rename to tests/ui/traits/normalize/normalize-conflicting-impls.stderr diff --git a/tests/ui/traits/normalize/normalize-diverging-alias-in-defaulted-type-parameter.rs b/tests/ui/traits/normalize/normalize-diverging-alias-in-defaulted-type-parameter.rs new file mode 100644 index 0000000000000..c359f8363e53e --- /dev/null +++ b/tests/ui/traits/normalize/normalize-diverging-alias-in-defaulted-type-parameter.rs @@ -0,0 +1,25 @@ +// Ensure that defaulted type parameters whose default contains diverging aliases are properly +// caught with both solvers. This is currently not the case, and this is tracked in issue +// https://github.com/rust-lang/rust/issues/156271. +// MCVE from https://github.com/rust-lang/trait-system-refactor-initiative/issues/139#issuecomment-2704576249. + +//@ revisions: current next +//@ check-pass +//@ known-bug: #156271 +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ [next] compile-flags: -Znext-solver + +#![feature(rustc_attrs)] +#![rustc_no_implicit_bounds] + +trait Trait { + type Diverges; +} + +impl Trait for T { + type Diverges = D::Diverges; +} + +struct Bar::Diverges>(*mut T); + +fn main() {} diff --git a/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.current.stderr b/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.current.stderr new file mode 100644 index 0000000000000..7787d6b68f257 --- /dev/null +++ b/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.current.stderr @@ -0,0 +1,9 @@ +error[E0275]: overflow evaluating the requirement `::Diverges == _` + --> $DIR/normalize-diverging-alias-in-struct.rs:21:12 + | +LL | field: Box<::Diverges>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.next.stderr b/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.next.stderr new file mode 100644 index 0000000000000..d7046d2b058ba --- /dev/null +++ b/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.next.stderr @@ -0,0 +1,18 @@ +error[E0271]: type mismatch resolving `::Diverges normalizes-to _` + --> $DIR/normalize-diverging-alias-in-struct.rs:21:12 + | +LL | field: Box<::Diverges>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + +error[E0271]: type mismatch resolving `::Diverges normalizes-to _` + --> $DIR/normalize-diverging-alias-in-struct.rs:21:12 + | +LL | field: Box<::Diverges>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + | +note: required by a bound in `Box` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.rs b/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.rs new file mode 100644 index 0000000000000..45b2cb56c25f7 --- /dev/null +++ b/tests/ui/traits/normalize/normalize-diverging-alias-in-struct.rs @@ -0,0 +1,27 @@ +// Ensure that structs with fields whose types contain diverging aliases are properly caught with +// both solvers. +// MCVE from https://github.com/rust-lang/trait-system-refactor-initiative/issues/139#issuecomment-2703127026. + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ [next] compile-flags: -Znext-solver + +#![feature(rustc_attrs)] +#![rustc_no_implicit_bounds] + +trait Trait { + type Diverges; +} + +impl Trait for T { + type Diverges = D::Diverges; +} + +struct Foo { + field: Box<::Diverges>, + //[current]~^ ERROR: overflow evaluating the requirement `::Diverges == _` + //[next]~^^ ERROR: type mismatch resolving `::Diverges normalizes-to _` + //[next]~| ERROR: type mismatch resolving `::Diverges normalizes-to _` +} + +fn main() {} diff --git a/tests/ui/traits/normalize-supertrait.rs b/tests/ui/traits/normalize/normalize-supertrait.rs similarity index 100% rename from tests/ui/traits/normalize-supertrait.rs rename to tests/ui/traits/normalize/normalize-supertrait.rs diff --git a/tests/ui/traits/pointee-normalize-equate.rs b/tests/ui/traits/normalize/pointee-normalize-equate.rs similarity index 100% rename from tests/ui/traits/pointee-normalize-equate.rs rename to tests/ui/traits/normalize/pointee-normalize-equate.rs diff --git a/tests/ui/traits/self-referential-param-env-normalization.rs b/tests/ui/traits/normalize/self-referential-param-env-normalization.rs similarity index 100% rename from tests/ui/traits/self-referential-param-env-normalization.rs rename to tests/ui/traits/normalize/self-referential-param-env-normalization.rs diff --git a/tests/ui/traits/self-referential-param-env-normalization.stderr b/tests/ui/traits/normalize/self-referential-param-env-normalization.stderr similarity index 100% rename from tests/ui/traits/self-referential-param-env-normalization.stderr rename to tests/ui/traits/normalize/self-referential-param-env-normalization.stderr diff --git a/tests/ui/traits/unconstrained-projection-normalization-2.current.stderr b/tests/ui/traits/normalize/unconstrained-projection-normalization-2.current.stderr similarity index 100% rename from tests/ui/traits/unconstrained-projection-normalization-2.current.stderr rename to tests/ui/traits/normalize/unconstrained-projection-normalization-2.current.stderr diff --git a/tests/ui/traits/unconstrained-projection-normalization-2.next.stderr b/tests/ui/traits/normalize/unconstrained-projection-normalization-2.next.stderr similarity index 100% rename from tests/ui/traits/unconstrained-projection-normalization-2.next.stderr rename to tests/ui/traits/normalize/unconstrained-projection-normalization-2.next.stderr diff --git a/tests/ui/traits/unconstrained-projection-normalization-2.rs b/tests/ui/traits/normalize/unconstrained-projection-normalization-2.rs similarity index 100% rename from tests/ui/traits/unconstrained-projection-normalization-2.rs rename to tests/ui/traits/normalize/unconstrained-projection-normalization-2.rs diff --git a/tests/ui/traits/unconstrained-projection-normalization.current.stderr b/tests/ui/traits/normalize/unconstrained-projection-normalization.current.stderr similarity index 100% rename from tests/ui/traits/unconstrained-projection-normalization.current.stderr rename to tests/ui/traits/normalize/unconstrained-projection-normalization.current.stderr diff --git a/tests/ui/traits/unconstrained-projection-normalization.next.stderr b/tests/ui/traits/normalize/unconstrained-projection-normalization.next.stderr similarity index 100% rename from tests/ui/traits/unconstrained-projection-normalization.next.stderr rename to tests/ui/traits/normalize/unconstrained-projection-normalization.next.stderr diff --git a/tests/ui/traits/unconstrained-projection-normalization.rs b/tests/ui/traits/normalize/unconstrained-projection-normalization.rs similarity index 100% rename from tests/ui/traits/unconstrained-projection-normalization.rs rename to tests/ui/traits/normalize/unconstrained-projection-normalization.rs