Skip to content

ICE: assertion failed: did.krate != ast::LOCAL_CRATE #21909

Closed
@matthewhammer

Description

@matthewhammer

The code below triggers an internal compiler error:

thread 'rustc' panicked at 'assertion failed: did.krate != ast::LOCAL_CRATE', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/middle/ty.rs:5341

Smallest input file that tickles the error:

trait A<X> { }
trait B { type X; type Y : A<Self::X>; }
fn main () { }

When the bounds on Y are lifted, the bug goes away for me. That is, the following code compiles without an error:

trait A<X> { }
trait B { type X; type Y; }
fn main () { }
  • Version info:
rustc 1.0.0-nightly (f1398d273 2015-01-31 20:21:02 +0000)
binary: rustc
commit-hash: f1398d2736f132dd4af828b3d9134691f924b7e1
commit-date: 2015-01-31 20:21:02 +0000
host: x86_64-apple-darwin
release: 1.0.0-nightly
  • Backtrace:
stack backtrace:
   1:        0x10d966b27 - sys::backtrace::write::h1e2c8d6454da8cd1Xsu
   2:        0x10d98ccac - failure::on_fail::hc34cc2536b843a6dlwB
   3:        0x10d8ed878 - rt::unwind::begin_unwind_inner::hc1db7917310b1e46PdB
   4:        0x10a931c55 - rt::unwind::begin_unwind::h10851544081918456271
   5:        0x10ac96d80 - middle::ty::lookup_trait_def::h2256fffe21aabd99WH7
   6:        0x10acdbc17 - middle::ty::predicates_for_trait_ref::h5f31438d5452493c2I7
   7:        0x10acb3dcb - middle::traits::util::Elaborator<'cx, 'tcx>.Iterator::next::h8fa8483eadd3bbe7IgT
   8:        0x10acb9d94 - middle::traits::util::Supertraits<'cx, 'tcx>.Iterator::next::h55572798b69df69ajjT
   9:        0x10a5face7 - astconv::ast_ty_to_ty::closure.32964
  10:        0x10a594dc0 - astconv::ast_ty_to_ty::h28c37a0bcd64f3d22ru
  11:        0x10a5f0eed - vec::Vec<T>.FromIterator<T>::from_iter::h8194170135992664305
  12:        0x10a5ee9fe - astconv::convert_angle_bracketed_parameters::h14e1151854724c322zt
  13:        0x10a5f2d2b - astconv::ast_path_to_trait_ref::h8901deac3602014bVMt
  14:        0x10a5a081b - astconv::instantiate_trait_ref::haaed26dc31d8d3a8CJt
  15:        0x10a5f20ea - astconv::instantiate_poly_trait_ref::h5e153a7725bdcb786Ht
  16:        0x10a622fcb - collect::compute_bounds::hbff2a6aea3e3160byRw
  17:        0x10a60a5fd - collect::trait_def_of_item::hc2a893dcfe8940b96bw
  18:        0x10a608bdf - collect::CollectTraitDefVisitor<'a, 'tcx>.visit..Visitor<'v>::visit_item::haff1fcbfc2eb31abLmv
  19:        0x10a648c6f - check_crate::closure.34094
  20:        0x10a646c75 - check_crate::he1eddd9d21d7c627g8z
  21:        0x109ff6725 - driver::phase_3_run_analysis_passes::h5ea5b4fae09df7e4tGa
  22:        0x109fdcb9c - driver::compile_input::hfeebf01fd34be13bBba
  23:        0x10a0aa27e - run_compiler::h47834abf04acfba99ac
  24:        0x10a0a729f - thunk::F.Invoke<A, R>::invoke::h2084430363117493962
  25:        0x10a0a5f30 - rt::unwind::try::try_fn::h12547055720005252601
  26:        0x10da03b69 - rust_try_inner
  27:        0x10da03b56 - rust_try
  28:        0x10a0a65f4 - thunk::F.Invoke<A, R>::invoke::h838828363178605749
  29:        0x10d977333 - sys::thread::thread_start::h502153f3460908456lx
  30:     0x7fff951c02fc - _pthread_body
  31:     0x7fff951c0279 - _pthread_body

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
on Feb 3, 2015
added
A-associated-itemsArea: Associated items (types, constants & functions)
on Feb 4, 2015
nikomatsakis

nikomatsakis commented on Feb 5, 2015

@nikomatsakis
Contributor

This is a dup of various other ICEs. A lot of people have been hitting this problem so I'm going to invest some energy into fixing it. I think it involves some non-trivial refactoring, unfortunately.

added 2 commits that reference this issue on Feb 14, 2015

Rollup merge of rust-lang#22302 - japaric:gh21909, r=brson

677e040

Rollup merge of rust-lang#22302 - japaric:gh21909, r=brson

59feb6f
edwardw

edwardw commented on Feb 15, 2015

@edwardw
Contributor

cc me. #22338 seems to also fix this.

EDIT: nope, the bug simply doesn't exist any more on current master b63cee4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jdm@nikomatsakis@edwardw@nrc@matthewhammer

      Issue actions

        ICE: assertion failed: did.krate != ast::LOCAL_CRATE · Issue #21909 · rust-lang/rust