Closed
Description
Code
./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs
// run-pass
// issue #89688
#![feature(let_else)]
fn example_let_else(value: Option<String>) {
let Some(inner) = value else {
println!("other: {:?}", value); // OK
return;
};
println!("inner: {}", inner);
}
fn main() {
example_let_else(Some("foo".into()));
example_let_else(None);
}
Meta
rustc --version --verbose
:
rustc 1.64.0-nightly (87588a2af 2022-07-13)
binary: rustc
commit-hash: 87588a2afd9ca903366f0deaf84d805f34469384
commit-date: 2022-07-13
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
Error output
rustc ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs -Zvalidate-mir
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (start of phase transition from Built) at bb13[0]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass CheckPackedRef) at bb13[0]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass CheckConstItemMutation) at bb13[0]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass FunctionItemReferences) at bb13[0]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass SimplifyCfg-initial) at bb6[10]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass SanityCheck) at bb6[10]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass PhaseChange-Const) at bb6[10]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (end of phase transition to Const) at bb6[10]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (start of phase transition from Const) at bb6[10]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass PromoteTemps) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass SimplifyCfg-promote-consts) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (end of phase transition to ConstsPromoted) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (start of phase transition from ConstsPromoted) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass RemoveFalseEdges) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass SimplifyConstCondition-initial) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass RemoveNoopLandingPads) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass CleanupNonCodegenStatements) at bb6[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass SimplifyCfg-early-opt) at bb5[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass Derefer) at bb5[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ let_else_source_expr_nomove_pass[ed50]::example_let_else), const_param_did: None }) (after pass AddCallGuards) at bb5[9]:
use of local _2, which has no storage here
--> ./src/test/ui/let-else/let-else-source-expr-nomove-pass.rs:12:1
|
12 | }
| ^
|
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:129:36
Backtrace
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
stack backtrace:
0: 0x7f3ab90a2850 - std::backtrace_rs::backtrace::libunwind::trace::h546e34b136647819
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7f3ab90a2850 - std::backtrace_rs::backtrace::trace_unsynchronized::h76e576fe0a1ec65e
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f3ab90a2850 - std::sys_common::backtrace::_print_fmt::h3489fbb9d5d01094
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7f3ab90a2850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h401cfc97a3c2f247
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7f3ab90fbe2c - core::fmt::write::h327c921ac5532dc9
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/core/src/fmt/mod.rs:1198:17
5: 0x7f3ab9093e15 - std::io::Write::write_fmt::h334c1fe5d85b41a9
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/io/mod.rs:1672:15
6: 0x7f3ab90a54e1 - std::sys_common::backtrace::_print::hddc5656bc817cc55
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7f3ab90a54e1 - std::sys_common::backtrace::print::h46adcb0dcb6fbe81
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7f3ab90a54e1 - std::panicking::default_hook::{{closure}}::h7e55301ce91fa17d
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/panicking.rs:295:22
9: 0x7f3ab90a51b3 - std::panicking::default_hook::he24b412fa8dea167
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/panicking.rs:314:9
10: 0x7f3ab9947e04 - rustc_driver[24990f24c5f9557a]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f3ab90a5cb6 - std::panicking::rust_panic_with_hook::hd6be56b55800f278
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/panicking.rs:702:17
12: 0x7f3abaaef0d1 - std[66dc708de7974585]::panicking::begin_panic::<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>::{closure#0}
13: 0x7f3abaaef046 - std[66dc708de7974585]::sys_common::backtrace::__rust_end_short_backtrace::<std[66dc708de7974585]::panicking::begin_panic<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>::{closure#0}, !>
14: 0x7f3abaae82f6 - std[66dc708de7974585]::panicking::begin_panic::<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>
15: 0x7f3abaaeb326 - std[66dc708de7974585]::panic::panic_any::<rustc_errors[7a9b9cc96f052d83]::ExplicitBug>
16: 0x7f3abc3d9b93 - <rustc_errors[7a9b9cc96f052d83]::HandlerInner as core[734affb1a3eaf053]::ops::drop::Drop>::drop
17: 0x7f3abbb0331b - core[734affb1a3eaf053]::ptr::drop_in_place::<rustc_session[214423f9b1c42db1]::parse::ParseSess>
18: 0x7f3abbb05ed3 - <alloc[66d1c5d1fabcc843]::rc::Rc<rustc_session[214423f9b1c42db1]::session::Session> as core[734affb1a3eaf053]::ops::drop::Drop>::drop
19: 0x7f3abbae88bd - core[734affb1a3eaf053]::ptr::drop_in_place::<rustc_interface[d9e16a24b5464548]::interface::Compiler>
20: 0x7f3abbae6944 - rustc_span[b8cb56592c4d9b67]::with_source_map::<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_interface[d9e16a24b5464548]::interface::create_compiler_and_run<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#1}>
21: 0x7f3abbb02880 - rustc_interface[d9e16a24b5464548]::interface::create_compiler_and_run::<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>
22: 0x7f3abbb16a02 - <scoped_tls[93927b52d599628f]::ScopedKey<rustc_span[b8cb56592c4d9b67]::SessionGlobals>>::set::<rustc_interface[d9e16a24b5464548]::interface::run_compiler<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>
23: 0x7f3abbae8cff - std[66dc708de7974585]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d9e16a24b5464548]::util::run_in_thread_pool_with_globals<rustc_interface[d9e16a24b5464548]::interface::run_compiler<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>
24: 0x7f3abbb02cd9 - <<std[66dc708de7974585]::thread::Builder>::spawn_unchecked_<rustc_interface[d9e16a24b5464548]::util::run_in_thread_pool_with_globals<rustc_interface[d9e16a24b5464548]::interface::run_compiler<core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>, rustc_driver[24990f24c5f9557a]::run_compiler::{closure#1}>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>::{closure#0}, core[734affb1a3eaf053]::result::Result<(), rustc_errors[7a9b9cc96f052d83]::ErrorGuaranteed>>::{closure#1} as core[734affb1a3eaf053]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
25: 0x7f3ab90af703 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h332a3f23c5b3d8bc
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/alloc/src/boxed.rs:1934:9
26: 0x7f3ab90af703 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h33b3da7f4496df00
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/alloc/src/boxed.rs:1934:9
27: 0x7f3ab90af703 - std::sys::unix::thread::Thread::new::thread_start::hf48274d01b2ded65
at /rustc/87588a2afd9ca903366f0deaf84d805f34469384/library/std/src/sys/unix/thread.rs:108:17
28: 0x7f3ab8e8054d - <unknown>
29: 0x7f3ab8f05874 - clone
30: 0x0 - <unknown>
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.64.0-nightly (87588a2af 2022-07-13) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z validate-mir
query stack during panic:
end of query stack