Skip to content

ICE on harmless cast #25143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aji opened this issue May 6, 2015 · 2 comments
Closed

ICE on harmless cast #25143

aji opened this issue May 6, 2015 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@aji
Copy link

aji commented May 6, 2015

A cast from what should be an Rc<Box<Display>> to an Rc<Box<Display>> causes an ICE.

The following code triggers the bug:

use std::fmt::Display;
use std::rc::Rc;

fn main() {
    let x = Rc::new(Box::new(3) as Box<Display>) as Rc<Box<Display>>;
    println!("{}", x);
}

Removing the last cast fixes any problems, and the code works as expected. Attempts to compile the included version, however, produce the following ICE. I haven't investigated whether a simpler example still causes the error.

error: internal compiler error: translating unsupported cast: alloc::rc::Rc<Box<core::fmt::Display>> (cast_other) -> alloc::rc::Rc<Box<core::fmt::Display>> (cast_other)
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/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:230

stack backtrace:
   1: 0xb7334c02 - sys::backtrace::write::h77d4324d8f687479hhs
   2: 0xb733e003 - panicking::on_panic::h5991b51df6754021gXw
   3: 0xb72f9931 - rt::unwind::begin_unwind_inner::h0b9bf67a6c91c871qCw
   4: 0xb5a95e8a - rt::unwind::begin_unwind::h4590825210216012210
   5: 0xb5a965c0 - diagnostic::Handler::bug::he1b4d17bbf37c901a2B
   6: 0xb62b8348 - session::Session::bug::h8b813292dd414a3bLOq
   7: 0xb6be4894 - trans::expr::trans_imm_cast::hcf6b081c061414ceJvC
   8: 0xb6bd843d - trans::expr::trans_unadjusted::h101c41dfc231ce49qIA
   9: 0xb6baaff3 - trans::expr::trans_into::h7c16b2d01d4f4517gfA
  10: 0xb6c30307 - trans::_match::mk_binding_alloca::h2886231291812574490
  11: 0xb6b14c20 - trans::base::init_local::h734fdf8e95d40b8aa2g
  12: 0xb6b253d6 - trans::controlflow::trans_block::h78fbb82977d10ae0r9u
  13: 0xb6b23f4e - trans::base::trans_closure::h935c8521a0e70422PIh
  14: 0xb6b25b9f - trans::base::trans_fn::he0f1206d0de4f31fxTh
  15: 0xb6b290b0 - trans::base::trans_item::h5f1e3b5e6e824334Jhi
  16: 0xb6b384bd - trans::base::trans_crate::heff82322305e67c0w6i
  17: 0xb76825d6 - driver::phase_4_translate_to_llvm::h44883988e2377a0fnOa
  18: 0xb76587a9 - driver::compile_input::h99ee9c2483e6eaf5Qba
  19: 0xb77228e7 - run_compiler::hc5bd2bad8247cbab65b
  20: 0xb771fd0e - boxed::F.FnBox<A>::call_box::h4547696616703108986
  21: 0xb771f3a1 - rt::unwind::try::try_fn::h5119335400925169066
  22: 0xb73c1fca - rust_try_inner
  23: 0xb73c1fa3 - rust_try
  24: 0xb771f612 - boxed::F.FnBox<A>::call_box::h12972956424599656712
  25: 0xb733ccf4 - sys::thread::Thread::new::thread_start::hb309cf85ff61e58eMIv
  26: 0xb33991a5 - start_thread
  27: 0xb71a47cd - __clone
  28:        0x0 - <unknown>
theta ~$ rustc --version --verbose
rustc 1.1.0-nightly (435622028 2015-05-04) (built 2015-05-05)
binary: rustc
commit-hash: 435622028f37085819843f4ac8938557501f0468
commit-date: 2015-05-04
build-date: 2015-05-05
host: i686-unknown-linux-gnu
release: 1.1.0-nightly
@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 6, 2015
@arielb1
Copy link
Contributor

arielb1 commented May 6, 2015

Should be fixed by #24333 (when it is merged). Should I add a test?

@JustAPerson
Copy link
Contributor

No longer causes an ICE on 1.2 nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants