Closed
Description
The following code crashes rustc:
use std::ops::{Add, Sub};
type Test = Add + Sub;
fn main() {
}
I'm not expecting this to be correct code, but it does crash rustc! :)
Meta
version
rustc --version --verbose
:
rustc 1.0.0-nightly (dfc5c0f1e 2015-02-18) (built 2015-02-19)
binary: rustc
commit-hash: dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5
commit-date: 2015-02-18
build-date: 2015-02-19
host: x86_64-apple-darwin
release: 1.0.0-nightly
Compiler output and stack trace
test.rs:3:13: 3:16 error: internal compiler error: Type parameter `Self/SelfSpace.0` (Self/SelfSpace/0) out of range when substituting (root type=Self) substs=Substs[types=[[];[];[]], regions=[[];[];[]]]
test.rs:3 type Test = Add + Sub;
^~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:129
stack backtrace:
1: 0x111a6cb33 - sys::backtrace::write::h4ac856cc21107670NiC
2: 0x111a9a975 - panicking::on_panic::h1af4f5134b16007erAL
3: 0x1119c4f48 - rt::unwind::begin_unwind_inner::h7e57ada012e6f5b1EhL
4: 0x111092f5f - rt::unwind::begin_unwind::h15911479894914288510
5: 0x111092f0c - diagnostic::SpanHandler::span_bug::h90dd4c94eadd4f5c74E
6: 0x10e9dd1de - middle::subst::SubstFolder<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::h8aa913686b3f149f5vO
7: 0x10e3ee3c1 - astconv::create_substs_for_ast_path::hdc41f7cd2094ef6cyJu
8: 0x10e3f19e0 - astconv::ast_path_to_trait_ref::h15cabd48752503d7Y7u
9: 0x10e3f429d - astconv::object_path_to_poly_trait_ref::h8528e37e91c1a7acO6u
10: 0x10e3f822e - astconv::ast_ty_to_ty::closure.34240
11: 0x10e392ecb - astconv::ast_ty_to_ty::h452df19446498ad8QOv
12: 0x10e413425 - collect::type_scheme_of_item::h3112b408e255aa3ckQx
13: 0x10e41e92c - collect::convert_typed_item::h0bcb673fa59a7f23UUx
14: 0x10e40a12f - collect::convert_item::h606a3b1e477705a4xix
15: 0x10e44ee06 - check_crate::closure.35365
16: 0x10e44cd0e - check_crate::hcf8ba614420dddedaMB
17: 0x10ddbb439 - driver::phase_3_run_analysis_passes::h0464b230fa872894gHa
18: 0x10dd9fe21 - driver::compile_input::h2e75f56078276cddGba
19: 0x10de77964 - run_compiler::hc0cdcc3539a16f6eZbc
20: 0x10de74de5 - thunk::F.Invoke<A, R>::invoke::h2291068973313829877
21: 0x10de73a30 - rt::unwind::try::try_fn::h8951489985135640143
22: 0x111b147e9 - rust_try_inner
23: 0x111b147d6 - rust_try
24: 0x10de74195 - thunk::F.Invoke<A, R>::invoke::h3060333812106446878
25: 0x111a83063 - sys::thread::thread_start::h6d888d33d26d9a69IQG
26: 0x7fff9258b268 - _pthread_body
27: 0x7fff9258b1e5 - _pthread_body