Closed
Description
While writing my own toy compiler, I deleted a field from a struct, and then ran the compiler hoping it would point out where I missed a use.
This made rustc crash:
$ RUST_BACKTRACE=1 cargo test
Compiling compile v0.0.1 (file:///home/jona/src/compile)
/home/jona/src/compile/src/main.rs:107:7: 107:17 error: attempted access of field `types` on type `&mut Function`, but no field with that name was found
/home/jona/src/compile/src/main.rs:107 func.types[func.values[idx].typ] = superimpose(&func.values[idx].typ, &typ).unwrap();
^~~~~~~~~~
error: internal compiler error: no type for node 2838: expr func.values[idx].typ (id=2838) in fcx 0x7feebbfecbb8
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:182
stack backtrace:
1: 0x7feec3bdf850 - sys::backtrace::write::h5b05e7b061a35107Czt
2: 0x7feec3c01a60 - failure::on_fail::h1e9b7e3de59488d1aPz
3: 0x7feec3b6f5e0 - rt::unwind::begin_unwind_inner::h23dcfb4c37870bd62tz
4: 0x7feebe95d460 - rt::unwind::begin_unwind::h8180555736548804672
5: 0x7feebe95dd10 - diagnostic::Handler::bug::hfea99a1512d774b6tWF
6: 0x7feec1ec70d0 - session::Session::bug::hda4aef05452f83daiRq
7: 0x7feec3314f80 - check::FnCtxt<'a, 'tcx>::node_ty::hd15e5fbb39eb4572xcm
8: 0x7feec3326590 - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::h8a2bfc07a98e1301bEb
9: 0x7feec3324e30 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::hd8ad1eaead247978bub
10: 0x7feec3326490 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::hdcb765d26faad3efqvb
11: 0x7feec3324e30 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::hd8ad1eaead247978bub
12: 0x7feec3326490 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::hdcb765d26faad3efqvb
13: 0x7feec33ab360 - check::check_bare_fn::h12b646cb07f4b492H3j
14: 0x7feec33a2ad0 - check::check_item::h45ea87c7d5c5cf84umk
15: 0x7feec3470b30 - check_crate::unboxed_closure.30617
16: 0x7feec346b670 - check_crate::hdbcb36eaa379a57c23x
17: 0x7feec41349c0 - driver::phase_3_run_analysis_passes::h8c55e45fcfc1c7aegwa
18: 0x7feec411d350 - driver::compile_input::h04aea004c559b910xba
19: 0x7feec41ecfe0 - monitor::unboxed_closure.22497
20: 0x7feec41ece40 - thunk::F.Invoke<A, R>::invoke::h11849311349984608396
21: 0x7feec41ebbc0 - rt::unwind::try::try_fn::h13617610205470131813
22: 0x7feec3c676c0 - rust_try_inner
23: 0x7feec3c676b0 - rust_try
24: 0x7feec41ebeb0 - thunk::F.Invoke<A, R>::invoke::h14452289732390470265
25: 0x7feec3bef910 - sys::thread::thread_start::h93b0d38960a9fcacqrw
26: 0x7feebe16f250 - start_thread
27: 0x7feec3820219 - clone
28: 0x0 - <unknown>
Could not compile `compile`.
To learn more, run the command again with --verbose.
Source is in https://github.com/CrystalGamma/oxide/blob/8c3e3ddb4dfb4facfda443e8a34d09b881e43d31/src/main.rs
Compiler version:
rustc 1.0.0-nightly (44a287e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e
commit-date: 2015-01-08 17:03:40 -0800
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
Hope I could help.