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

rustc output hygiene wrt. stderr/stdout #48301

Closed
sanmai-NL opened this issue Feb 17, 2018 · 4 comments
Closed

rustc output hygiene wrt. stderr/stdout #48301

sanmai-NL opened this issue Feb 17, 2018 · 4 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sanmai-NL
Copy link

sanmai-NL commented Feb 17, 2018

rustc sometimes emits exclusively human-readable output on stdout. Moreover, it sometimes produces machine-readable output on stderr. It should be the other way around, and at least output writing should be principled.

When compiling a bin target helloworld:

On stdout:

bin: helloworld

This would interfere in parsing JSON messages (--error-format json), for example from Clippy. If only they weren’t mistakenly written on stderr, too ... It seems very simple to fix such little slip-ups, but I couldn’t track down the offending code for this instance.

Another sample of the same issue, from a different angle:

rustc --error-format json

Prints on stderr:

{"message":"no input filename given","code":null,"level":"error","spans":[],"children":[],"rendered":"error: no input filename given\n\n"}

I propose, first, that we decide to guarantee that all JSON will ever be printed on stdout exclusively, and all the rest on stderr exclusively. Second, to implement this by making the appropriate fixes across rustc, Cargo and Clippy.

Meta

rustc 1.25.0-nightly (3ec5a99 2018-02-14)

Related #36516

@pietroalbini pietroalbini added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 20, 2018
@Enselic
Copy link
Member

Enselic commented Sep 26, 2023

Triage: Can you provide step by step instructions on how to get bin: helloworld on stdout please? I can't reproduce. This gives me nothing on stdout (except from the compiled program being run):

$ echo 'fn main() { println!("hi"); }' | rustc +nightly -o main - && ./main
hi

@sanmai-NL
Copy link
Author

Maybe it was cargo build output.

@Enselic
Copy link
Member

Enselic commented Oct 1, 2023

Thank you for getting back to me.

In that case this issue should be reported against cargo instead of here I think?

@Enselic
Copy link
Member

Enselic commented Apr 18, 2024

Triage: Assuming yes, so let's close.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants