We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following program:
// field_ty.rs fn main() { let mut y = 0; let mut box_maybe_closure = Box::new(None); *box_maybe_closure = Some(|| { y += 1; }); }
I expect miri to be able to run this program without any errors. Instead, I get:
$ RUST_BACKTRACE=1 cargo run --bin miri field_ty.rs Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running `target/debug/miri field_ty.rs` ERROR:rustc_miri::interpret::eval_context: An error occurred in miri: 2: rustc_miri::interpret::error::{{impl}}::from at src/librustc_mir/interpret/error.rs:24 3: core::convert::{{impl}}::into<rustc_miri::interpret::error::EvalErrorKind,rustc_miri::interpret::error::EvalError> at /checkout/src/libcore/convert.rs:398 4: rustc_miri::interpret::eval_context::{{impl}}::get_field_ty<miri::Evaluator> at /home/dwrensha/src/miri/src/librustc_mir/interpret/mod.rs:5 5: rustc_miri::interpret::eval_context::{{impl}}::field_path_offset_and_ty<miri::Evaluator,core::iter::Map<core::iter::Skip<core::slice::Iter<u32>>, closure>> at /home/dwrensha/src/miri/src/librustc_mir/interpret/eval_context.rs:1041 6: rustc_miri::interpret::eval_context::{{impl}}::nonnull_offset_and_ty<miri::Evaluator> at /home/dwrensha/src/miri/src/librustc_mir/interpret/eval_context.rs:1021 7: rustc_miri::interpret::eval_context::{{impl}}::eval_rvalue_into_lvalue<miri::Evaluator> at /home/dwrensha/src/miri/src/librustc_mir/interpret/eval_context.rs:752 8: rustc_miri::interpret::step::{{impl}}::statement<miri::Evaluator> at /home/dwrensha/src/miri/src/librustc_mir/interpret/step.rs:95 9: rustc_miri::interpret::step::{{impl}}::step<miri::Evaluator> at /home/dwrensha/src/miri/src/librustc_mir/interpret/step.rs:61 10: miri::eval_main::run_main at miri/lib.rs:121 11: miri::eval_main at miri/lib.rs:134 error: can't handle type: [closure@field_ty.rs:6:31: 6:45 y:&mut i32], TyClosure(DefId { krate: CrateNum(0), node: DefIndex(2147483659) => field_ty/8cd878b::main[0]::{{closure}}[0] }, ClosureSubsts { substs: Slice([&mut i32]) }) --> field_ty.rs:5:42 | 5 | let mut box_maybe_closure = Box::new(None); | ^^^^ | note: inside call to main --> field_ty.rs:3:1 | 3 | / fn main() { 4 | | let mut y = 0; 5 | | let mut box_maybe_closure = Box::new(None); 6 | | *box_maybe_closure = Some(|| { y += 1; }); 7 | | } | |_^ error: aborting due to previous error thread 'main' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:524:8 stack backtrace: 0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: std::sys_common::backtrace::_print at /checkout/src/libstd/sys_common/backtrace.rs:71 2: std::panicking::default_hook::{{closure}} at /checkout/src/libstd/sys_common/backtrace.rs:60 at /checkout/src/libstd/panicking.rs:380 3: std::panicking::default_hook at /checkout/src/libstd/panicking.rs:396 4: std::panicking::rust_panic_with_hook at /checkout/src/libstd/panicking.rs:610 5: std::panicking::begin_panic 6: rustc_errors::Handler::abort_if_errors 7: miri::after_analysis at miri/bin/miri.rs:139 8: core::ops::function::Fn::call at /checkout/src/libcore/ops/function.rs:48 9: rustc_driver::driver::compile_input::{{closure}} 10: rustc::ty::context::TyCtxt::create_and_enter 11: rustc_driver::driver::compile_input 12: rustc_driver::run_compiler 13: miri::main at miri/bin/miri.rs:258 14: __rust_maybe_catch_panic at /checkout/src/libpanic_unwind/lib.rs:98 15: std::rt::lang_start at /checkout/src/libstd/panicking.rs:458 at /checkout/src/libstd/panic.rs:361 at /checkout/src/libstd/rt.rs:61 16: main 17: __libc_start_main 18: _start
The text was updated successfully, but these errors were encountered:
Handle closures in get_field_ty
f095562
Fixes rust-lang#304
This will be fixed by #306. However, currently CI is broken until this Rust PR lands, so we can't merge right now.
Sorry, something went wrong.
e332ab9
No branches or pull requests
Consider the following program:
I expect miri to be able to run this program without any errors. Instead, I get:
The text was updated successfully, but these errors were encountered: