Skip to content

ICE -Zsave-analysis lint-dead-code-5.rs impossible case reached #73022

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

reduced from ./src/test/ui/lint/dead-code/lint-dead-code-5.rs

enum Enum2 {
    Variant8 { _field: bool },
}

impl Enum2 {
    fn new_variant8() -> Enum2 {
        Self::Variant8 { _field: true }
    }
}

fn main() {}

Meta

repo @ 219380d

Error output

RUST_BACKTRACE=full build/x86_64-unknown-linux-gnu/stage2/bin/rustc ./src/test/ui/lint/dead-code/lint-dead-code-5.rs -Zsave-analysis

error: internal compiler error: src/librustc_save_analysis/lib.rs:583: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
Backtrace

warning: enum is never used: `Enum2`
 --> ./src/test/ui/lint/dead-code/lint-dead-code-5.rs:2:6
  |
2 | enum Enum2 {
  |      ^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: associated function is never used: `new_variant8`
 --> ./src/test/ui/lint/dead-code/lint-dead-code-5.rs:8:8
  |
8 |     fn new_variant8() -> Enum2 {
  |        ^^^^^^^^^^^^

error: internal compiler error: src/librustc_save_analysis/lib.rs:583: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
stack backtrace:
   0:     0x7f9c1fc5cd57 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he2fbf5405bd3f46a
   1:     0x7f9c1fca9a3d - core::fmt::write::h65255e7874586eb2
   2:     0x7f9c1fc2db95 - std::io::Write::write_fmt::h3c49d63e356d89fe
   3:     0x7f9c1fc39980 - std::panicking::default_hook::{{closure}}::h6b88f05100c9e449
   4:     0x7f9c1fc39694 - std::panicking::default_hook::h57a663a807afe943
   5:     0x7f9c215f18a3 - rustc_driver::report_ice::h34c4499908ba0b29
   6:     0x7f9c1fc3a06c - std::panicking::rust_panic_with_hook::haef04471b94d420c
   7:     0x7f9c25724763 - std::panicking::begin_panic::h864c0841f11b0cc5
   8:     0x7f9c257333b0 - rustc_errors::HandlerInner::bug::hf4b00747a8046e38
   9:     0x7f9c25731c80 - rustc_errors::Handler::bug::h1a265be085905310
  10:     0x7f9c252ca446 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::hc31214a436b0cba2
  11:     0x7f9c252c20e5 - rustc_middle::ty::context::tls::with_opt::{{closure}}::h8a5fa3e61707645c
  12:     0x7f9c252c204d - rustc_middle::ty::context::tls::with_opt::he95b2464f8e01c32
  13:     0x7f9c252ca355 - rustc_middle::util::bug::opt_span_bug_fmt::h89c1337accb0a963
  14:     0x7f9c252ca2c0 - rustc_middle::util::bug::bug_fmt::h394875dd81e62801
  15:     0x7f9c216bad44 - rustc_save_analysis::SaveContext::get_expr_data::hc00a9e9ea4e1de91
  16:     0x7f9c216fb49c - rustc_save_analysis::dump_visitor::DumpVisitor::process_struct_lit::h3b47a8c34330ad0c
  17:     0x7f9c2170486f - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_expr::h5917555fc95a2c93
  18:     0x7f9c216f9ee6 - rustc_save_analysis::dump_visitor::DumpVisitor::process_method::hbfe900f2f5b25c39
  19:     0x7f9c217007c6 - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_item::h5b70e8094603aadd
  20:     0x7f9c216fd011 - rustc_save_analysis::dump_visitor::DumpVisitor::process_crate::h3af551472fa9ad7e
  21:     0x7f9c215ccf98 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h230cde404218eeb4
  22:     0x7f9c2166a03e - rustc_session::utils::<impl rustc_session::session::Session>::time::ha57d20269542213a
  23:     0x7f9c215dd8eb - rustc_middle::ty::context::tls::enter_global::h5e4aceeb2c5d9074
  24:     0x7f9c215ff8e7 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h46a369817e38d2d4
  25:     0x7f9c216697ca - rustc_span::with_source_map::ha1e1d15982d868c1
  26:     0x7f9c21601b49 - rustc_interface::interface::run_compiler_in_existing_thread_pool::hfd5622ef3ce026be
  27:     0x7f9c215db34e - scoped_tls::ScopedKey<T>::set::hd3c1397285b10bd3
  28:     0x7f9c21602576 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3df4554cf04b61c9
  29:     0x7f9c215cf17e - core::ops::function::FnOnce::call_once{{vtable.shim}}::hb0a109416f61afc2
  30:     0x7f9c1fc41d7a - std::sys::unix::thread::Thread::new::thread_start::hb2effada6f868308
  31:     0x7f9c1f968422 - start_thread
  32:     0x7f9c1fa86bf3 - __GI___clone
  33:                0x0 - <unknown>

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: rustc 1.45.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
end of query stack
error: aborting due to previous error; 2 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.C-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