Skip to content

Garbled error messages when building multiple binaries from same sources #3041

Closed
@osklil

Description

@osklil

If you build two different binaries from the same source files, error messages are repeated and mostly garbled.

How to reproduce

cargo new demo
echo -e '\n[[bin]]\nname = "p1"\npath = "src/main.rs"\n\n[[bin]]\nname = "p2"\npath = "src/main.rs"' >> demo/Cargo.toml
echo something > demo/src/main.rs
cd demo; cargo build

Actual output

   Compiling demo v0.1.0 (file:///home/usel/_t2/demo)
src/main.rs:1:1: 1:10 error: expected item, found `something`
src/main.rs:1:1: 1:10 src/main.rs:1 errorsomething:
              expected item, found `something`^~~~~~~~~

errorsrc/main.rs: aborting due to previous error:1
something
              ^~~~~~~~~
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: Could not compile `demo`.

To learn more, run the command again with --verbose.

Expected output

   Compiling demo v0.1.0 (file:///[...]/demo)
src/main.rs:1:1: 1:10 error: expected item, found `something`
src/main.rs:1 something
              ^~~~~~~~~
error: aborting due to previous error
error: Could not compile `demo`.

To learn more, run the command again with --verbose.
[more text]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions