Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error detected by test is rendered as json format #3463

Closed
tiif opened this issue Apr 15, 2024 · 2 comments · Fixed by #3465
Closed

Error detected by test is rendered as json format #3463

tiif opened this issue Apr 15, 2024 · 2 comments · Fixed by #3465

Comments

@tiif
Copy link
Contributor

tiif commented Apr 15, 2024

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:

  1. Add an error in tests/pass-dep/shims/libc-misc.rs, I added unused imports below:
    use std::ffi::CString;
  1. Run ./miri run --dep tests/pass-dep/shims/libc-misc.rs -Zmiri-disable-isolation
  2. The error (i.e. last line of the output) is rendered as json format:
$ 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]
@RalfJung
Copy link
Member

This is somehow related to --dep mode, it doesn't happen for "normal" --run.

@tiif
Copy link
Contributor Author

tiif commented Apr 15, 2024

Thanks for the quick fix!

RalfJung pushed a commit to RalfJung/rust that referenced this issue Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants