From dd7cc47e5c73eeff21c358e6bf10d6db656ce0c4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 11 Jul 2018 19:39:09 +0200 Subject: [PATCH] document -Zmiri-start-fn; make its logic more clear --- README.md | 3 +++ src/bin/miri.rs | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) 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 3001500d2e07..bd0a930471b2 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -138,13 +138,8 @@ 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 it is available and we have -Zmiri-start-fn set + let start_wrapper = if use_start_fn { tcx.lang_items().start_fn() } else { None }; miri::eval_main(tcx, entry_def_id, start_wrapper); state.session.abort_if_errors();