Closed tiif closed 3 months ago
When running tests in tests/pass-dep/shims/libc-misc.rs, the error message produced by the test is displayed in json format.
tests/pass-dep/shims/libc-misc.rs
use std::ffi::CString;
./miri run --dep tests/pass-dep/shims/libc-misc.rs -Zmiri-disable-isolation
$ rustfmt +miri --edition=2021 --config-path /home/byt/Documents/miri/rustfmt.toml --unstable-features --skip-children ... $ cargo +miri clippy --manifest-path /home/byt/Documents/miri/Cargo.toml --all-targets Finished `dev` profile [optimized + debuginfo] target(s) in 0.07s $ cargo +miri clippy --manifest-path /home/byt/Documents/miri/cargo-miri/Cargo.toml --all-targets Finished `dev` profile [optimized + debuginfo] target(s) in 0.02s $ cargo +miri clippy --manifest-path /home/byt/Documents/miri/miri-script/Cargo.toml --all-targets Finished `dev` profile [optimized + debuginfo] target(s) in 0.01s {"$message_type":"diagnostic","message":"unused import: `CString`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"tests/pass-dep/shims/libc-misc.rs","byte_start":6845,"byte_end":6852,"line_start":218,"line_end":218,"column_start":26,"column_end":33,"is_primary":true,"text":[{"text":" use std::ffi::{CStr, CString};","highlight_start":26,"highlight_end":33}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_imports)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove the unused import","code":null,"level":"help","spans":[{"file_name":"tests/pass-dep/shims/libc-misc.rs","byte_start":6843,"byte_end":6852,"line_start":218,"line_end":218,"column_start":24,"column_end":33,"is_primary":true,"text":[{"text":" use std::ffi::{CStr, CString};","highlight_start":24,"highlight_end":33}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: unused import: `CString`\n --> tests/pass-dep/shims/libc-misc.rs:218:26\n |\n218 | use std::ffi::{CStr, CString};\n | ^^^^^^^\n |\n = note: `#[warn(unused_imports)]` on by default\n\n"}
### Version:
rustc 1.79.0-nightly (23d47dba3 2024-04-06) binary: rustc commit-hash: 23d47dba319331d4418827cfbb8c1af283497d3c commit-date: 2024-04-06 host: x86_64-unknown-linux-gnu release: 1.79.0-nightly LLVM version: 18.1.2 os: Ubuntu 22.04.4 LTS [64-bit]
This is somehow related to --dep mode, it doesn't happen for "normal" --run.
--dep
--run
Thanks for the quick fix!
Problem
When running tests in
tests/pass-dep/shims/libc-misc.rs
, the error message produced by the test is displayed in json format.Reproduce:
tests/pass-dep/shims/libc-misc.rs
, I added unused imports below:./miri run --dep tests/pass-dep/shims/libc-misc.rs -Zmiri-disable-isolation
rustc 1.79.0-nightly (23d47dba3 2024-04-06) binary: rustc commit-hash: 23d47dba319331d4418827cfbb8c1af283497d3c commit-date: 2024-04-06 host: x86_64-unknown-linux-gnu release: 1.79.0-nightly LLVM version: 18.1.2 os: Ubuntu 22.04.4 LTS [64-bit]