-
Notifications
You must be signed in to change notification settings - Fork 13.3k
compiler hangs trying to print an overflow error #83150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Slightly smaller: fn main() {
func(0..1)
}
fn func<T: Iterator<Item=u8>>(iter: T) {
func(iter.map(|x| x+1))
} |
Actually, I am very curious that, why rustc do not reach the recursion limit. |
Oh sorry, you're right, it does hit the recursion limit if I let it run long enough (about 10 seconds). |
Here's a proper minimization: fn main() {
let mut iter = 0u8..1;
func(&mut iter)
}
fn func<T: Iterator<Item = u8>>(iter: &mut T) {
func(&mut iter.map(|x| x + 1))
} |
Partial backtrace of the hang:
|
So it actually hangs while trying to print the overflow error 😆 |
Bisected:
|
#72412 looks suspicious. |
#![type_length_limit="393"]
fn main() {
func(&mut(0u8..1))
}
fn func<T: Iterator<Item = u8>>(iter: &mut T) {
func(&mut iter.map(|x| x + 1))
} hang but #![type_length_limit="392"]
fn main() {
func(&mut(0u8..1))
}
fn func<T: Iterator<Item = u8>>(iter: &mut T) {
func(&mut iter.map(|x| x + 1))
} generate a failed massage:
|
Assigning |
I tried this code:
I expected to see this happen:
program either compiled successful or compiler generate an error
Instead, this happened:
rustc eats 100% CPU for several minutes, but nothing generated.
I compile this code using both
rustc testxx.rs -C opt-level=3 -C target-cpu=native -C codegen-units=1 -C lto -o testxx
andrustc testxx.rs -C opt-level=0 -o testxx
before I began to write this issue, but compiler do not compile even after this issue is submitted.Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: