Repository navigation
OOM while printing query stack during panic after ICE #112522
Copy link
Copy link
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Description
Code
You need debug assertions to trigger the original ice, I think
#![warn(unused_lifetimes)]
fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
s
}
fn main() {}Meta
rustc --version --verbose:
788c98df5995c9fe360ba9ba5efb103ee69d05c4
Error output
error: function pointer types may not have generic parameters
--> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:27
|
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
| ^^^^
|
help: consider moving the lifetime parameter to a `for` parameter list
|
3 - fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
3 + fn november<'a, 'b>(f: &for<'a> fn(x: &'a i32) -> R) -> &'a str {
|
error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
--> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:28
|
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
| -- ^^ lifetime `'a` already in scope
| |
| first declared here
error[E0412]: cannot find type `R` in this scope
--> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:47
|
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
| ^ not found in this scope
|
help: you might be missing a type parameter
|
3 | fn november<'a, 'b, R>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
| +++
error[E0425]: cannot find value `s` in this scope
--> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:4:5
|
4 | s
| ^ help: a local variable with a similar name exists: `f`
warning: lifetime parameter `'b` never used
--> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:3:17
|
3 | fn november<'a, 'b>(f: &fn<'a>(x: &'a i32) -> R) -> &'a str {
| --^^
| |
| help: elide the unused lifetime
|
note: the lint level is defined here
--> 05DD2C37BBA733B3F6B0EB64115884B7807B8E04CE5AC7C775132DBCBC88E72F.rs:1:9
|
1 | #![warn(unused_lifetimes)]
| ^^^^^^^^^^^^^^^^
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Activity
matthiaskrgr commentedon Jun 11, 2023
Backtrace
matthiaskrgr commentedon Jun 11, 2023
After the
query stack during panic:, rust is still doing something inside the query system and tries to eat 20+ gigs of memory without printing anything it seemsmatthiaskrgr commentedon Jun 11, 2023
cc @Amanieu maybe?
lukas-code commentedon Jun 12, 2023
regressed in #112333
Amanieu commentedon Jun 12, 2023
I reproduced this under gdb and it seems that rustc is stuck in some infinite recursion.
Backtrace
matthiaskrgr commentedon Jun 13, 2023
cc @Zoxc
Zoxc commentedon Jun 14, 2023
I opened a PR (#112603) to work around this.
It looks like the
limitsquery here could be part of a legitimate cycle. I'm not really sure why that's required for the printing mechanism. This could possibly be triggered by query cycles and not just ICEs.istankovic commentedon Oct 22, 2023
Seems to be fixed, cannot reproduce this with 1.73.
matthiaskrgr commentedon Oct 22, 2023
You may need a custom build with debug assertions (see the label)