-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7a8a62d7a736d6bd54273422da29d7af
Click to see the example code from above link
#[derive(Debug)]
enum A {
B(B),
C(C),
A1,
A2,
}
#[derive(Debug)]
enum B {
B1,
B2,
B3,
B4,
B5,
}
#[derive(Debug)]
enum C {}
fn main() {
let a = A::B(B::B5);
match a {
A::B(_) => println!("success"),
_ => println!("error: {:?}", a),
}
}
Expected output: success
Actual output:
timeout: the monitored command dumped core
/root/entrypoint.sh: line 8: 7 Illegal instruction timeout --signal=KILL ${timeout} "$@"
Running the above code on both Rust stable and nightly on my machine returns illegal hardware instruction (core dumped)
with some number different on each run prefixing the output.
Some experimentations:
- Implementing variants for enum
C
solves this issue. - Remove variants
A1
andA2
solves this issue. - Use any variant of
B
other thanB5
works.
I assume this is a bug in the compiler?
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.