run rustdoc with the miri cfg flag

This commit is contained in:
Ralf Jung 2021-11-14 12:16:03 -05:00
parent a8b976eb35
commit a15539e911
4 changed files with 12 additions and 4 deletions

View File

@ -1008,6 +1008,8 @@ fn phase_rustdoc(fst_arg: &str, mut args: env::Args) {
// rustdoc needs to know the right sysroot.
forward_miri_sysroot(&mut cmd);
// make sure the 'miri' flag is set for rustdoc
cmd.arg("--cfg").arg("miri");
// Make rustdoc call us back.
let cargo_miri_path = std::env::current_exe().expect("current executable path invalid");

View File

@ -16,6 +16,12 @@ pub fn make_true() -> bool {
issue_1691::use_me()
}
/// ```rust
/// cargo_miri_test::miri_only_fn();
/// ```
#[cfg(miri)]
pub fn miri_only_fn() {}
pub fn main() {
println!("imported main");
}

View File

@ -10,7 +10,7 @@ running 7 tests
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
running 3 tests
...
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
running 4 tests
....
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View File

@ -13,5 +13,5 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out; finished in $TIME
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in $TIME