Closed
Description
Code
fn main() {
let jobj = json::parse(r#"{ "config": [ { "label": { "active": true } } ] }"#).unwrap();
for obj in jobj["config"].members() {
for (k, v) in obj.entries().take(1) {
if let json::JsonValue::Boolean(state) = v["active"] && true {
if state {
println!("{}", k)
}
}
}
}
}
Meta
rustc --version --verbose
:
rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-apple-darwin
release: 1.51.0
LLVM version: 11.0.1
Error output
<output>
Backtrace
$ RUST_BACKTRACE=1 cargo build
Compiling bug v0.1.0 (/private/tmp/bug)
error[E0658]: `let` expressions in this position are experimental
--> src/main.rs:6:16
|
6 | if let json::JsonValue::Boolean(state) = v["active"] && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
thread 'rustc' panicked at 'expected `NodeId` to be lowered already for res Local(
NodeId(44),
)', compiler/rustc_ast_lowering/src/lib.rs:714:17
stack backtrace:
0: _rust_begin_unwind
1: std::panicking::begin_panic_fmt
2: rustc_ast_lowering::LoweringContext::lower_res::{{closure}}::{{closure}}
3: rustc_ast_lowering::LoweringContext::lower_node_id_generic
4: rustc_ast_lowering::path::<impl rustc_ast_lowering::LoweringContext>::lower_qpath
5: rustc_data_structures::stack::ensure_sufficient_stack
6: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_if
7: rustc_data_structures::stack::ensure_sufficient_stack
8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
9: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
10: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
11: rustc_arena::cold_path
12: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_if
13: rustc_data_structures::stack::ensure_sufficient_stack
14: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
15: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
16: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
17: rustc_arena::cold_path
18: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_for
19: rustc_data_structures::stack::ensure_sufficient_stack
20: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
21: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
22: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
23: rustc_arena::cold_path
24: rustc_ast_lowering::expr::<impl rustc_ast_lowering::LoweringContext>::lower_expr_for
25: rustc_data_structures::stack::ensure_sufficient_stack
26: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
27: <core::iter::adapters::flatten::Flatten<I> as core::iter::traits::iterator::Iterator>::next
28: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
29: rustc_arena::cold_path
30: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_block_expr_opt
31: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_fn_body_block
32: rustc_ast_lowering::item::<impl rustc_ast_lowering::LoweringContext>::lower_item
33: rustc_ast_lowering::LoweringContext::with_hir_id_owner
34: <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_mod
35: rustc_ast_lowering::lower_crate
36: rustc_interface::passes::BoxedResolver::access::{{closure}}
37: rustc_interface::passes::configure_and_expand::{{closure}}
38: rustc_interface::passes::BoxedResolver::access
39: rustc_interface::queries::Queries::lower_to_hir
40: rustc_interface::queries::Queries::global_ctxt
41: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
42: rustc_span::with_source_map
43: rustc_interface::interface::create_compiler_and_run
44: 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 (2fd73fabe 2021-03-23) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
error: could not compile `bug`
To learn more, run the command again with --verbose.