Skip to content

ICE: type_of with ty_err #21210

@Marwes

Description

@Marwes

Got an ICE from referencing an associated type which do not exist. Using the T::A form seems to correctly recognize that the associated type does not exist.

trait Test { }
impl Test for () { }

fn test<T: Test>(a: &<T as Test>::A) { }

fn main() {
    test::<()>(&())
}
error: internal compiler error: type_of with ty_err
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>', C:\bot\slave\nightly-dist-rustc-win-64\build\src\libsyntax\diagnostic.rs:182

stack backtrace:
   1:         0x69beb89b - sys::backtrace::write::h60026b68cfaaeceafau
   2:         0x69bfef23 - rt::unwind::register::h7f4975ea10bd6d091Tz
   3:         0x69b8363f - rt::unwind::begin_unwind_inner::h029ebcc74661db9czRz
   4:         0x6f89949c - diagnostic::SpanHandler::span_bug::hdc7aeee1ceefbbe7EXF
   5:         0x6f899dd1 - diagnostic::Handler::bug::h4e5d2eba19b659eeK3F
   6:           0x7be5e9 - session::Session::bug::h79a5bd87c944c028P5q
   7:          0x1009d48 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::push_custom_cleanup_scope::hbaf7512abd67945bsKK
   8:          0x1009fb0 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::push_custom_cleanup_scope::hbaf7512abd67945bsKK
   9:          0x1085257 - trans::expr::cast_kind...std..fmt..Show::fmt::hd08d91ff3cb9c07el9j
  10:          0x10b3c7c - trans::context::CrateContext<'b, 'tcx>::report_overbig_object::hfdeaabc02f6c46d0MKm
  11:          0x10bb116 - trans::type_::Type...std..clone..Clone::clone::h08b81bc1be16d1a97NJ
  12:           0xffb20a - trans::context::CrateContext<'b, 'tcx>::monomorphizing::h951ab06dbf09c6b2hBm
  13:           0xfef32d - trans::context::CrateContext<'b, 'tcx>::sess::h387593bbc9cef3e3Gtm
  14:          0x103e99b - trans::common::ExprOrMethodCall...std..fmt..Show::fmt::hb59d019659ea3b3dBWl
  15:          0x103c46e - trans::context::CrateContext<'b, 'tcx>::tn::h8e0f83a62b3398c3xwm
  16:          0x1039c99 - trans::context::CrateContext<'b, 'tcx>::tn::h8e0f83a62b3398c3xwm
  17:          0x1042f90 - trans::type_::Type...std..cmp..PartialEq::ne::h84b3e315aec8acffrNJ
  18:          0x104a4a0 - trans::type_::Type...std..cmp..PartialEq::ne::h84b3e315aec8acffrNJ
  19:          0x1001e61 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_ast_cleanup_scope::hda7bc5ed963898880NK
  20:          0x10029cf - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_ast_cleanup_scope::hda7bc5ed963898880NK
  21:          0x10c9152 - trans::base::IsUnboxedClosureFlag...std..clone..Clone::clone::he8e3d42f068e61d4K0t
  22:           0xfee032 - trans::context::CrateContext<'b, 'tcx>::sess::h387593bbc9cef3e3Gtm
  23:           0xfe95b0 - trans::context::CrateContext<'b, 'tcx>::stats::hd4ebb61d1b796f01CGm
  24:          0x10cf2b8 - trans::base::trans_crate::hd5d800d7b9bd4c1eQuv
  25:         0x70b23daa - driver::phase_4_translate_to_llvm::h1a0c7c0a441b2273YMa
  26:         0x70b0264d - driver::compile_input::h4586659868b7e370Aba
  27:         0x70bc0717 - run::h6e0f5d9a92373b23M4b
  28:         0x70bbea98 - run::h6e0f5d9a92373b23M4b
  29:         0x70bbd91a - run::h6e0f5d9a92373b23M4b
  30:         0x69c28a8c - rust_try
  31:         0x69c28a69 - rust_try
  32:         0x70bbdf4f - run::h6e0f5d9a92373b23M4b
  33:         0x69bf0e92 - sys::tcp::TcpListener::bind::hfa20d1671f8885a2JHw
  34:     0x7ffb10d216ad - BaseThreadInitThunk
rustc 1.0.0-nightly (170c4399e 2015-01-14 00:41:55 +0000)
binary: rustc
commit-hash: 170c4399e614fe599c3d41306b3429ca8b3b68c6
commit-date: 2015-01-14 00:41:55 +0000
host: x86_64-pc-windows-gnu
release: 1.0.0-nightly

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