Skip to content

Exit nonzero on rustc -Wall - #92504

Merged
bors merged 1 commit into
rust-lang:masterfrom
dtolnay:wall
Jan 7, 2022
Merged

Exit nonzero on rustc -Wall#92504
bors merged 1 commit into
rust-lang:masterfrom
dtolnay:wall

Conversation

@dtolnay

Copy link
Copy Markdown
Member

Previously rustc -Wall /dev/null would print a paragraph explaining that -Wall is not a thing in Rust, but would then exit 0. I believe exiting 0 is not the right behavior. For something like rustc --version or rustc --help or rustc -C help the user is requesting rustc to print some information; rustc prints that information and exits 0 because what the user requested has been accomplished. In the case of rustc -Wall path/to/main.rs, I don't find it correct to conceptualize this as "the user requested rustc to print information about the fact that Wall doesn't exist". The user requested a particular thing, and despite rustc knowing what they probably meant and informing them about that, the thing they requested has not been accomplished. Thus a nonzero exit code is needed.

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 2, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2022
@joshtriplett

joshtriplett commented Jan 3, 2022

Copy link
Copy Markdown
Member

Seems reasonable to me; returning non-zero on an unknown command-line option seems like the correct behavior, as long as that option isn't something ignored for compatibility purposes (which this isn't).

For some reason, I'm remembering a past incarnation of an issue very much like this, though I don't remember the details. Do you recall a previous issue about the exit code of rustc under similar circumstances?

@dtolnay

Copy link
Copy Markdown
MemberAuthor

I do not.

Comment threadcompiler/rustc_driver/src/lib.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use rustc_errors::FatalError.raise(); instead. This is what early_error() uses too.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! That works. I've updated the PR.

@jackh726

Copy link
Copy Markdown
Member

r=me with commits squashed

@jackh726jackh726 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 6, 2022
@dtolnay

Copy link
Copy Markdown
MemberAuthor

@bors r=jackh726

@bors

bors commented Jan 6, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 7174ec2 has been approved by jackh726

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 6, 2022
@jackh726

Copy link
Copy Markdown
Member

@bors rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2022
…askrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#91055 (return the correct type for closures in `type_of`)
- rust-lang#92207 (Delay remaining `span_bug`s in drop elaboration)
- rust-lang#92417 (Fix spacing and ordering of words in pretty printed Impl)
- rust-lang#92504 (Exit nonzero on rustc -Wall)
- rust-lang#92559 (RustWrapper: adapt to new AttributeMask API)
- rust-lang#92589 (Break the loop)
- rust-lang#92607 (rustc_metadata: Some minor cleanups and optimizations)
- rust-lang#92620 (Remove unused `ExtendDefault` struct)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 844a657 into rust-lang:masterJan 7, 2022
@rustbotrustbot added this to the 1.59.0 milestone Jan 7, 2022
@dtolnay
dtolnay deleted the wall branch January 31, 2022 08:02
@dtolnaydtolnay removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 14, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@dtolnay@rust-highfive@joshtriplett@jackh726@bors@bjorn3@rustbot