Skip to content

Commit 76b4d0e

Browse files
authored
Unrolled build for #156250
Rollup merge of #156250 - lqd:normalization-tests, r=lcnr add a few new solver normalization tests As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/593097133), this PR adds the handful of new solver revisions and tests from rust-lang/trait-system-refactor-initiative#139. Most cases that issue mentions were already fixed by #140672 in 1.88, and some cases, we expect, by #155767. The issue about defaulted type parameters applies to both solvers and will be tracked in #156271 instead. Closes rust-lang/trait-system-refactor-initiative#139. r? lcnr I'm not sure where the best place for the tests would be, do you have a better location in mind?
2 parents 32bd660 + 130b1d8 commit 76b4d0e

30 files changed

Lines changed: 221 additions & 9 deletions

tests/ui/associated-inherent-types/normalization-overflow.stderr renamed to tests/ui/associated-inherent-types/normalization-overflow.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: overflow evaluating associated type `T::This`
2-
--> $DIR/normalization-overflow.rs:9:5
2+
--> $DIR/normalization-overflow.rs:14:5
33
|
44
LL | type This = Self::This;
55
| ^^^^^^^^^
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0271]: type mismatch resolving `T::This normalizes-to _`
2+
--> $DIR/normalization-overflow.rs:14:5
3+
|
4+
LL | type This = Self::This;
5+
| ^^^^^^^^^ types differ
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0271`.
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
#![feature(inherent_associated_types)]
1+
//@ revisions: current next
2+
//@ ignore-compare-mode-next-solver (explicit revisions)
3+
//@ [next] compile-flags: -Znext-solver
4+
5+
#![feature(inherent_associated_types, rustc_attrs)]
26
#![allow(incomplete_features)]
7+
#![rustc_no_implicit_bounds]
38

49
// FIXME(fmease): I'd prefer to report a cycle error here instead of an overflow one.
510

611
struct T;
712

813
impl T {
9-
type This = Self::This; //~ ERROR overflow evaluating associated type `T::This`
14+
type This = Self::This;
15+
//[current]~^ ERROR: overflow evaluating associated type `T::This`
16+
//[next]~^^ ERROR: type mismatch resolving `T::This normalizes-to _`
1017
}
1118

1219
fn main() {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0271]: type mismatch resolving `X3 normalizes-to _`
2+
--> $DIR/infinite-type-alias-mutual-recursion.rs:12:1
3+
|
4+
LL | type X1 = X2;
5+
| ^^^^^^^ types differ
6+
7+
error[E0271]: type mismatch resolving `X1 normalizes-to _`
8+
--> $DIR/infinite-type-alias-mutual-recursion.rs:16:1
9+
|
10+
LL | type X2 = X3;
11+
| ^^^^^^^ types differ
12+
13+
error[E0271]: type mismatch resolving `X2 normalizes-to _`
14+
--> $DIR/infinite-type-alias-mutual-recursion.rs:19:1
15+
|
16+
LL | type X3 = X1;
17+
| ^^^^^^^ types differ
18+
19+
error: aborting due to 3 previous errors
20+
21+
For more information about this error, try `rustc --explain E0271`.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0275]: overflow normalizing the type alias `X2`
2+
--> $DIR/infinite-type-alias-mutual-recursion.rs:12:1
3+
|
4+
LL | type X1 = X2;
5+
| ^^^^^^^
6+
|
7+
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
8+
9+
error[E0275]: overflow normalizing the type alias `X3`
10+
--> $DIR/infinite-type-alias-mutual-recursion.rs:16:1
11+
|
12+
LL | type X2 = X3;
13+
| ^^^^^^^
14+
|
15+
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
16+
17+
error[E0275]: overflow normalizing the type alias `X1`
18+
--> $DIR/infinite-type-alias-mutual-recursion.rs:19:1
19+
|
20+
LL | type X3 = X1;
21+
| ^^^^^^^
22+
|
23+
= note: in case this is a recursive type alias, consider using a struct, enum, or union instead
24+
25+
error: aborting due to 3 previous errors
26+
27+
For more information about this error, try `rustc --explain E0275`.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0391]: cycle detected when expanding type alias `X1`
2+
--> $DIR/infinite-type-alias-mutual-recursion.rs:12:11
3+
|
4+
LL | type X1 = X2;
5+
| ^^
6+
|
7+
note: ...which requires expanding type alias `X2`...
8+
--> $DIR/infinite-type-alias-mutual-recursion.rs:16:11
9+
|
10+
LL | type X2 = X3;
11+
| ^^
12+
note: ...which requires expanding type alias `X3`...
13+
--> $DIR/infinite-type-alias-mutual-recursion.rs:19:11
14+
|
15+
LL | type X3 = X1;
16+
| ^^
17+
= note: ...which again requires expanding type alias `X1`, completing the cycle
18+
= note: type aliases cannot be recursive
19+
= help: consider using a struct, enum, or union instead to break the cycle
20+
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
21+
note: cycle used when checking that `X1` is well-formed
22+
--> $DIR/infinite-type-alias-mutual-recursion.rs:12:1
23+
|
24+
LL | type X1 = X2;
25+
| ^^^^^^^
26+
= 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
27+
28+
error: aborting due to 1 previous error
29+
30+
For more information about this error, try `rustc --explain E0391`.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0391]: cycle detected when expanding type alias `X1`
2+
--> $DIR/infinite-type-alias-mutual-recursion.rs:12:11
3+
|
4+
LL | type X1 = X2;
5+
| ^^
6+
|
7+
note: ...which requires expanding type alias `X2`...
8+
--> $DIR/infinite-type-alias-mutual-recursion.rs:16:11
9+
|
10+
LL | type X2 = X3;
11+
| ^^
12+
note: ...which requires expanding type alias `X3`...
13+
--> $DIR/infinite-type-alias-mutual-recursion.rs:19:11
14+
|
15+
LL | type X3 = X1;
16+
| ^^
17+
= note: ...which again requires expanding type alias `X1`, completing the cycle
18+
= note: type aliases cannot be recursive
19+
= help: consider using a struct, enum, or union instead to break the cycle
20+
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
21+
note: cycle used when checking that `X1` is well-formed
22+
--> $DIR/infinite-type-alias-mutual-recursion.rs:12:1
23+
|
24+
LL | type X1 = X2;
25+
| ^^^^^^^
26+
= 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
27+
28+
error: aborting due to 1 previous error
29+
30+
For more information about this error, try `rustc --explain E0391`.
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
//@ revisions: feature gated
1+
//@ revisions: feature_old gated_old feature_new gated_new
22
//@ ignore-parallel-frontend query cycle
3-
#![cfg_attr(feature, feature(lazy_type_alias))]
3+
//@ ignore-compare-mode-next-solver (explicit revisions)
4+
//@ [feature_new] compile-flags: -Znext-solver
5+
//@ [gated_new] compile-flags: -Znext-solver
6+
7+
#![feature(rustc_attrs)]
8+
#![rustc_no_implicit_bounds]
9+
#![cfg_attr(any(feature_old, feature_new), feature(lazy_type_alias))]
410
#![allow(incomplete_features)]
511

612
type X1 = X2;
7-
//[gated]~^ ERROR cycle detected when expanding type alias `X1`
8-
//[feature]~^^ ERROR: overflow normalizing the type alias `X2`
13+
//[gated_old,gated_new]~^ ERROR cycle detected when expanding type alias `X1`
14+
//[feature_old]~^^ ERROR: overflow normalizing the type alias `X2`
15+
//[feature_new]~^^^ ERROR: type mismatch resolving `X3 normalizes-to _`
916
type X2 = X3;
10-
//[feature]~^ ERROR: overflow normalizing the type alias `X3`
17+
//[feature_old]~^ ERROR: overflow normalizing the type alias `X3`
18+
//[feature_new]~^^ ERROR: type mismatch resolving `X1 normalizes-to _`
1119
type X3 = X1;
12-
//[feature]~^ ERROR: overflow normalizing the type alias `X1`
20+
//[feature_old]~^ ERROR: overflow normalizing the type alias `X1`
21+
//[feature_new]~^^ ERROR: type mismatch resolving `X2 normalizes-to _`
1322

1423
fn main() {}

tests/ui/traits/assoc-type-hrtb-normalization-30472.rs renamed to tests/ui/traits/normalize/assoc-type-hrtb-normalization-30472.rs

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)