Skip to content

Commit a5b3d13

Browse files
Rollup merge of rust-lang#119323 - lukas-code:test-never-to-infinite, r=compiler-errors
add test for coercing never to infinite type Closes rust-lang#113197. This was fixed in rust-lang#118308, probably rust-lang@1978168.
2 parents e1be642 + 2903604 commit a5b3d13

5 files changed

+31
-1
lines changed
File renamed without changes.

tests/ui/sized/recursive-type-2.stderr tests/ui/sized/recursive-type-binding.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0391]: cycle detected when computing layout of `Foo<()>`
33
= note: ...which requires computing layout of `<() as A>::Assoc`...
44
= note: ...which again requires computing layout of `Foo<()>`, completing the cycle
55
note: cycle used when elaborating drops for `main`
6-
--> $DIR/recursive-type-2.rs:11:1
6+
--> $DIR/recursive-type-binding.rs:11:1
77
|
88
LL | fn main() {
99
| ^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// build-fail
2+
//~^ ERROR cycle detected when computing layout of `Foo<()>`
3+
4+
// Regression test for a stack overflow: https://github.com/rust-lang/rust/issues/113197
5+
6+
trait A { type Assoc; }
7+
8+
impl A for () {
9+
type Assoc = Foo<()>;
10+
}
11+
12+
struct Foo<T: A>(T::Assoc);
13+
14+
fn main() {
15+
Foo::<()>(todo!());
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0391]: cycle detected when computing layout of `Foo<()>`
2+
|
3+
= note: ...which requires computing layout of `<() as A>::Assoc`...
4+
= note: ...which again requires computing layout of `Foo<()>`, completing the cycle
5+
note: cycle used when elaborating drops for `main`
6+
--> $DIR/recursive-type-coercion-from-never.rs:14:1
7+
|
8+
LL | fn main() {
9+
| ^^^^^^^^^
10+
= 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
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0391`.
File renamed without changes.

0 commit comments

Comments
 (0)