Closed
Description
I tried this code:
#![feature(let_chains)]
<with a lot of code>
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (e9920ef77 2021-02-11)
binary: rustc
commit-hash: e9920ef7749d11fc71cc32ca4ba055bcfeaab945
commit-date: 2021-02-11
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
thread 'rustc' panicked at 'expected `NodeId` to be lowered already for res Local(
NodeId(48000),
)', compiler/rustc_ast_lowering/src/lib.rs:714:17
stack backtrace:
0: rust_begin_unwind
at /rustc/e9920ef7749d11fc71cc32ca4ba055bcfeaab945/library/std/src/panicking.rs:493:5
1: std::panicking::begin_panic_fmt
at /rustc/e9920ef7749d11fc71cc32ca4ba055bcfeaab945/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: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
6: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_exprs
7: rustc_data_structures::stack::ensure_sufficient_stack
8: rustc_ast_lowering::LoweringContext::lower_stmt
9: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
10: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
11: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
12: rustc_arena::cold_path
13: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_if
14: rustc_data_structures::stack::ensure_sufficient_stack
15: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
16: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
17: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
18: rustc_arena::cold_path
19: rustc_ast_lowering::LoweringContext::lower_block
20: rustc_data_structures::stack::ensure_sufficient_stack
21: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_arm
22: rustc_ast_lowering::Arena::alloc_from_iter
23: rustc_data_structures::stack::ensure_sufficient_stack
24: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
25: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
26: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
27: rustc_arena::cold_path
28: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_if
29: rustc_data_structures::stack::ensure_sufficient_stack
30: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
31: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
32: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
33: rustc_arena::cold_path
34: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_if_let
35: rustc_data_structures::stack::ensure_sufficient_stack
36: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
37: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
38: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
39: rustc_arena::cold_path
40: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_fn_body_block
41: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_maybe_async_body
42: rustc_ast_lowering::LoweringContext::with_hir_id_owner
43: rustc_ast::visit::walk_item
44: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::with_parent_item_lifetime_defs
45: <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_mod
46: rustc_ast::visit::walk_item
47: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::with_parent_item_lifetime_defs
48: <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_mod
49: rustc_ast::visit::walk_item
50: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::with_parent_item_lifetime_defs
51: <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_mod
52: rustc_ast_lowering::lower_crate
53: rustc_interface::passes::BoxedResolver::access::{{closure}}
54: rustc_interface::passes::configure_and_expand::{{closure}}
55: rustc_interface::passes::BoxedResolver::access
56: rustc_interface::queries::Queries::lower_to_hir
57: rustc_interface::queries::Queries::global_ctxt
58: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
59: rustc_span::with_source_map
60: rustc_interface::interface::create_compiler_and_run
61: scoped_tls::ScopedKey<T>::set
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.52.0-nightly (e9920ef77 2021-02-11) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `project`
To learn more, run the command again with --verbose.
Process finished with exit code 101
Note:
A simpler program does not crash, but does not compile.
rust-lang/rfcs#2411 (comment)
#![feature(let_chains)]
use std::error::Error;
fn main(){
let obj = Some(1);
if let Some(i) = obj && i > 5 {
}
}
error: `let` expressions are not supported here
--> src/main.rs:5:8
|
5 | if let Some(i) = obj && i > 5 {
| ^^^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if`- and `while`-expressions
= note: as well as when nested within `&&` and parenthesis in those conditions