Skip to content

Anther ICE with type_of with ty_projection #21292

Closed
@erickt

Description

@erickt

cc @nikomatsakis, @michaelwoerister

Similar trace to #20368 and #20797:

trait DeclaredTrait {
    type Type;
}

impl DeclaredTrait for i32 {
    type Type = i32;
}

struct Struct<B: DeclaredTrait> {
    b1: B,
    b2: <B as DeclaredTrait>::Type,
}

fn main() {
    let e = Struct {
        b1: 0,
        b2: 0,
    };
}

Errors with:

% rustc --version
rustc 1.0.0-dev (378fb5846 2015-01-17 03:51:34 +0000)
% rustc -g bad.rs
bad.rs:10:5: 10:10 warning: struct field is never used: `b1`, #[warn(dead_code)] on by default
bad.rs:10     b1: B,
              ^~~~~
bad.rs:11:5: 11:35 warning: struct field is never used: `b2`, #[warn(dead_code)] on by default
bad.rs:11     b2: <B as DeclaredTrait>::Type,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bad.rs:15:9: 15:10 warning: unused variable: `e`, #[warn(unused_variables)] on by default
bad.rs:15     let e = Struct {
                  ^
error: internal compiler error: type_of with ty_projection
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/erickt/rust/rust/src/libsyntax/diagnostic.rs:185

stack backtrace:
   1:        0x10924af9c - sys::backtrace::write::hfe05ebe901a92084YZt
   2:        0x10926d48f - failure::on_fail::hc0d201f41661170dg5z
   3:        0x1091d9aae - rt::unwind::begin_unwind_inner::h198f61e789bf9e917Mz
   4:        0x106df4ebf - rt::unwind::begin_unwind::h12923214551439977590
   5:        0x106df582b - diagnostic::Handler::bug::h8d8e6d403a020d950uF
   6:        0x1063b5720 - metadata::tydecode::parse_existential_bounds_::h9081067129011447967
   7:        0x105add5d8 - trans::type_of::type_of::h1e59912f10dca1a3m3o
   8:        0x105adcae0 - trans::type_of::type_of::h1e59912f10dca1a3m3o
   9:        0x105bf46fc - trans::debuginfo::StructMemberDescriptionFactory<'tcx>::create_member_descriptions::unboxed_closure.45578
  10:        0x105bf42e2 - vec::Vec<T>.FromIterator<T>::from_iter::h590378842063277976
  11:        0x105bf0d1d - trans::debuginfo::StructMemberDescriptionFactory<'tcx>::create_member_descriptions::h969fce883822aac14qF
  12:        0x105bf2f6d - trans::debuginfo::RecursiveTypeDescription<'tcx>::finalize::h7c4c53f2b6a16a83NoF
  13:        0x105bedc03 - trans::debuginfo::type_metadata::h13a0cfa28b2efe0cCaG
  14:        0x105bef307 - trans::debuginfo::declare_local::h507d66c730508f55n7E
  15:        0x105beeb63 - ast_util::walk_pat::walk_pat_::h268813132339459229
  16:        0x105ad51aa - trans::controlflow::trans_block::h0bd3a648f7cdf44ba4d
  17:        0x105b9d92f - trans::base::trans_closure::h348fb24fe2b02a64R0t
  18:        0x105ac0a57 - trans::base::trans_fn::h0d6c73b5e20c2af7ubu
  19:        0x105abc0fb - trans::base::trans_item::h5424e39f127692a9Pyu
  20:        0x105ba3aac - trans::base::trans_crate::hcf7733ad4a46f9dewuv
  21:        0x10596b1e4 - driver::phase_4_translate_to_llvm::hbc28897c20483b80uOa
  22:        0x10594cb8a - driver::compile_input::he6e47d3daee720a0Aba
  23:        0x105a0a0f6 - run_compiler::ha155a42f8b9d287clac
  24:        0x105a07453 - thunk::F.Invoke<A, R>::invoke::h4831380177054264147
  25:        0x105a062b8 - rt::unwind::try::try_fn::h10781123522113114633
  26:        0x1092d9789 - rust_try_inner
  27:        0x1092d9776 - rust_try
  28:        0x105a068f6 - thunk::F.Invoke<A, R>::invoke::h5851073038150496667
  29:        0x10925a662 - sys::thread::thread_start::hfd309b049d11d271ENw
  30:     0x7fff9358c2fc - _pthread_body
  31:     0x7fff9358c279 - _pthread_body

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

    No branches or pull requests

    Issue actions