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

--message-format short triggers internal cargo-miri panic #3043

Open
kadiwa4 opened this issue Aug 29, 2023 · 4 comments
Open

--message-format short triggers internal cargo-miri panic #3043

kadiwa4 opened this issue Aug 29, 2023 · 4 comments
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-bug Category: This is a bug.

Comments

@kadiwa4
Copy link

kadiwa4 commented Aug 29, 2023

Running cargo +nightly miri test --message-format short results in an internal cargo-miri panic.

Example lib.rs:

//! ```
//! assert_eq!(1 + 1, 2);
//! ```
Output
Preparing a sysroot for Miri (target: x86_64-apple-darwin)... done
    Finished test [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests src/lib.rs (target/miri/x86_64-apple-darwin/debug/deps/tmp-320a0fd09b613afb)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests tmp

running 1 test
test src/lib.rs - (line 1) ... FAILED

failures:

---- src/lib.rs - (line 1) stdout ----
Test executable failed (exit status: 101).

stderr:
thread 'main' panicked at src/tools/miri/cargo-miri/src/phases.rs:532:13:
assertion failed: suffix.starts_with(\'=\')
stack backtrace:
   0:        0x101a4c9ab - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc6e24405ab49cf6a
   1:        0x101a6e81b - core::fmt::write::hba1074a1739ff437
   2:        0x101a492ce - std::io::Write::write_fmt::h23c1134022d95821
   3:        0x101a4c789 - std::sys_common::backtrace::print::h10e3e1f9930ad6b0
   4:        0x101a4e4a8 - std::panicking::panic_hook_with_disk_dump::{{closure}}::heba4da2e45908525
   5:        0x101a4e1b5 - std::panicking::panic_hook_with_disk_dump::h6ca090a7ebe70b0e
   6:        0x101a4eac6 - std::panicking::rust_panic_with_hook::heb109e5af3a57c46
   7:        0x101a4e997 - std::panicking::begin_panic_handler::{{closure}}::h406476c3b1a5ecca
   8:        0x101a4ce89 - std::sys_common::backtrace::__rust_end_short_backtrace::h5966efc07d05eecf
   9:        0x101a4e6fd - _rust_begin_unwind
  10:        0x101a7c4a5 - core::panicking::panic_fmt::h4d90734c99616f06
  11:        0x101a7c537 - core::panicking::panic::h1950c2a470d70e81
  12:        0x1019cabc0 - cargo_miri[37c3d5d5e0cd7b06]::phases::phase_runner::<std[104a5f197c5359f5]::env::Args>
  13:        0x1019e0941 - cargo_miri[37c3d5d5e0cd7b06]::main
  14:        0x1019df7b6 - std[104a5f197c5359f5]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  15:        0x1019e07cc - std[104a5f197c5359f5]::rt::lang_start::<()>::{closure#0}
  16:        0x101a4398a - std::rt::lang_start_internal::h476b5e1d4a1f36f0
  17:        0x1019e0c9c - _main



failures:
    src/lib.rs - (line 1)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s

error: doctest failed, to rerun pass `--doc`

I don't know if --message-format is supposed to be supported at all or not, but the message is not very nice. Feel free to close this if it doesn't feel important enough.

@kadiwa4 kadiwa4 changed the title --message-format short doesn't work with doctest --message-format short triggers internal cargo-miri panic Aug 29, 2023
@RalfJung
Copy link
Member

RalfJung commented Aug 29, 2023

Ugh yeah that is ugly.

Out of curiosity, does cargo +nightly miri test --message-format=short work?

@kadiwa4
Copy link
Author

kadiwa4 commented Aug 29, 2023

No, same result.

@RalfJung
Copy link
Member

That is strange, but maybe cargo parses and re-serializes the argument.

The issue is that here we only support arguments with the value passed via =, not via separate arguments for flag and value. This should be fairly easy to fix: if the suffix is empty, also drop the next argument.

@RalfJung
Copy link
Member

Though thinking about it, that might just show up as the next bug where we don't respect --mesage-format for doctests. Looks like we should maybe just not mess with --message-format and --json when phase is Rustdoc? Not sure if the --extern patching is still needed, but it probably is.

@RalfJung RalfJung added C-bug Category: This is a bug. A-cargo Area: affects the cargo wrapper (cargo miri) labels Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants