Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive use of Self for RHS in PartialEq causes ICE #22673

Closed
robo-corg opened this issue Feb 22, 2015 · 3 comments
Closed

Recursive use of Self for RHS in PartialEq causes ICE #22673

robo-corg opened this issue Feb 22, 2015 · 3 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@robo-corg
Copy link

On rustc 1.0.0-nightly (2b01a37 2015-02-21) (built 2015-02-21) the follow causes an ICE:

trait Expr : PartialEq<Self::Item> {
    type Item = Expr;
}

fn main() {}

Full backtrace:
error: internal compiler error: unexpected panic
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 'assertion failed: did.krate != ast::LOCAL_CRATE', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/middle/ty.rs:5461

stack backtrace:
1: 0x10b7aebe3 - sys::backtrace::write::hc8e3cee73e646c590nC
2: 0x10b7dcbe5 - panicking::on_panic::h00b47941f5bc8a02HOL
3: 0x10b706418 - rt::unwind::begin_unwind_inner::h539538ef7f909326UvL
4: 0x108472895 - rt::unwind::begin_unwind::h7610573592537740396
5: 0x1087eb7dc - middle::ty::lookup_trait_def::h00103e323589b59cNla
6: 0x108812687 - middle::ty::predicates_for_trait_ref::h59dd4f8104908ae1Vna
7: 0x10880c125 - middle::traits::util::Elaborator<'cx, 'tcx>.Iterator::next::h9dd8ee47ae7ea8d3QkV
8: 0x108811fd1 - middle::traits::util::Supertraits<'cx, 'tcx>.Iterator::next::h2583ba3461accfb9rnV
9: 0x108109246 - astconv::ast_ty_to_ty::closure.34580
10: 0x1080a36cb - astconv::ast_ty_to_ty::hb64a583bfbbc7b64Ncw
11: 0x1080ff44d - astconv::ast_ty_arg_to_ty::h51a53c78e1218ba4sbw
12: 0x1080feff0 - vec::Vec.FromIterator::from_iter::h8575313848639105278
13: 0x1080fc2e0 - astconv::convert_angle_bracketed_parameters::h9209f0db8109fac9biv
14: 0x108101457 - astconv::ast_path_to_trait_ref::h2a3b7b2e77e3fde5Vvv
15: 0x1080af1fb - astconv::instantiate_trait_ref::h65c5bb030d486323Csv
16: 0x1081007ea - astconv::instantiate_poly_trait_ref::hb7df5c75231f22c61qv
17: 0x10813049f - collect::compute_bounds::h0eb0cb5207e10f2ccTy
18: 0x10811270f - collect::trait_def_of_item::hb48744a94bcef339Q2x
19: 0x108110c0f - collect::CollectTraitDefVisitor<'a, 'tcx>.visit..Visitor<'v>::visit_item::h4c7bef27b106e20cS8w
20: 0x10815d07f - check_crate::closure.35774
21: 0x10815b02e - check_crate::hbe2eb4aab434ad7cVjC
22: 0x107ac68db - driver::phase_3_run_analysis_passes::h50728865d3ffa6b2gHa
23: 0x107aabb9d - driver::compile_input::h349b039ebe75c13eGba
24: 0x107b84857 - run_compiler::h1e4d87c6044fbf6dZbc
25: 0x107b81cd1 - thunk::F.Invoke<A, R>::invoke::h2059937391804860278
26: 0x107b80930 - rt::unwind::try::try_fn::h11862807381821880905
27: 0x10b8567e9 - rust_try_inner
28: 0x10b8567d6 - rust_try
29: 0x107b81095 - thunk::F.Invoke<A, R>::invoke::h6573516661401600357
30: 0x10b7c5ac3 - sys::thread::thread_start::h9e3555425c6999b2e4G
31: 0x7fff8fd0d268 - _pthread_body
32: 0x7fff8fd0d1e5 - _pthread_body

@edwardw
Copy link
Contributor

edwardw commented Feb 22, 2015

This is basically #20300. And on top of #22512, rustc correctly declares there's an illegal recursive type:

trait Expr : PartialEq<<Self as Expr>::Item> {
    //^ error: illegal recursive type; insert an enum or struct in the cycle, if this is desired
    type Item = Expr;
}

fn main() {}

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 23, 2015
@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 16, 2015
jooert added a commit to jooert/rust that referenced this issue Apr 25, 2015
@jooert
Copy link
Contributor

jooert commented Apr 27, 2015

Tests added in #24829.

@jooert
Copy link
Contributor

jooert commented May 5, 2015

Can this be closed?

@eddyb eddyb closed this as completed Jun 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants