Skip to content

Compiler panic: Type parameter out of range #22370

Closed
@mattias-p

Description

@mattias-p

I threw this at the nightly compilers of 2015-02-14 and 2015-01-30 and they both went down:

trait A<T=Self> {}
fn f(a: &A) {}
$ RUST_BACKTRACE=1 rustc src/lib.rs --crate-type lib
src/lib.rs:3:10: 3:11 error: internal compiler error: Type parameter `Self/SelfSpace.0` (Self/SelfSpace/0) out of range when substituting (root type=Self) substs=Substs[types=[[];[];[]], regions=[[];[];[]]]
src/lib.rs:3 fn f(a: &A) {}
                      ^
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>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:129

stack backtrace:
   1:     0x7fc4094aca60 - sys::backtrace::write::h17046f691c944fd6wlB
   2:     0x7fc4094d5650 - failure::on_fail::hc6163ed550dbd15faOK
   3:     0x7fc40941be10 - rt::unwind::begin_unwind_inner::hf466231ca0fbfbbdvsK
   4:     0x7fc4067659c0 - rt::unwind::begin_unwind::h15994696547183619422
   5:     0x7fc406765950 - diagnostic::SpanHandler::span_bug::h0c67b2fba09c62ed74E
   6:     0x7fc407525970 - middle::subst::SubstFolder<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::h908775383351c3a5i3N
   7:     0x7fc408c59400 - astconv::create_substs_for_ast_path::hdccd006640bd406eYFu
   8:     0x7fc408c5c1a0 - astconv::ast_path_to_trait_ref::h1257323b49beb5bc60u
   9:     0x7fc408c5f2a0 - astconv::object_path_to_poly_trait_ref::hd7b8560856970dd3WZu
  10:     0x7fc408c62620 - astconv::ast_ty_to_ty::closure.34297
  11:     0x7fc408bff240 - astconv::ast_ty_to_ty::hbab41c4ba1c4c555vGv
  12:     0x7fc408c62620 - astconv::ast_ty_to_ty::closure.34297
  13:     0x7fc408bff240 - astconv::ast_ty_to_ty::hbab41c4ba1c4c555vGv
  14:     0x7fc408c67750 - vec::Vec<T>.FromIterator<T>::from_iter::h16234516007305750142
  15:     0x7fc408c66690 - astconv::ty_of_method_or_bare_fn::h4c06b626350f9d4bl0v
  16:     0x7fc408c84900 - collect::type_scheme_of_item::h0ea8aabb691a5910QGx
  17:     0x7fc408c903c0 - collect::convert_typed_item::h1cd4e74053e84bf1qLx
  18:     0x7fc408c778a0 - collect::convert_item::h8870a96d91a2c7d338w
  19:     0x7fc408cbaca0 - check_crate::closure.35369
  20:     0x7fc408cb8c30 - check_crate::hc0209f9429b48ea8OxB
  21:     0x7fc409aea080 - driver::phase_3_run_analysis_passes::h6f20ce0dd25ae952SGa
  22:     0x7fc409ad0170 - driver::compile_input::h91ff1ed16e22d05cEba
  23:     0x7fc409ba3ea0 - run_compiler::h9c581f85e29a6b265bc
  24:     0x7fc409ba2500 - thunk::F.Invoke<A, R>::invoke::h5155567596601403298
  25:     0x7fc409ba13f0 - rt::unwind::try::try_fn::h5629523784837248188
  26:     0x7fc409541f20 - rust_try_inner
  27:     0x7fc409541f10 - rust_try
  28:     0x7fc409ba16a0 - thunk::F.Invoke<A, R>::invoke::h7807062886684583533
  29:     0x7fc4094c1190 - sys::thread::thread_start::h57c9c75c73c301cbfVF
  30:     0x7fc4034400c0 - start_thread
  31:     0x7fc409091fd9 - __clone
  32:                0x0 - <unknown>
$ rustc --version --verbose                                                             
rustc 1.0.0-nightly (b63cee4a1 2015-02-14 17:01:11 +0000)
binary: rustc
commit-hash: b63cee4a11fcfecf20ed8419bc3bd6859e6496bc
commit-date: 2015-02-14 17:01:11 +0000
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
$ uname -a
Linux rust-m2 3.13.0-45-generic #74+7.0trisquel2 SMP Sat Jan 31 14:07:55 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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