You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know it is an error to 'destructure an enum with let binding'. But it should be a compile error, not a compiler panic. I find it occurs when an enum has three kinds of structs.(normal struct, unit struct, tuple struct)
I tried this code.
enum Language {
Chinese(i32),
Janpanese,
Other {
a: i32,
b: i32,
}
}
fn main() {
let c = Language::Chinese(32);
let Language::Chinese(i) = c;
}
I got this:
Compiling rust-study v0.1.0 (file:///home/ding/project-fedora/rust-study)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with RUST_BACKTRACE=1 for a backtrace
thread 'rustc' panicked at 'assertion failed: (left == right) (left: 2, right: 1)', ../src/librustc/middle/check_match.rs:1051
note: Run with RUST_BACKTRACE=1 for a backtrace.
I know it is an error to 'destructure an enum with let binding'. But it should be a compile error, not a compiler panic. I find it occurs when an enum has three kinds of structs.(normal struct, unit struct, tuple struct)
I tried this code.
I got this:
Compiling rust-study v0.1.0 (file:///home/ding/project-fedora/rust-study)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with
RUST_BACKTRACE=1
for a backtracethread 'rustc' panicked at 'assertion failed:
(left == right)
(left:2
, right:1
)', ../src/librustc/middle/check_match.rs:1051note: Run with
RUST_BACKTRACE=1
for a backtrace.Meta
rustc 1.9.0-nightly (7b0b80a 2016-03-02)
binary: rustc
commit-hash: 7b0b80a
commit-date: 2016-03-02
host: x86_64-unknown-linux-gnu
release: 1.9.0-nightly
Backtrace:
[...........]$ RUST_BACKTRACE=1 cargo build -v$u7b$ $u7b$closure$u7d$$u7d$::closure.28569
Compiling ..........
Running
rustc book_learn/enum.rs --crate-name gcc --crate-type bin -g --out-dir /home/ding/project-fedora/rust-study/target/debug --emit=dep-info,link -L dependency=/home/ding/project-fedora/rust-study/target/debug -L dependency=/home/ding/project-fedora/rust-study/target/debug/deps
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'assertion failed:
(left == right)
(left:2
, right:1
)', ../src/librustc/middle/check_match.rs:1051stack backtrace:
1: 0x7f279cde7420 - sys::backtrace::tracing::imp::write::hafd161163f579c22qhv
2: 0x7f279cdf07cb - panicking::default_handler::$u7b$$u7b$closure$u7d$$u7d$::closure.44622
3: 0x7f279cdf0323 - panicking::default_handler::hf2d947b7574856d7OWz
4: 0x7f279cdb4a9c - sys_common::unwind::begin_unwind_inner::hc47573e10f703d4dJ5t
5: 0x7f279cdb5538 - sys_common::unwind::begin_unwind_fmt::h46e3049686ee3eb0P4t
6: 0x7f279a0a0a68 - middle::check_match::check_irrefutable::hf4f3190a79f4e43992j
7: 0x7f279a071a12 - middle::check_match::check_local::h98b3e55827a94f0230j
8: 0x7f279a071c67 - middle::check_match::check_fn::h611a29c4ed420569T1j
9: 0x7f279a0723d1 - middle::check_match::check_crate::h958664ff10508e28DQi
10: 0x7f279d3181ce - driver::phase_3_run_analysis_passes::
11: 0x7f279d3150b4 - middle::ty::context::ctxt<'tcx>::create_and_enter::h9120522648527365715
12: 0x7f279d311b9f - driver::phase_3_run_analysis_passes::h6774489415173405543
13: 0x7f279d2e4ed5 - driver::compile_input::hff497ea9e892ddf1Hca
14: 0x7f279d2d2a57 - run_compiler::hd54b7109a035c12b6Oc
15: 0x7f279d2d01d1 - sys_common::unwind::try::try_fn::h12672314472111852986
16: 0x7f279cde4e0b - __rust_try
17: 0x7f279cddd2ed - sys_common::unwind::inner_try::h4ba21e6d9bc82236L2t
18: 0x7f279d2d0a20 - boxed::F.FnBox::call_box::h3704598993629746835
19: 0x7f279cdeed99 - sys::thread::Thread::new::thread_start::hf030860cf63100a98Ty
20: 0x7f2795556609 - start_thread
21: 0x7f279ca60a4c - clone
22: 0x0 -
Could not compile
rust-study
.Caused by:
Process didn't exit successfully:
rustc book_learn/enum.rs --crate-name gcc --crate-type bin -g --out-dir /home/ding/project-fedora/rust-study/target/debug --emit=dep-info,link -L dependency=/home/ding/project-fedora/rust-study/target/debug -L dependency=/home/ding/project-fedora/rust-study/target/debug/deps
(exit code: 101)The text was updated successfully, but these errors were encountered: