stack backtrace:
0: rust_begin_unwind
at /rustc/acbe4443cc4c9695c0b74a7b64b60333c990a400/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/acbe4443cc4c9695c0b74a7b64b60333c990a400/library/core/src/panicking.rs:107:14
2: <rustc_const_eval::interpret::eval_context::InterpCx<miri::machine::Evaluator>>::overflowing_binary_op
3: <rustc_const_eval::interpret::eval_context::InterpCx<miri::machine::Evaluator>>::binop_ignore_overflow
4: <rustc_const_eval::interpret::eval_context::InterpCx<miri::machine::Evaluator>>::statement
5: miri::eval::eval_entry
6: <rustc_interface::passes::QueryContext>::enter::<<miri::MiriCompilerCalls as rustc_driver::Callbacks>::after_analysis::{closure#0}, ()>
7: <miri::MiriCompilerCalls as rustc_driver::Callbacks>::after_analysis
8: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
9: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
10: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
Edit: see example in the first comment below for a reproduction without Miri.
I have created a minimal reproduction based on some more verbose code that was causing Miri to panic. Note this code does not panic when compiled to native code with rustc (though that doesn't mean there is no undefined behavior here).
Code
Meta
rustc --version --verbose:Error output
Backtrace