Skip to content

ice: SaveContext::typeck_results called outside of body' with -Zsave-analysis #88536

Closed as not planned
@matthiaskrgr

Description

@matthiaskrgr

code reduced from ./src/test/ui/symbol-names/const-generics-structural-demangling.rs

Code

#![allow(incomplete_features)]

#[derive(PartialEq, Eq)]
pub struct Foo {}
pub struct Foo_<const F: Foo>;

impl Foo_<{Foo {}}> {}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (5d6804469 2021-08-30)
binary: rustc
commit-hash: 5d6804469d80aaf26f98090ae016af45e267f58f
commit-date: 2021-08-30
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0

Error output

rustc ./src/test/ui/symbol-names/const-generics-structural-demangling.rs --emit=mir -Zsave-analysis

error: `Foo` is forbidden as the type of a const generic parameter
 --> ./src/test/ui/symbol-names/const-generics-structural-demangling.rs:5:26
  |
5 | pub struct Foo_<const F: Foo>;
  |                          ^^^
  |
  = note: the only supported types are integers, `bool` and `char`
  = help: more complex types are supported with `#![feature(const_generics)]`

thread 'rustc' panicked at '`SaveContext::typeck_results` called outside of body', compiler/rustc_save_analysis/src/dump_visitor.rs:1351:48
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.56.0-nightly (5d6804469 2021-08-30) 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

Backtrace

error: `Foo` is forbidden as the type of a const generic parameter
 --> ./src/test/ui/symbol-names/const-generics-structural-demangling.rs:5:26
  |
5 | pub struct Foo_<const F: Foo>;
  |                          ^^^
  |
  = note: the only supported types are integers, `bool` and `char`
  = help: more complex types are supported with `#![feature(const_generics)]`

thread 'rustc' panicked at '`SaveContext::typeck_results` called outside of body', compiler/rustc_save_analysis/src/dump_visitor.rs:1351:48
stack backtrace:
   0:     0x7f88edcfb26c - std::backtrace_rs::backtrace::libunwind::trace::hf16bab017f241aa7
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f88edcfb26c - std::backtrace_rs::backtrace::trace_unsynchronized::hfc27e8424e499412
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f88edcfb26c - std::sys_common::backtrace::_print_fmt::h5be1efcd85b410a6
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f88edcfb26c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h73cf7b443adc9274
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f88edd58f3c - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/core/src/fmt/mod.rs:1150:17
   5:     0x7f88edcec305 - std::io::Write::write_fmt::hb955fdedb1f691a8
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/io/mod.rs:1667:15
   6:     0x7f88edcfe7c0 - std::sys_common::backtrace::_print::hd5ba2c14c2d68f09
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f88edcfe7c0 - std::sys_common::backtrace::print::h3b3d8e691bd3d5e8
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f88edcfe7c0 - std::panicking::default_hook::{{closure}}::h703c292cd78e95a9
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/panicking.rs:210:50
   9:     0x7f88edcfe37b - std::panicking::default_hook::h23aea4a9b2140559
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/panicking.rs:227:9
  10:     0x7f88ee4d1621 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h711cfdc4f17bb88e
  11:     0x7f88edcfefd9 - std::panicking::rust_panic_with_hook::hde97eb7782db5504
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/panicking.rs:628:17
  12:     0x7f88edcfea90 - std::panicking::begin_panic_handler::{{closure}}::h531b374cb1cba3c4
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/panicking.rs:521:13
  13:     0x7f88edcfb714 - std::sys_common::backtrace::__rust_end_short_backtrace::h170e7849f1857b98
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f88edcfe9f9 - rust_begin_unwind
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/panicking.rs:517:5
  15:     0x7f88edcc4761 - core::panicking::panic_fmt::hcf5f6d96e1dd7099
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/core/src/panicking.rs:101:14
  16:     0x7f88edcc4653 - core::option::expect_failed::h0a5d8f51a88056e8
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/core/src/option.rs:1618:5
  17:     0x7f88ee5317bb - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_expr::hf0cde4eb365a62ee
  18:     0x7f88ee527135 - rustc_hir::intravisit::Visitor::visit_nested_body::h67a1aac4b7ad5f62
  19:     0x7f88ee50fe4e - rustc_hir::intravisit::walk_generic_args::h1c55333a16463d1b
  20:     0x7f88ee511ec6 - rustc_hir::intravisit::walk_path::he03588414db59c16
  21:     0x7f88ee528300 - rustc_save_analysis::dump_visitor::DumpVisitor::nest_typeck_results::h8c7c7dc359c3e96f
  22:     0x7f88ee52f0b7 - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_item::h69f3533faf47cca9
  23:     0x7f88ee527166 - rustc_hir::intravisit::Visitor::visit_nested_item::h61f76100706f6c0a
  24:     0x7f88ee50f17c - rustc_hir::intravisit::walk_crate::hacda3f4cfc4c2bd5
  25:     0x7f88ee52caf6 - rustc_save_analysis::dump_visitor::DumpVisitor::process_crate::h41a9128f5b06cdd9
  26:     0x7f88ee502402 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h255e97ab4d69c6b1
  27:     0x7f88ee504157 - std::thread::local::LocalKey<T>::with::h23b74998d1a23aa7
  28:     0x7f88ee4d3357 - rustc_save_analysis::process_crate::h06a24629e7a2b886
  29:     0x7f88ee4dba57 - rustc_session::utils::<impl rustc_session::session::Session>::time::hc4be7d99c80a1740
  30:     0x7f88effecb97 - rustc_interface::passes::QueryContext::enter::hd3fac6b0ebd98ed0
  31:     0x7f88effd3af1 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hd225abb57cc80e78
  32:     0x7f88effc08dc - rustc_span::with_source_map::h3e75febffcdc905b
  33:     0x7f88effd3428 - scoped_tls::ScopedKey<T>::set::h043f1d7ffbae0186
  34:     0x7f88effc105b - std::sys_common::backtrace::__rust_begin_short_backtrace::h42e5610ec37ca3bd
  35:     0x7f88effc0045 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h6bf202d09cfdc8bc
  36:     0x7f88edd0b633 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h132ab4ac45190c0c
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/alloc/src/boxed.rs:1636:9
  37:     0x7f88edd0b633 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf5feeb35085fa69e
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/alloc/src/boxed.rs:1636:9
  38:     0x7f88edd0b633 - std::sys::unix::thread::Thread::new::thread_start::h21e4b7c982487240
                               at /rustc/5d6804469d80aaf26f98090ae016af45e267f58f/library/std/src/sys/unix/thread.rs:106:17
  39:     0x7f88edc14259 - start_thread
  40:     0x7f88edb295e3 - __GI___clone
  41:                0x0 - <unknown>

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.56.0-nightly (5d6804469 2021-08-30) 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions