Skip to content

ICE when implementing Drop for a typedef #16465

Closed
@qrlpx

Description

@qrlpx

Works just fine when using #[unsafe_destructor] though.

Input:

struct Foo<T>{
    x : T
}

type FooInt = Foo<int>;

impl Drop for FooInt {
    fn drop(&mut self){}
}

Output + Backtrace:

time: 0.001 s   parsing
time: 0.000 s   gated feature checking
time: 0.000 s   crate injection
time: 0.000 s   configuration 1
time: 0.004 s   plugin loading
time: 0.000 s   plugin registration
time: 0.005 s   expansion
time: 0.000 s   configuration 2
time: 0.000 s   maybe building test harness
time: 0.000 s   prelude injection
time: 0.000 s   assigning node ids and indexing ast
time: 0.000 s   checking that all macro invocations are gone
time: 0.003 s   external crate/lib resolution
time: 0.000 s   language item collection
time: 0.006 s   resolution
time: 0.000 s   lifetime resolution
time: 0.000 s   looking for entry point
time: 0.000 s   looking for plugin registrar
time: 0.000 s   freevar finding
time: 0.000 s   region resolution
time: 0.000 s   loop checking
time: 0.000 s   stability index
time: 0.000 s   type collecting
time: 0.000 s   variance inference
time: 0.030 s   coherence checking
time: 0.002 s   type checking
time: 0.000 s   check static items
time: 0.000 s   const marking
time: 0.000 s   const checking
time: 0.000 s   privacy checking
time: 0.000 s   intrinsic checking
time: 0.000 s   effect checking
time: 0.000 s   match checking
time: 0.000 s   liveness checking
time: 0.001 s   borrow checking
main.rs:1:1: 1:1 error: internal compiler error: Type parameter T out of range when substituting (root type=T)
main.rs:1 struct Foo<T>{
          ^
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 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_util.rs:784

stack backtrace:
   1:     0x7f2397337e70 - rt::backtrace::imp::write::h43dac5486f5e7461t9p
   2:     0x7f239733af10 - failure::on_fail::h1e234ec252bd138bGuq
   3:     0x7f2397b1aa60 - unwind::begin_unwind_inner::h84cc9a0765812e46M8d
   4:     0x7f239357d530 - unwind::begin_unwind::h17476891067112165011
   5:     0x7f239357d480 - diagnostic::SpanHandler::span_bug::hea4ecd8ab239d6d4sTD
   6:     0x7f23980ba330 - driver::session::Session::span_bug::h7fd2887e1af8c8afBZx
   7:     0x7f23981957f0 - middle::subst::SubstFolder<'a>.TypeFolder::fold_ty::he89a40ea2dd4e515DzW
   8:     0x7f2398195700 - middle::subst::T.Subst::subst_spanned::h6422710234986173650
   9:     0x7f23983e98a0 - middle::ty::lookup_field_type::h675255b8f137f788AvG
  10:     0x7f23980c8ec0 - middle::ty::struct_fields::hc7572bd8ced018583DG
  11:     0x7f239840c6d0 - middle::ty::type_contents::tc_ty::hf76377054cac041cOGD
  12:     0x7f23981644d0 - middle::ty::type_contents::h2cef921580c528f8KFD
  13:     0x7f239819d870 - middle::kind::check_item::hfd30a60b0cb9c1b3e3v
  14:     0x7f23981a0580 - middle::kind::check_crate::h7b6fbd4b7694f755ZPv
  15:     0x7f2397ef1f10 - util::common::time::h1559708456005220080
  16:     0x7f239878d750 - driver::driver::phase_3_run_analysis_passes::h7c7295f946d3e92bXsw
  17:     0x7f23987888c0 - driver::driver::compile_input::ha66c682cd414f129cfw
  18:     0x7f239882ec20 - driver::run_compiler::h14caa1c3f03fe8carJz
  19:     0x7f239882eb30 - driver::main_args::closure.136039
  20:     0x7f2398841240 - task::TaskBuilder<S>::try_future::closure.137200
  21:     0x7f2398841040 - task::TaskBuilder<S>::spawn_internal::closure.137177
  22:     0x7f2399276e60 - task::spawn_opts::closure.8314
  23:     0x7f2397b72420 - rust_try_inner
  24:     0x7f2397b72410 - rust_try
  25:     0x7f2397b180c0 - unwind::try::h9ef1228fa05d611fhXd
  26:     0x7f2397b17e60 - task::Task::run::h7037046a47095aa6T4c
  27:     0x7f2399276c20 - task::spawn_opts::closure.8260
  28:     0x7f2397b19ca0 - thread::thread_start::h6cc33e9539afe5013sd
  29:     0x7f2396dce0c0 - start_thread
  30:     0x7f23977e32d9 - __clone
  31:                0x0 - <unknown>

Version:

rustc 0.12.0-pre-nightly (c4a63fabe 2014-08-10 21:56:11 +0000)

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