Skip to content

rustc panics on compile-fail/issue-36638 #49889

Closed
@cuviper

Description

@cuviper

As noted in #49826 (comment), currently rustc is panicking on compile-fail/issue-36638. This only passed CI because main-thread panics are not being detected as ICE (to be fixed by #49826), and compiletest doesn't notice non-ICE panics (#49888).

It's fine with rustc 1.27.0-nightly (0b72d48f8 2018-04-10), so I was able to bisect this to the recent commit abfc8c2 from #49695 -- cc @michaelwoerister.

$ RUST_BACKTRACE=1 rustc +dev1 -Z continue-parse-after-error src/test/compile-fail/issue-36638.rs
error: expected identifier, found keyword `Self`
  --> src/test/compile-fail/issue-36638.rs:13:12
   |
13 | struct Foo<Self>(Self);
   |            ^^^^ expected identifier, found keyword

error: expected identifier, found keyword `Self`
  --> src/test/compile-fail/issue-36638.rs:16:11
   |
16 | trait Bar<Self> {}
   |           ^^^^ expected identifier, found keyword

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`', librustc/ty/sty.rs:889:13
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic_fmt
   7: rustc::ty::sty::ParamTy::is_self
   8: rustc::ty::flags::FlagComputation::for_sty
   9: rustc::ty::context::CtxtInterners::intern_ty
  10: rustc::ty::subst::<impl rustc::ty::Slice<rustc::ty::subst::Kind<'tcx>>>::fill_item
  11: rustc::ty::subst::<impl rustc::ty::Slice<rustc::ty::subst::Kind<'tcx>>>::identity_for_item
  12: rustc_typeck::collect::predicates_of
  13: rustc::ty::maps::<impl rustc::ty::maps::queries::predicates_of<'tcx>>::compute_result
  14: rustc::dep_graph::graph::DepGraph::with_task_impl
  15: rustc::ty::context::tls::with_related_context
  16: rustc::ty::maps::<impl rustc::ty::maps::queries::predicates_of<'tcx>>::force_with_lock
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::predicates_of<'tcx>>::try_get
  18: rustc::ty::maps::TyCtxtAt::predicates_of
  19: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::predicates_of
  20: <rustc_typeck::collect::CollectItemTypesVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item
  21: rustc::hir::Crate::visit_all_item_likes
  22: rustc::util::common::time
  23: rustc_typeck::check_crate
  24: rustc::ty::context::tls::enter_context
  25: <std::thread::local::LocalKey<T>>::with
  26: rustc::ty::context::TyCtxt::create_and_enter
  27: rustc_driver::driver::compile_input
  28: rustc_driver::run_compiler_impl
  29: syntax::with_globals
  30: rustc_driver::run
  31: rustc_driver::main
  32: std::rt::lang_start::{{closure}}
  33: std::panicking::try::do_call
  34: __rust_maybe_catch_panic
  35: std::rt::lang_start_internal
  36: main
  37: __libc_start_main
  38: _start
error: aborting due to 2 previous errors

Note that the test is dealing with improper usage of Self, and the assertion in question is also dealing with self:

rust/src/librustc/ty/sty.rs

Lines 887 to 894 in abfc8c2

pub fn is_self(&self) -> bool {
if self.name == keywords::SelfType.name().as_str() {
assert_eq!(self.idx, 0);
true
} else {
false
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions