Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hyd-dev committed Apr 30, 2021
1 parent 5faf5a5 commit b30c5fe
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benches/helpers/miri_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
06f0adb34570ba83fee391abeb0bec0eec28a234
bcd696d722c04a0f8c34d884aa4ed2322f55cdd8
2 changes: 1 addition & 1 deletion src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!"),
);
Expand Down
4 changes: 4 additions & 0 deletions test-cargo-miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions test-cargo-miri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ pub fn make_true() -> bool {
issue_1760::use_the_dependency!();
issue_1691::use_me()
}

pub fn main() {
println!("imported main");
}
1 change: 1 addition & 0 deletions test-cargo-miri/test.cross-target.stdout.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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....
Expand Down
1 change: 1 addition & 0 deletions test-cargo-miri/test.default.stdout.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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....
Expand Down
1 change: 1 addition & 0 deletions test-cargo-miri/test.filter.cross-target.stdout.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test-cargo-miri/test.filter.stdout.ref
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test-cargo-miri/tests/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![feature(imported_main)]

use cargo_miri_test::main;
7 changes: 7 additions & 0 deletions tests/run-pass/main_fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![feature(imported_main)]

mod foo {
pub(crate) fn bar() {}
}

use foo::bar as main;

0 comments on commit b30c5fe

Please sign in to comment.