Skip to content

Thread 'rustc' panicked at 'expected NodeId to be lowered already for res Local(NodeId(15))' #81845

Closed
@ZhangZhuoSJTU

Description

@ZhangZhuoSJTU

It seems duplicated as #79537 and #80978. However, as these issues are closed (maybe indicating there are solved?), I open this one.

I apologize in advance for any possible inconvenience.

Code

fn e() -> x {
    if *let x = 0 { x

The md5 is: a52dcf5eee71e25184963e0c2f62a9d1

Meta

This ICE only occurs on nightly version.

rustc --version --verbose:

➜  playground rustc --version --verbose
rustc 1.51.0-nightly (23adf9fd8 2021-02-05)
binary: rustc
commit-hash: 23adf9fd843da7a3394c824b056f93151aaa40ad
commit-date: 2021-02-05
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1

Error output

➜  playground rustc poc.rs
error: this file contains an unclosed delimiter
 --> poc.rs:2:23
  |
1 | fn e() -> x {
  |             - unclosed delimiter
2 |     if *let x = 0 { x
  |                   -   ^
  |                   |
  |                   unclosed delimiter

error[E0412]: cannot find type `x` in this scope
 --> poc.rs:1:11
  |
1 | fn e() -> x {
  |           ^ not found in this scope

error[E0658]: `let` expressions in this position are experimental
 --> poc.rs:2:9
  |
2 |     if *let x = 0 { x
  |         ^^^^^^^^^
  |
  = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
  = help: add `#![feature(let_chains)]` to the crate attributes to enable

thread 'rustc' panicked at 'expected `NodeId` to be lowered already for res Local(
    NodeId(15),
)', compiler/rustc_ast_lowering/src/lib.rs:714:17
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.51.0-nightly (23adf9fd8 2021-02-05) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.

Backtrace

➜  playground RUST_BACKTRACE=1 rustc poc.rs
error: this file contains an unclosed delimiter
 --> poc.rs:2:23
  |
1 | fn e() -> x {
  |             - unclosed delimiter
2 |     if *let x = 0 { x
  |                   -   ^
  |                   |
  |                   unclosed delimiter

error[E0412]: cannot find type `x` in this scope
 --> poc.rs:1:11
  |
1 | fn e() -> x {
  |           ^ not found in this scope

error[E0658]: `let` expressions in this position are experimental
 --> poc.rs:2:9
  |
2 |     if *let x = 0 { x
  |         ^^^^^^^^^
  |
  = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
  = help: add `#![feature(let_chains)]` to the crate attributes to enable

thread 'rustc' panicked at 'expected `NodeId` to be lowered already for res Local(
    NodeId(15),
)', compiler/rustc_ast_lowering/src/lib.rs:714:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/23adf9fd843da7a3394c824b056f93151aaa40ad/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/23adf9fd843da7a3394c824b056f93151aaa40ad/library/std/src/panicking.rs:435:5
   2: rustc_ast_lowering::LoweringContext::lower_node_id_generic
   3: rustc_ast_lowering::path::<impl rustc_ast_lowering::LoweringContext>::lower_qpath
   4: rustc_data_structures::stack::ensure_sufficient_stack
   5: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   6: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
   7: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
   8: rustc_arena::cold_path
   9: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_if
  10: rustc_data_structures::stack::ensure_sufficient_stack
  11: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  12: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
  13: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
  14: rustc_arena::cold_path
  15: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_fn_body_block
  16: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_maybe_async_body
  17: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_item
  18: rustc_ast_lowering::LoweringContext::with_hir_id_owner
  19: <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_mod
  20: rustc_ast_lowering::lower_crate
  21: rustc_interface::passes::BoxedResolver::access::{{closure}}
  22: rustc_interface::passes::configure_and_expand::{{closure}}
  23: rustc_interface::passes::BoxedResolver::access
  24: rustc_interface::queries::Queries::lower_to_hir
  25: rustc_interface::queries::Queries::global_ctxt
  26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  27: rustc_span::with_source_map
  28: rustc_interface::interface::create_compiler_and_run
  29: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.51.0-nightly (23adf9fd8 2021-02-05) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-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