Skip to content

ICE: TypedAnnotation::typeck_results called outside of body: foo(-128..=127: i8) with -Zunpretty=hir,typed #82328

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code reduced from ./src/tools/rust-analyzer/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs

fn main() {}

fn foo(-128..=127: i8) {}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (9b471a3f5 2021-02-19)
binary: rustc
commit-hash: 9b471a3f5fe57e5c6e08acf665f2094422415a3d
commit-date: 2021-02-19
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

Error output

rustc -Zunpretty=hir,typed ./src/tools/rust-analyzer/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs

warning: function is never used: `foo`
 --> ./src/tools/rust-analyzer/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs:5:4
  |
5 | fn foo(-128..=127: i8) {}
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at '`TypedAnnotation::typeck_results` called outside of body', compiler/rustc_driver/src/pretty.rs:356:27
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.52.0-nightly (9b471a3f5 2021-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=hir,typed

query stack during panic:
end of query stack
warning: 1 warning emitted
Backtrace

warning: function is never used: `foo`
 --> ./src/tools/rust-analyzer/crates/syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rs:5:4
  |
5 | fn foo(-128..=127: i8) {}
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at '`TypedAnnotation::typeck_results` called outside of body', compiler/rustc_driver/src/pretty.rs:356:27
stack backtrace:
   0:     0x7f3d49a2fab0 - std::backtrace_rs::backtrace::libunwind::trace::hb4de9797f80b7b8c
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f3d49a2fab0 - std::backtrace_rs::backtrace::trace_unsynchronized::h59566d0bd20efff7
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3d49a2fab0 - std::sys_common::backtrace::_print_fmt::hcfa5ce6be50275d4
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f3d49a2fab0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd8c307a38b9bab04
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f3d49aa0e6c - core::fmt::write::h3868db8542c90941
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/core/src/fmt/mod.rs:1092:17
   5:     0x7f3d49a22992 - std::io::Write::write_fmt::hab90295d5a0f197d
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/io/mod.rs:1568:15
   6:     0x7f3d49a339a5 - std::sys_common::backtrace::_print::h19224910b8700cf1
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f3d49a339a5 - std::sys_common::backtrace::print::h25dedfa68c5fb84a
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f3d49a339a5 - std::panicking::default_hook::{{closure}}::h12c5765653a72a42
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:208:50
   9:     0x7f3d49a33453 - std::panicking::default_hook::he65cee71c4209f0c
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:225:9
  10:     0x7f3d4a29208b - rustc_driver::report_ice::h56d5f6e6a9fb9d03
  11:     0x7f3d49a342a6 - std::panicking::rust_panic_with_hook::h01a674d863fe0d8a
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:595:17
  12:     0x7f3d49a33dc7 - std::panicking::begin_panic_handler::{{closure}}::h9b9fecf185178864
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:497:13
  13:     0x7f3d49a2ff4c - std::sys_common::backtrace::__rust_end_short_backtrace::h57be46a42dc7f24b
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f3d49a33d29 - rust_begin_unwind
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:493:5
  15:     0x7f3d49a9d491 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/core/src/panicking.rs:92:14
  16:     0x7f3d49a9d073 - core::option::expect_failed::h8be1ca96ca0d69ca
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/core/src/option.rs:1292:5
  17:     0x7f3d4a246e08 - <rustc_driver::pretty::TypedAnnotation as rustc_hir_pretty::PpAnn>::post::h30ea5e789585bc4f
  18:     0x7f3d4c273ce9 - rustc_hir_pretty::State::print_expr::h630362f92949cd28
  19:     0x7f3d4c273e19 - rustc_hir_pretty::State::print_expr::h630362f92949cd28
  20:     0x7f3d4ce4a344 - rustc_hir_pretty::State::print_pat::h11d0d38ba109e243
  21:     0x7f3d4a246cbb - <rustc_driver::pretty::TypedAnnotation as rustc_hir_pretty::PpAnn>::nested::h53a621d91a26f1b3
  22:     0x7f3d4ce4b3d6 - rustc_hir_pretty::State::print_fn::{{closure}}::h45b100652a011fb5
  23:     0x7f3d4ce4b0d4 - rustc_hir_pretty::State::print_fn::h5235d146b7f44a93
  24:     0x7f3d4ce46af7 - rustc_hir_pretty::State::print_item::hd997ca7f360e8261
  25:     0x7f3d4a246cbb - <rustc_driver::pretty::TypedAnnotation as rustc_hir_pretty::PpAnn>::nested::h53a621d91a26f1b3
  26:     0x7f3d4b1a03b3 - rustc_hir_pretty::State::print_mod::hcf0cdbb827143e3c
  27:     0x7f3d4b19f79a - rustc_hir_pretty::print_crate::hd1b9ef1369b4e493
  28:     0x7f3d4a24a5e1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h78403d5a5d7ddadf
  29:     0x7f3d4a28993c - rustc_query_system::dep_graph::graph::DepGraph<K>::with_ignore::h82f9688f71c0f5b9
  30:     0x7f3d4a2479d8 - rustc_driver::pretty::print_after_hir_lowering::h102b65afa3784540
  31:     0x7f3d4a29963e - rustc_interface::passes::QueryContext::enter::he206c0d61f6fb2e9
  32:     0x7f3d4c6046d7 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hae97633c8f5175d4
  33:     0x7f3d4c5fce11 - rustc_span::with_source_map::hd16d211d24c668a9
  34:     0x7f3d4c603c62 - scoped_tls::ScopedKey<T>::set::h08e96579ac07fec5
  35:     0x7f3d4c605448 - std::sys_common::backtrace::__rust_begin_short_backtrace::h84dc4b3263d56f8c
  36:     0x7f3d4c5e3aba - core::ops::function::FnOnce::call_once{{vtable.shim}}::h209d27a00dc0b7e3
  37:     0x7f3d49a44ffa - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h321523073ee11258
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546:9
  38:     0x7f3d49a44ffa - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf0e85e12c83b99b3
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546:9
  39:     0x7f3d49a44ffa - std::sys::unix::thread::Thread::new::thread_start::hba22c7961aa0e2f8
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys/unix/thread.rs:71:17
  40:     0x7f3d4994a299 - start_thread
  41:     0x7f3d4985f153 - clone
  42:                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.52.0-nightly (9b471a3f5 2021-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=hir,typed

query stack during panic:
end of query stack
warning: 1 warning emitted

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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions