This commit is contained in:
hyd-dev 2021-04-30 18:50:40 +08:00
parent 5faf5a5ca0
commit b30c5fef5b
No known key found for this signature in database
GPG Key ID: 74FA7FD5B8DA14B8
11 changed files with 25 additions and 3 deletions

View File

@ -26,7 +26,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls<'_> {
self.bencher.iter(|| {
let config = miri::MiriConfig::default();
miri::eval_main(tcx, entry_def_id.to_def_id(), config);
miri::eval_main(tcx, entry_def_id, config);
});
});

View File

@ -1 +1 @@
06f0adb34570ba83fee391abeb0bec0eec28a234
bcd696d722c04a0f8c34d884aa4ed2322f55cdd8

View File

@ -50,7 +50,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
env::set_current_dir(cwd).unwrap();
}
if let Some(return_code) = miri::eval_main(tcx, entry_def_id.to_def_id(), config) {
if let Some(return_code) = miri::eval_main(tcx, entry_def_id, config) {
std::process::exit(
i32::try_from(return_code).expect("Return value was too large!"),
);

View File

@ -23,3 +23,7 @@ serde_derive = "1.0" # not actually used, but exercises some unique code path (`
[lib]
test = false # test that this is respected (will show in the output)
[[test]]
name = "main"
harness = false

View File

@ -14,3 +14,7 @@ pub fn make_true() -> bool {
issue_1760::use_the_dependency!();
issue_1691::use_me()
}
pub fn main() {
println!("imported main");
}

View File

@ -3,6 +3,7 @@ running 1 test
.
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
imported main
running 7 tests
..i....

View File

@ -3,6 +3,7 @@ running 1 test
.
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
imported main
running 7 tests
..i....

View File

@ -3,6 +3,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
imported main
running 1 test
test simple1 ... ok

View File

@ -3,6 +3,7 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
imported main
running 1 test
test simple1 ... ok

View File

@ -0,0 +1,3 @@
#![feature(imported_main)]
use cargo_miri_test::main;

View File

@ -0,0 +1,7 @@
#![feature(imported_main)]
mod foo {
pub(crate) fn bar() {}
}
use foo::bar as main;