Merge pull request #4248 from RalfJung/edition-2024

bump parts of test-cargo-miri to edition 2024
This commit is contained in:
Ralf Jung 2025-04-04 12:51:26 +00:00 committed by GitHub
commit ec1f3afa9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 59 additions and 44 deletions

View file

@ -1,12 +1,12 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "autocfg"
version = "1.2.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "byteorder"
@ -96,15 +96,15 @@ version = "0.1.0"
[[package]]
name = "once_cell"
version = "1.19.0"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "proc-macro2"
version = "1.0.79"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
@ -129,6 +129,6 @@ version = "0.1.0"
[[package]]
name = "unicode-ident"
version = "1.0.12"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"

View file

@ -6,7 +6,7 @@ exclude = ["no-std-smoke"] # it wants to be panic="abort"
name = "cargo-miri-test"
version = "0.1.0"
authors = ["Miri Team"]
edition = "2018"
edition = "2024"
[dependencies]
byteorder = "1.0"

View file

@ -136,7 +136,7 @@ def test_cargo_miri_run():
cargo_miri("run") + ["--target-dir=custom-run", "--", "--target-dir=target/custom-run"],
"run.args.stdout.ref", "run.custom-target-dir.stderr.ref",
)
test("`cargo miri run --package=test-local-crate-detection` (test local crate detection)",
test("`cargo miri run` (test local crate detection)",
cargo_miri("run") + ["--package=test-local-crate-detection"],
"run.local_crate.stdout.ref", "run.local_crate.stderr.ref",
)
@ -149,43 +149,44 @@ def test_cargo_miri_test():
test("`cargo miri test`",
cargo_miri("test"),
default_ref, "test.stderr-empty.ref",
default_ref, "test.empty.ref",
env={'MIRIFLAGS': "-Zmiri-seed=4242"},
)
test("`cargo miri test` (no isolation, no doctests)",
cargo_miri("test") + ["--bins", "--tests"], # no `--lib`, we disabled that in `Cargo.toml`
"test.cross-target.stdout.ref", "test.stderr-empty.ref",
"test.cross-target.stdout.ref", "test.empty.ref",
env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
)
test("`cargo miri test` (with filter)",
cargo_miri("test") + ["--", "--format=pretty", "pl"],
filter_ref, "test.stderr-empty.ref",
filter_ref, "test.empty.ref",
)
test("`cargo miri test` (test target)",
cargo_miri("test") + ["--test", "test", "--", "--format=pretty"],
"test.test-target.stdout.ref", "test.stderr-empty.ref",
"test.test-target.stdout.ref", "test.empty.ref",
)
test("`cargo miri test` (bin target)",
cargo_miri("test") + ["--bin", "cargo-miri-test", "--", "--format=pretty"],
"test.bin-target.stdout.ref", "test.stderr-empty.ref",
"test.bin-target.stdout.ref", "test.empty.ref",
)
test("`cargo miri t` (subcrate, no isolation)",
cargo_miri("t") + ["-p", "subcrate"],
"test.subcrate.stdout.ref", "test.stderr-proc-macro.ref",
"test.subcrate.cross-target.stdout.ref" if is_foreign else "test.subcrate.stdout.ref",
"test.empty.ref",
env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
)
test("`cargo miri test` (subcrate, doctests)",
cargo_miri("test") + ["-p", "subcrate", "--doc"],
"test.stdout-empty.ref", "test.stderr-proc-macro-doctest.ref",
test("`cargo miri test` (proc-macro crate)",
cargo_miri("test") + ["-p", "proc_macro_crate"],
"test.empty.ref", "test.proc-macro.stderr.ref",
)
test("`cargo miri test` (custom target dir)",
cargo_miri("test") + ["--target-dir=custom-test"],
default_ref, "test.stderr-empty.ref",
default_ref, "test.empty.ref",
)
del os.environ["CARGO_TARGET_DIR"] # this overrides `build.target-dir` passed by `--config`, so unset it
test("`cargo miri test` (config-cli)",
cargo_miri("test") + ["--config=build.target-dir=\"config-cli\""],
default_ref, "test.stderr-empty.ref",
default_ref, "test.empty.ref",
)
if ARGS.multi_target:
test_cargo_miri_multi_target()
@ -194,7 +195,7 @@ def test_cargo_miri_test():
def test_cargo_miri_multi_target():
test("`cargo miri test` (multiple targets)",
cargo_miri("test", targets = ["aarch64-unknown-linux-gnu", "s390x-unknown-linux-gnu"]),
"test.multiple_targets.stdout.ref", "test.stderr-empty.ref",
"test.multiple_targets.stdout.ref", "test.empty.ref",
)
args_parser = argparse.ArgumentParser(description='`cargo miri` testing')

View file

@ -26,7 +26,8 @@
///
/// let _val = Fail::<i32>::C;
/// ```
#[no_mangle]
// This is imported in `main.rs`.
#[unsafe(no_mangle)]
pub fn make_true() -> bool {
proc_macro_crate::use_the_dependency!();
issue_1567::use_the_dependency();

View file

@ -30,7 +30,7 @@ fn main() {
let mut out = Vec::with_capacity(1024);
unsafe {
extern "Rust" {
unsafe extern "Rust" {
fn miri_host_to_target_path(
path: *const c_char,
out: *mut c_char,
@ -81,7 +81,7 @@ mod test {
// Test calling exported symbols in (transitive) dependencies.
// Repeat calls to make sure the `Instance` cache is not broken.
for _ in 0..3 {
extern "Rust" {
unsafe extern "Rust" {
fn exported_symbol() -> i32;
fn assoc_fn_as_exported_symbol() -> i32;
fn make_true() -> bool;

View file

@ -2,11 +2,11 @@
name = "subcrate"
version = "0.1.0"
authors = ["Miri Team"]
# This is deliberately *not* on the 2024 edition to ensure doctests keep working
# on old editions.
edition = "2018"
[lib]
proc-macro = true
doctest = false
[[bin]]
name = "subcrate"

View file

@ -1,16 +1,8 @@
// This is a proc-macro crate.
extern crate proc_macro; // make sure proc_macro is in the sysroot
#[cfg(doctest)]
compile_error!("rustdoc should not touch me");
#[cfg(miri)]
compile_error!("Miri should not touch me");
use proc_macro::TokenStream;
#[proc_macro]
pub fn make_answer(_item: TokenStream) -> TokenStream {
"fn answer() -> u32 { 42 }".parse().unwrap()
/// Doc-test test
///
/// ```rust
/// assert!(subcrate::make_true());
/// ```
pub fn make_true() -> bool {
true
}

View file

@ -1 +1,2 @@
Running unit tests of `proc-macro` crates is not currently supported by Miri.
Running doctests of `proc-macro` crates is not currently supported by Miri.

View file

@ -1 +0,0 @@
Running doctests of `proc-macro` crates is not currently supported by Miri.

View file

@ -0,0 +1,11 @@
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
subcrate testing

View file

@ -1,6 +1,16 @@
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
subcrate testing
running 1 test
.
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME