Closed
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?