Closed knz closed 7 years ago
This is still an issue after removing the outdated PhantomFn
bounds.
Yup, still an issue, I just spent a while debugging a cryptic "rustc overflowed its stack" bug, it would be useful if, when this can be detected, we could print a more specific error message on accidental circular type references.
Old type checking bug. P-tag?
This is still an issue after removing the outdated PhantomFn bounds.
Not any more:
C:\Users\steve\tmp> rustc .\foo.rs
error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<U as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T as Circular>::T`
--> .\foo.rs:5:23
|
5 | impl<X, U : Circular> TypeTrans<X> for U {
| ^^^^^^^^^^^^
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
given
I expected an error message stating that the expansion recursion depth limit was exceeded (like when one makes such a mistake with C++ templates).
I agree, and this is fixed.
Thanks!
rustc does not terminate (or will perhaps terminate with a stack overflow given sufficient time and insufficient memory) when provided the following code as input:
I expected an error message stating that the expansion recursion depth limit was exceeded (like when one makes such a mistake with C++ templates).
Instead, rustc does not terminate, and attaching gdb reveals an ever growing call stack (see backtrace below).
Meta
rustc --version --verbose
:Backtrace: