Open
Description
tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs
// build-fail
// normalize-stderr-test: ".nll/" -> "/"
// ignore-compare-mode-next-solver (hangs)
trait Mirror {
type Image;
}
impl<T> Mirror for T { type Image = T; }
trait Foo {
fn recurse(&self);
}
impl<T> Foo for T {
#[allow(unconditional_recursion)]
fn recurse(&self) {
(self, self).recurse(); //~ ERROR reached the recursion limit
}
}
fn main() {
().recurse();
}
cargo check or build:
error: reached the recursion limit while instantiating `<(&(&(..., ...), ...), ...) as Foo>::recurse`
--> src/main.rs:18:9
|
18 | (self, self).recurse(); //~ ERROR reached the recursion limit
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: `<T as Foo>::recurse` defined here
--> src/main.rs:17:5
|
17 | fn recurse(&self) {
| ^^^^^^^^^^^^^^^^^
= note: the full type name has been written to '/tmp/im/mri/target/release/deps/mri-6a905e68387b7bf1.long-type.txt'
error: could not compile `mri` (bin "mri") due to previous error
Yet cargo miri run
accepts this code and will stack overflow eventually 🤔
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
[1] 378748 IOT instruction cargo --color=always miri run