diff --git a/README.md b/README.md index 7660735a7cef..32eca3652945 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,9 @@ MIRI_SYSROOT=~/.xargo/HOST cargo run --bin miri tests/run-pass-fullmir/vecs.rs Notice that you will have to re-run the last step of the preparations above when your toolchain changes (e.g., when you update the nightly). +You can also set `-Zmiri-start-fn` to make miri start evaluation with the +`start_fn` lang item, instead of starting at the `main` function. + ## Contributing and getting help Check out the issues on this GitHub repository for some ideas. There's lots that diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 2cc22d7a7deb..51c53b4af275 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -135,13 +135,12 @@ fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>, use_start_fn: bo ); } else if let Some((entry_node_id, _, _)) = *state.session.entry_fn.borrow() { let entry_def_id = tcx.hir.local_def_id(entry_node_id); - let start_wrapper = tcx.lang_items().start_fn().and_then(|start_fn| { - if use_start_fn { - Some(start_fn) - } else { - None - } - }); + // Use start_fn lang item if we have -Zmiri-start-fn set + let start_wrapper = if use_start_fn { + Some(tcx.lang_items().start_fn().unwrap()) + } else { + None + }; miri::eval_main(tcx, entry_def_id, start_wrapper); state.session.abort_if_errors();