Skip to content

ICE in trait impl with where clause #20413

Closed
@Twisol

Description

@Twisol
rustc 0.13.0-nightly (7608dbad6 2014-12-31 10:06:21 -0800)
binary: rustc
commit-hash: 7608dbad651f02e837ed05eef3d74a6662a6e928
commit-date: 2014-12-31 10:06:21 -0800
host: x86_64-apple-darwin
release: 0.13.0-nightly
trait Foo<'a> {
  fn answer(&'a mut self) -> u8;
}

struct Newtype<'a, T: 'a> {
  value: &'a mut T,
}


impl<'a, T> Foo<'a> for T
where Newtype<'a, T>: Foo<'a> {
  fn answer(&'a mut self) -> u8 {
    let newtype: Newtype<'a, T> = Newtype{value: self};
    newtype.answer()
  }
}


fn main() {}
foo.rs:13:9: 13:16 error: internal compiler error: coherence failed to report ambiguity: cannot locate the impl of the trait `core::kinds::Sized` for the type `Newtype<'a, T>`
foo.rs:13     let newtype: Newtype<'a, T> = Newtype{value: self};
                  ^~~~~~~
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-mac/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:        0x10a0121e5 - sys::backtrace::write::h4cebc8c3e368e8f0Upt
   2:        0x10a036c33 - failure::on_fail::hd9de93a6058d1a7dwwz
   3:        0x109f9ce6a - rt::unwind::begin_unwind_inner::h00d5ebf844629bb50dz
   4:        0x107ec9127 - rt::unwind::begin_unwind::h16325012161302436941
   5:        0x107ec90bc - diagnostic::SpanHandler::span_bug::h1cb2c7c5c82d285daPF
   6:        0x1076abc1e - middle::traits::error_reporting::report_fulfillment_error::h2148a74f54ee08d9QWO
   7:        0x1075886f2 - middle::traits::error_reporting::report_fulfillment_errors::h810f7f45fe3b1cb2lWO
   8:        0x106eb5062 - check::vtable::select_all_fcx_obligations_or_error::h571e4dea5c1362649mb
   9:        0x106f7373a - check::check_bare_fn::h1812c230f63b7673Qzj
  10:        0x106f78959 - check::check_method_body::h2ef2abe5be0f9daew2j
  11:        0x106f6d9fa - check::check_item::hac3080059fe09f34SSj
  12:        0x1070fee40 - check_crate::unboxed_closure.39832
  13:        0x1070fa733 - check_crate::h127b3439cfd8ff83NLx
  14:        0x106916d52 - driver::phase_3_run_analysis_passes::hadc5fda84afbf325qva
  15:        0x106903b88 - driver::compile_input::h9d2d7dddc58375d9wba
  16:        0x106a35843 - thunk::F.Invoke<A, R>::invoke::h1922614042677645733
  17:        0x106a329a0 - rt::unwind::try::try_fn::h5185751407680132505
  18:        0x10a09e5e9 - rust_try_inner
  19:        0x10a09e5d6 - rust_try
  20:        0x106a330e6 - thunk::F.Invoke<A, R>::invoke::h18183949975069308340
  21:        0x10a023544 - sys::thread::thread_start::h0fb21aaa7cc37e0dDfw
  22:     0x7fff8f8de2fc - _pthread_body
  23:     0x7fff8f8de279 - _pthread_body

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-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