-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Nested recursive enum with ManuallyDrop causes thread 'rustc' to overflow its stack #135093
Labels
A-debuginfo
Area: Debugging information in compiled programs (DWARF, PDB, etc.)
C-bug
Category: This is a bug.
I-crash
Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
trying to do something similar with the example in E0320: use core::mem::ManuallyDrop;
enum A<T> {
B,
C(T, Vec<ManuallyDrop<A<T>>>)
}
fn main() {
let _ = A::<()>::B;
} both runs and compiles. |
Minimized: pub struct Wrap<T>(T);
pub enum Recursive<T> {
Recurse(*const Recursive<Wrap<T>>),
Item(T),
}
pub struct Conditional<T>(Option<Recursive<T>>);
fn main() {
let _x = Conditional::<()>(None);
} |
a bit more reduced: struct Wrap<T>(T);
enum Recursive<T> {
Recurse(*const Recursive<Wrap<T>>),
Item(T),
}
fn main() {
let _x: Recursive<()>;
} playground |
|
This is probably a duplicate of #121538 |
@rustbot claim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-debuginfo
Area: Debugging information in compiled programs (DWARF, PDB, etc.)
C-bug
Category: This is a bug.
I-crash
Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
There seemed to be an issue with the type Composition<Conditional> adding drop-check rules, so I added ManuallyDrop to get the program to compile. I also added the unpin impl as there was also an error regarding its implementation.
I tried this code:
I expected wither for the program to run, or for the compiler to give the a similar error to when ManuallyDrop is removed: "overflow while adding drop-check rules for
Vec<Composition<T>>
"Instead, the rustc thread overflowed its stack.
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: