Skip to content
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

ICE when using a trait in a struct constructor #15812

Closed
nham opened this issue Jul 19, 2014 · 2 comments · Fixed by #16867
Closed

ICE when using a trait in a struct constructor #15812

nham opened this issue Jul 19, 2014 · 2 comments · Fixed by #16867
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nham
Copy link
Contributor

nham commented Jul 19, 2014

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() {}
@huonw huonw changed the title ICE ICE when using a trait in a struct constructor Aug 9, 2014
@shadowmint
Copy link

For what it's worth, this is still an issue, stumbled into it today.

task 'rustc' failed at 'No def'n found for syntax::ast::DefId{krate: 0u32, node: 197u32} in tcx.tcache', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/ty.rs:3582

with:

rustc 0.12.0-pre-nightly (a1429bca5 2014-08-08 21:36:11 +0000)

osx 10.9.4

Same issue (trying to return a Trait from an impl on a struct) ; slightly different line number in librustc/middile/ty.rs

@lordi
Copy link

lordi commented Aug 11, 2014

Also happened to me (on Arch Linux) with

rustc 0.12.0-pre-nightly (a1429bca5 2014-08-08 21:36:11 +0000)

The backtrace:

task 'rustc' failed at 'No def'n found for syntax::ast::DefId{krate: 0u32, node: 5u32} in tcx.tcache', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/ty.rs:3582

stack backtrace:
   1:     0x7f9a4901ae60 - rt::backtrace::imp::write::h09749635742f42d5t9p
   2:     0x7f9a4901df00 - failure::on_fail::h03c253a2288fc220Guq
   3:     0x7f9a497e5a90 - unwind::begin_unwind_inner::h84cc9a0765812e46M8d
   4:     0x7f9a497e5780 - unwind::begin_unwind_fmt::h5294fb1154f645ceh6d
   5:     0x7f9a49e61c00 - middle::ty::lookup_item_type::h89baf3a5b77a5660yZF
   6:     0x7f9a4a1a58d0 - middle::typeck::check::check_expr_with_unifier::hc5fcf79af1d30b79TqT
   7:     0x7f9a4a1a3230 - middle::typeck::check::check_argument_types::h200806ef1fa9539bVPS
   8:     0x7f9a4a1a1c80 - middle::typeck::check::check_method_argument_types::h021ef003da386d4bYNS
   9:     0x7f9a4a1a58d0 - middle::typeck::check::check_expr_with_unifier::hc5fcf79af1d30b79TqT
  10:     0x7f9a4a16e640 - middle::typeck::check::check_block_with_expected::hc2974a9f9cd6494ePyV
  11:     0x7f9a4a16a4a0 - middle::typeck::check::check_fn::h14c81c9d5f42a6f5dJQ
  12:     0x7f9a4a16a1c0 - middle::typeck::check::check_bare_fn::h5578676740afd8e33xQ
  13:     0x7f9a4a173780 - middle::typeck::check::check_method_body::h3d8a5ba9d77c3eddmiR
  14:     0x7f9a4a163350 - middle::typeck::check::check_item::h58dd0272451cce32R6Q
  15:     0x7f9a4a169fc0 - middle::typeck::check::check_item_types::h3da035c97051e367lxQ
  16:     0x7f9a49bbb440 - util::common::time::h4510992740229746977
  17:     0x7f9a4a375f30 - middle::typeck::check_crate::h3e227d690828d21chNh
  18:     0x7f9a4a446830 - driver::driver::phase_3_run_analysis_passes::hfa39577b52f9ea04nfw
  19:     0x7f9a4a4419a0 - driver::driver::compile_input::h97804601f8a7103fC1v
  20:     0x7f9a4a4e44d0 - driver::run_compiler::h6659b80ce522edebk6y
  21:     0x7f9a4a4e43e0 - driver::main_args::closure.135085
  22:     0x7f9a4a4f63e0 - task::TaskBuilder<S>::try_future::closure.136238
  23:     0x7f9a4a4f61e0 - task::TaskBuilder<S>::spawn_internal::closure.136215
  24:     0x7f9a4af1ae60 - task::spawn_opts::closure.8314
  25:     0x7f9a4983d440 - rust_try_inner
  26:     0x7f9a4983d430 - rust_try
  27:     0x7f9a497e30f0 - unwind::try::h9ef1228fa05d611fhXd
  28:     0x7f9a497e2e90 - task::Task::run::h7037046a47095aa6T4c
  29:     0x7f9a4af1ac20 - task::spawn_opts::closure.8260
  30:     0x7f9a497e4cd0 - thread::thread_start::h6cc33e9539afe5013sd
  31:     0x7f9a48ab0060 - start_thread
  32:     0x7f9a494b4489 - __clone
  33:                0x0 - <unknown>

@ghost ghost mentioned this issue Aug 25, 2014
bors added a commit that referenced this issue Sep 1, 2014
Not sure if this is addressing the root cause or just patching up a symptom. Also not sure if I should be adding a diagnostic code for this.

Fixes #16750
Fixes #15812
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 13, 2023
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

Successfully merging a pull request may close this issue.

4 participants