Closed
Description
Running through rust-by-example, I ran this bit:
// A tuple struct that can be compared
#[derive(PartialEq, PartialOrd)]
struct Centimeters(f64);
// A tuple struct that can be printd
#[derive(Show)]
struct Inches(i32);
impl Inches {
fn to_centimeters(&self) -> Centimeters {
let &Inches(inches) = self;
Centimeters(Inches as f64 * 2.54)
}
}
and got this:
Peters-MacBook-Pro:30.1 peter$ RUST_BACKTRACE=1 rustc derive.rs
derive.rs:11:21: 11:27 warning: unused variable: `inches`, #[warn(unused_variables)] on by default
derive.rs:11 let &Inches(inches) = self;
^~~~~~
error: internal compiler error: translating unsupported cast: fn(i32) -> Inches {Inches} (cast_pointer) -> f64 (cast_float)
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>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:189
stack backtrace:
1: 0x10da082ec - sys::backtrace::write::h6d914e9ce03fb08bx2t
2: 0x10da2a9df - failure::on_fail::h807ef8bdd2936d8cT4z
3: 0x10d99720e - rt::unwind::begin_unwind_inner::he55ce02652fb4cc0PMz
4: 0x10b5aba1f - rt::unwind::begin_unwind::h12599395325545247643
5: 0x10b5ac38b - diagnostic::Handler::bug::hbeddb164372bc7acp4E
6: 0x10abca770 - collections::hash::map::HashMap<K, V, S>::reserve::h16232836280164940037
7: 0x10a75d513 - trans::expr::trans_imm_cast::h83dd8ae803a2f220Qbk
8: 0x10a74312d - trans::expr::trans_unadjusted::hf2ec954573ac808ftji
9: 0x10a6fce96 - trans::expr::trans::ha5bf63d6a84d8ec01Bh
10: 0x10a75afed - trans::expr::trans_binary::h2a4440e779ff99c6QSj
11: 0x10a743361 - trans::expr::trans_unadjusted::hf2ec954573ac808ftji
12: 0x10a6fbfb9 - trans::expr::trans_into::h4e944c804c611a9bxyh
13: 0x10a778fba - trans::expr::trans_adt::ha077fbb38277837abqj
14: 0x10a70d9b5 - trans::base::trans_named_tuple_constructor::heb33c0cdcee90aecQcu
15: 0x10a73e88f - trans::callee::trans_call_inner::h6585616855953466240
16: 0x10a745463 - trans::expr::trans_rvalue_dps_unadjusted::h9e02d37aa8c1b9cfgSi
17: 0x10a6fbeeb - trans::expr::trans_into::h4e944c804c611a9bxyh
18: 0x10a6fca17 - trans::controlflow::trans_block::ha700214f5859c953h3d
19: 0x10a7c4ce2 - trans::base::trans_closure::h195893708140d688mYt
20: 0x10a6e9019 - trans::base::trans_fn::hdddb662edd5312f8Z8t
21: 0x10a6e4eab - trans::base::trans_item::h5344214653540a949vu
22: 0x10a7cae6c - trans::base::trans_crate::h065c7d963367e060jrv
23: 0x10a14a234 - driver::phase_4_translate_to_llvm::h6d9902c87d882ff0SNa
24: 0x10a127169 - driver::compile_input::h09cad041de062210Bba
25: 0x10a1e5566 - run_compiler::h3ce2e073cefd54a3R8b
26: 0x10a1e28b3 - thunk::F.Invoke<A, R>::invoke::h4048511533083888351
27: 0x10a1e1718 - rt::unwind::try::try_fn::h5469566156528817632
28: 0x10daa0629 - rust_try_inner
29: 0x10daa0616 - rust_try
30: 0x10a1e1d56 - thunk::F.Invoke<A, R>::invoke::h15171032310353254860
31: 0x10da17bd1 - sys::thread::thread_start::h205b4d139d44ba45XOw
32: 0x7fff8b7b42fc - _pthread_body
33: 0x7fff8b7b4279 - _pthread_body
This looks similar to a number of other issues with an ICE, but the stack looks different from the other issues I've seen.
Relevant info:
Peters-MacBook-Pro:30.1 peter$ uname -a
Darwin Peters-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Peters-MacBook-Pro:30.1 peter$ rustc --version
rustc 1.0.0-nightly (4874ca36f 2015-01-23 00:18:57 +0000)