document -Zmiri-start-fn; make its logic more clear

This commit is contained in:
Ralf Jung 2018-07-11 19:39:09 +02:00
parent ef64c25bd0
commit dd7cc47e5c
2 changed files with 5 additions and 7 deletions

View file

@ -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

View file

@ -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();