Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ZhangZhuoSJTU opened this issue Feb 6, 2021 · 4 comments
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ZhangZhuoSJTU
Copy link

ZhangZhuoSJTU commented Feb 6, 2021

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`.

@ZhangZhuoSJTU ZhangZhuoSJTU added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 6, 2021
@jonas-schievink jonas-schievink added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Feb 6, 2021
@osa1
Copy link
Contributor

osa1 commented Feb 7, 2021

Beautiful reproducer @ZhangZhuoSJTU. I'm curious how you're generating these? Do you have a program generator or are you doing this by manually?

Smaller repro, it fails the same way if I remove the return type:

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

@ZhangZhuoSJTU
Copy link
Author

Hi, @osa1 . Thanks for your reply.

I am studying the codebase of rustc, so I build a toy fuzzer and static analyzer to play with it. These ICEs are generated by the fuzzer and analyzer. As I am quite new here, I sometimes report duplicated issues (I search the keywords before submitting issues, but it does not always work very well). Anyway, I will try my best to avoid such bortherings.

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 7, 2021
@apiraino apiraino added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 10, 2021
@apiraino
Copy link
Contributor

Assigning P-medium as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@jyn514
Copy link
Member

jyn514 commented Feb 20, 2021

Duplicate of #82250.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants