Closed
Description
Given the following recursive type.
struct Foo<T> {
one: Bar<T>,
two: Bar<T>
}
enum Bar<T> {
Foo(Foo<T>),
Baz(T)
}
rustc
will recurse over fulfill::process_predicate1
until out of memory. A brief look at RUST_LOG="debug" ...
shows.
INFO:rustc::traits::fulfill: selecting trait `Binder(TraitPredicate(<Bar<T> as core::marker::Sized>))` at depth 22 yielded Ok(Some)
INFO:rustc::traits::fulfill: selecting trait `Binder(TraitPredicate(<Bar<T> as core::marker::Sized>))` at depth 22 yielded Ok(Some)
INFO:rustc::traits::fulfill: selecting trait `Binder(TraitPredicate(<Bar<T> as core::marker::Sized>))` at depth 22 yielded Ok(Some)
INFO:rustc::traits::fulfill: selecting trait `Binder(TraitPredicate(<Bar<T> as core::marker::Sized>))` at depth 22 yielded Ok(Some)
INFO:rustc::traits::fulfill: selecting trait `Binder(TraitPredicate(<Bar<T> as core::marker::Sized>))` at depth 22 yielded Ok(Some)
INFO:rustc::traits::fulfill: selecting trait `Binder(TraitPredicate(<Bar<T> as core::marker::Sized>))` at depth 22 yielded Ok(Some)
...
Reproducible on b678600 and 70b8b94
Interestingly, if Foo::two
is commented out the expected error is thrown. This might be related to #22672? After some inspection with gdb
it looks like it passes the type checks.
Metadata
Metadata
Assignees
Labels
No labels