Skip to content

ICE: trying to take the sizing type of str, an unsized type #21111

Closed
@hugwijst

Description

@hugwijst

The following code leads to an ICE, while it should generate an error like "the trait core::marker::Sized is not implemented for the type str".

trait Trait {
    fn func(_: Option<Self>);
}

impl Trait for str {
    fn func(_: Option<str>) {
    }
}

rustc 1.0.0-nightly (3d0d9bb 2015-01-12 22:56:20 +0000)
binary: rustc
commit-hash: 3d0d9bb
commit-date: 2015-01-12 22:56:20 +0000
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

error: internal compiler error: trying to take the sizing type of str, an unsized type
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:     0x7f01192d5230 - sys::backtrace::write::hb7fa0f4f6b33ee3a8Rt
   2:     0x7f01192f6cd0 - failure::on_fail::h4388493538a5ad8ck8z
   3:     0x7f0119265880 - rt::unwind::begin_unwind_inner::h644ddf1c409df284cNz
   4:     0x7f011409b2d0 - rt::unwind::begin_unwind::h6723059647203556630
   5:     0x7f011409bb70 - diagnostic::Handler::bug::hc2ca177604da0419tWF
   6:     0x7f01175c98c0 - session::Session::bug::h38aa4cc0307771d526q
   7:     0x7f01182a4570 - trans::type_of::sizing_type_of::hb5de94b104fb5154kUo
   8:     0x7f01183b6670 - trans::adt::represent_type_uncached::he2e76ad4ea19848aPEH
   9:     0x7f011829f490 - trans::adt::represent_type::hd4315f520028bff5pBH
  10:     0x7f011828b5f0 - trans::type_of::type_of::h7d181a4982a1399cX1o
  11:     0x7f011833af90 - trans::type_of::type_of_rust_fn::h9cfd5332e9dac220uQo
  12:     0x7f01183426f0 - trans::base::decl_rust_fn::ha5ca3a661b9a89cct2r
  13:     0x7f0118354140 - trans::base::register_fn::h279c2125464a6273dGu
  14:     0x7f0118355df0 - trans::base::register_method::h56ebbb83600196c3Lkv
  15:     0x7f011826c430 - trans::base::get_item_val::h5c260ee213a7de8ac3u
  16:     0x7f011826a1a0 - trans::base::trans_item::h73d296fbb1db22b4Eyu
  17:     0x7f01183560b0 - trans::base::trans_crate::h9ff7181fd7ce844bluv
  18:     0x7f011983c010 - driver::phase_4_translate_to_llvm::h801d0ab1dc4e2ce7YMa
  19:     0x7f0119816e20 - driver::compile_input::h16a8340f5186d468Aba
  20:     0x7f01198e2b10 - run_compiler::hc5ba22728815878be5b
  21:     0x7f01198e1280 - thunk::F.Invoke<A, R>::invoke::h7238407932693063958
  22:     0x7f01198e01e0 - rt::unwind::try::try_fn::h923019338206111962
  23:     0x7f011935de80 - rust_try_inner
  24:     0x7f011935de70 - rust_try
  25:     0x7f01198e0490 - thunk::F.Invoke<A, R>::invoke::h13480221286053699380
  26:     0x7f01192e4c20 - sys::thread::thread_start::he45f9a9d6a5c2f67VJw
  27:     0x7f01138bbfe0 - start_thread
  28:     0x7f0118f06749 - __clone
  29:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)A-diagnosticsArea: Messages for errors, warnings, and lintsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions