Skip to content

internal compiler error: translating unsupported cast #26912

@Kraxxis

Description

@Kraxxis
% rustc --version
rustc 1.1.0

The following minimal example will cause an internal compiler error:

fn main() {
    let x = String::new() as String;
}

Error text:

% RUST_BACKTRACE=1 rustc wat.rs
wat.rs:1:16: 1:17 warning: unused variable: `x`, #[warn(unused_variables)] on by default
wat.rs:1 fn main(){ let x = String::new() as String; }
                        ^
error: internal compiler error: translating unsupported cast: collections::string::String (cast_other) -> collections::string::String (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>', /build/rust/src/rustc-1.1.0/src/libsyntax/diagnostic.rs:230

stack backtrace:
   1:     0x7f9eebf432d9 - sys::backtrace::write::h534114ba1b06b93294r
   2:     0x7f9eebf4b1f9 - panicking::on_panic::h4e97afe0febd2c7biJw
   3:     0x7f9eebf0bff2 - rt::unwind::begin_unwind_inner::hfe7dd1cef83ccc0fsow
   4:     0x7f9ee92f0a2d - rt::unwind::begin_unwind::h11509303451443813476
   5:     0x7f9ee92f10eb - diagnostic::Handler::bug::h238bf6cb3345eafa4aC
   6:     0x7f9ee9ed617b - session::Session::bug::h3b46b49c0728a5bdior
   7:     0x7f9eeaddc476 - trans::expr::trans_imm_cast::h9d654d95d7bc5dc4TCC
   8:     0x7f9eeadced97 - trans::expr::trans_unadjusted::hde606eb9ff3154c3cPA
   9:     0x7f9eeada5ecd - trans::expr::trans_into::hada10aa0abe58f6fXaA
  10:     0x7f9eeae2217a - trans::_match::mk_binding_alloca::h16266239282942992319
  11:     0x7f9eead19fae - trans::base::init_local::hfb9990c4bb499977E0g
  12:     0x7f9eead29db6 - trans::controlflow::trans_block::h58628df23515fb60z3u
  13:     0x7f9eead289f1 - trans::base::trans_closure::h8e149909d93e9d35jHh
  14:     0x7f9eead2a6ca - trans::base::trans_fn::h6fdd3daa5a1290101Rh
  15:     0x7f9eead2d497 - trans::base::trans_item::hae1a16e69a6f2b67dgi
  16:     0x7f9eead3b302 - trans::base::trans_crate::h60d17a2e7a10efe004i
  17:     0x7f9eec4911e6 - driver::phase_4_translate_to_llvm::h2764cf85036c98d7nOa
  18:     0x7f9eec46cfe6 - driver::compile_input::hd8975b759aec0d60Qba
  19:     0x7f9eec5230e1 - run_compiler::h3b0c3beaef2163aa75b
  20:     0x7f9eec520932 - boxed::F.FnBox<A>::call_box::h5202619178778601284
  21:     0x7f9eec51fef9 - rt::unwind::try::try_fn::h4053862560305393821
  22:     0x7f9eebfba3d8 - rust_try_inner
  23:     0x7f9eebfba3c5 - rust_try
  24:     0x7f9eec520194 - boxed::F.FnBox<A>::call_box::h4599430653034051152
  25:     0x7f9eebf49f91 - sys::thread::Thread::new::thread_start::h089e987aa4c0e52dzvv
  26:     0x7f9ee6a9b353 - start_thread
  27:     0x7f9eebb9bbfc - __clone
  28:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions