forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
5 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// build-fail | ||
//~^ ERROR cycle detected when computing layout of `Foo<()>` | ||
|
||
// Regression test for a stack overflow: https://github.com/rust-lang/rust/issues/113197 | ||
|
||
trait A { type Assoc; } | ||
|
||
impl A for () { | ||
type Assoc = Foo<()>; | ||
} | ||
|
||
struct Foo<T: A>(T::Assoc); | ||
|
||
fn main() { | ||
Foo::<()>(todo!()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0391]: cycle detected when computing layout of `Foo<()>` | ||
| | ||
= note: ...which requires computing layout of `<() as A>::Assoc`... | ||
= note: ...which again requires computing layout of `Foo<()>`, completing the cycle | ||
note: cycle used when elaborating drops for `main` | ||
--> $DIR/recursive-type-coercion-from-never.rs:14:1 | ||
| | ||
LL | fn main() { | ||
| ^^^^^^^^^ | ||
= 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`. |
File renamed without changes.