Skip to content

ICE when using a trait in a struct constructor #15812

Closed
@nham

Description

@nham

Rust version:

: rustc -v
rustc 0.12.0-pre (ef352faea84fa16616b773bd9aa5020d7c76bff0 2014-07-18 21:46:32 +0000)

Backtrace:

: RUST_BACKTRACE=1 rustc graph_ice.rs 
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. 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
task 'rustc' failed at 'No def'n found for syntax::ast::DefId{krate: 0u32, node: 4u32} in tcx.tcache', /build/rust-git/src/rust/src/librustc/middle/ty.rs:3577

stack backtrace:
   1:     0x7f50c1c9f620 - rt::backtrace::imp::write::h7d9a73822d623dc366p
   2:     0x7f50c1ca2e80 - <unknown>
   3:     0x7f50c5cb9520 - unwind::begin_unwind_inner::h61b9531475e4067d40d
   4:     0x7f50c5cb9170 - unwind::begin_unwind_fmt::h688dc60278736763xYd
   5:     0x7f50c6353360 - middle::ty::lookup_item_type::hf81c4ba18de5d5c5PGX
   6:     0x7f50c668c400 - <unknown>
   7:     0x7f50c6663120 - <unknown>
   8:     0x7f50c665e790 - <unknown>
   9:     0x7f50c665e4b0 - <unknown>
  10:     0x7f50c66684f0 - <unknown>
  11:     0x7f50c66573c0 - middle::typeck::check::check_item::h869ed4346760216cm1j
  12:     0x7f50c665e2b0 - middle::typeck::check::check_item_types::he4a736b063fcdf18Yrj
  13:     0x7f50c67df010 - middle::typeck::check_crate::he1855b8bbe87d765ZqK
  14:     0x7f50c6b6de50 - driver::driver::phase_3_run_analysis_passes::h95e87b18d501abceZAv
  15:     0x7f50c6b696f0 - driver::driver::compile_input::h72c0bb31f163e8e60mv
  16:     0x7f50c6c24580 - <unknown>
  17:     0x7f50c6c24490 - <unknown>
  18:     0x7f50c6c37fe0 - <unknown>
  19:     0x7f50c6c37d70 - <unknown>
  20:     0x7f50c60194b0 - <unknown>
  21:     0x7f50c5d0a240 - rust_try
  22:     0x7f50c5cb65b0 - unwind::try::h25eab4a9d3dd35b7tPd
  23:     0x7f50c5cb6310 - task::Task::run::h1485818ad8ea4fc9P0c
  24:     0x7f50c60192a0 - <unknown>
  25:     0x7f50c5cb8590 - <unknown>
  26:     0x7f50c1001060 - start_thread
  27:     0x7f50c5980489 - __clone
  28:                0x0 - <unknown>

Code:

trait Foo {}
struct Bar;

impl Bar {
    fn new() -> Bar {
        Foo { n: 0 }
    }
}

fn main() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    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