Closed
Description
This code produces an ICE for both beta and nightly. The code and backtrace are reproduced below:
fn main() {
{
use std::ops::Deref;
struct Thing(i8);
/*
// Correct impl
impl Deref for Thing {
type Target = i8;
fn deref(&self) -> &i8 { &self.0 }
}
*/
// Causes ICE
impl Deref for Thing {
fn deref(&self) -> i8 { self.0 }
}
let thing = Thing(72);
*thing
};
}
ice.rs:2:5: 23:6 error: internal compiler error: cat_expr Errd
ice.rs:2 {
ice.rs:3 use std::ops::Deref;
ice.rs:4
ice.rs:5 struct Thing(i8);
ice.rs:6
ice.rs:7 /*
...
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 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:130
stack backtrace:
1: 0x7f759aea23c8 - sys::backtrace::write::h179e141147f9ee14IJC
2: 0x7f759aecd770 - panicking::on_panic::h6aa569d33389f0cfsXI
3: 0x7f759ae054a3 - rt::unwind::begin_unwind_inner::h082f07869f4b9731ACI
4: 0x7f75981cb04d - rt::unwind::begin_unwind::h13428428822164950735
5: 0x7f75981caff3 - diagnostic::SpanHandler::span_bug::he82cb6427e6a50a8jnB
6: 0x7f7598a6cb63 - session::Session::span_bug::h460607360e8bf7cc5Xq
7: 0x7f7599b2ed0d - check::regionck::visit_expr::hfc7cf3e25c050a92PJd
8: 0x7f7599b29ce0 - check::regionck::Rcx<'a, 'tcx>::visit_fn_body::hd4da730c0cf65ac9amd
9: 0x7f7599bc4b91 - check::check_bare_fn::hb43e600383cf2ee2UQn
10: 0x7f7599bbe674 - check::check_item::h77d9b4d4612f23cfF9n
11: 0x7f7599c96a96 - check_crate::closure.36300
12: 0x7f7599c90e73 - check_crate::h4b0848761f18a2bcbwC
13: 0x7f759b5215cd - driver::phase_3_run_analysis_passes::hf7cad4098b28ceb1gGa
14: 0x7f759b505425 - driver::compile_input::h7c62c2870ff901f6Qba
15: 0x7f759b5bca25 - run_compiler::hc815b49ce638c28eV4b
16: 0x7f759b5ba33d - boxed::F.FnBox<A>::call_box::h4290333406520961126
17: 0x7f759b5b9879 - rt::unwind::try::try_fn::h13999576404798567721
18: 0x7f759af49c68 - rust_try_inner
19: 0x7f759af49c55 - rust_try
20: 0x7f759b5b9b4b - boxed::F.FnBox<A>::call_box::h14489442628055152240
21: 0x7f759aeb8781 - sys::thread::create::thread_start::h02b7da32b4d7a4aaExH
22: 0x7f7594ca9373 - start_thread
23: 0x7f759aa7827c - __clone
24: 0x0 - <unknown>