Merge pull request #394 from RalfJung/start-fn

document -Zmiri-start-fn; make its logic more clear
This commit is contained in:
Oliver Schneider 2018-07-12 00:01:14 +02:00 committed by GitHub
commit 54da84fbd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 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

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