Skip to content

Add must_use lint to ExitCode - #162805

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
ChrisDenton:exit-code-must-use
Sep 17, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
ChrisDenton:exit-code-must-use

Conversation

@ChrisDenton

Copy link
Copy Markdown
Member

An ExitCode is intended to be returned from main (or used in other ways of terminating a process). It's also a Result like type in that it has success and error values. It's probably a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with let _ = ...).

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 15, 2026
@rustbot

rustbot commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey, jhpratt

@jhpratt

jhpratt commented Sep 16, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 640d68d has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 16, 2026
…jhpratt

Add `must_use` lint to `ExitCode`

An [`ExitCode`](https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html) is intended to be returned from `main` (or used in other ways of terminating a process). It's also a `Result` like type in that it has success and error values. It's *probably* a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with `let _ = ...`).
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #162866 (comment)

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 16, 2026
@rust-bors

rust-bors Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#162866), which was unapproved.

View changes since this unapproval

@ChrisDenton

Copy link
Copy Markdown
Member Author

@bors try jobs=test-aarch64-gnu-llvm-21-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 16, 2026
Add `must_use` lint to `ExitCode`


try-job: test-aarch64-gnu-llvm-21-1
@rust-bors

rust-bors Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e812626 (e812626eee6bfffcb1e8966dab34cafec9f50796)
Base parent: 923c95c (923c95cdf5ba65cea505aa2ea829f578e1506ed8)

@ChrisDenton

Copy link
Copy Markdown
Member Author

Just a trivial test change to ignore the returned ExitCode in an attribute test.

@bors r=jhpratt

@rust-bors

rust-bors Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 99261fb has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 16, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 17, 2026
…jhpratt

Add `must_use` lint to `ExitCode`

An [`ExitCode`](https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html) is intended to be returned from `main` (or used in other ways of terminating a process). It's also a `Result` like type in that it has success and error values. It's *probably* a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with `let _ = ...`).
rust-bors Bot pushed a commit that referenced this pull request Sep 17, 2026
Rollup of 12 pull requests

Successful merges:

 - #161596 (coretests: Add more pattern tests.)
 - #162796 (libtest: do not early exit from test runners)
 - #162844 (Add loan reachability traces to polonius MIR dumps)
 - #158186 (Guarantee 8 bytes of alignment of RawWakerVTable)
 - #160108 (Stabilize `windows_process_extensions_main_thread_handle`)
 - #160212 (traits: Fix rigid alias liveness matching)
 - #160544 (Stabilize `feature(trim_prefix_suffix)` (`{str, [T], Path}::trim_prefix` and `{str, [T]}::trim_suffix`))
 - #161305 (Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha)
 - #161838 (tests: accept LLVM 24 optimization in this test)
 - #162805 (Add `must_use` lint to `ExitCode`)
 - #162825 (core: Add examples for `debug_closure_helpers`)
 - #162856 (Stabilize CommandExt::show_window)
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 17, 2026
…jhpratt

Add `must_use` lint to `ExitCode`

An [`ExitCode`](https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html) is intended to be returned from `main` (or used in other ways of terminating a process). It's also a `Result` like type in that it has success and error values. It's *probably* a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with `let _ = ...`).
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 17, 2026
…jhpratt

Add `must_use` lint to `ExitCode`

An [`ExitCode`](https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html) is intended to be returned from `main` (or used in other ways of terminating a process). It's also a `Result` like type in that it has success and error values. It's *probably* a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with `let _ = ...`).
rust-bors Bot pushed a commit that referenced this pull request Sep 17, 2026
Rollup of 16 pull requests

Successful merges:

 - #161596 (coretests: Add more pattern tests.)
 - #162796 (libtest: do not early exit from test runners)
 - #162844 (Add loan reachability traces to polonius MIR dumps)
 - #162876 (Move operations out of `rustc_middle::query::job`)
 - #160108 (Stabilize `windows_process_extensions_main_thread_handle`)
 - #160212 (traits: Fix rigid alias liveness matching)
 - #160544 (Stabilize `feature(trim_prefix_suffix)` (`{str, [T], Path}::trim_prefix` and `{str, [T]}::trim_suffix`))
 - #161246 (Normalize non-rigid aliases in ty_known_to_outlive)
 - #161305 (Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha)
 - #161838 (tests: accept LLVM 24 optimization in this test)
 - #162805 (Add `must_use` lint to `ExitCode`)
 - #162825 (core: Add examples for `debug_closure_helpers`)
 - #162841 (enable asm tests for xtensa targets)
 - #162842 (reintroduce check RibKind::ConstParamTy did in direct consts)
 - #162845 (mgca: fix issue with mismatched array valtree/valtree tys)
 - #162856 (Stabilize CommandExt::show_window)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 17, 2026
…jhpratt

Add `must_use` lint to `ExitCode`

An [`ExitCode`](https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html) is intended to be returned from `main` (or used in other ways of terminating a process). It's also a `Result` like type in that it has success and error values. It's *probably* a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with `let _ = ...`).
rust-bors Bot pushed a commit that referenced this pull request Sep 17, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #161596 (coretests: Add more pattern tests.)
 - #162177 (Properly implement the gpu-kernel ABI for amdgpu)
 - #162411 (Make Receiver `#[rustc_dyn_incompatible_trait]`)
 - #162760 (yeet alias new_from_def_id)
 - #162796 (libtest: do not early exit from test runners)
 - #162844 (Add loan reachability traces to polonius MIR dumps)
 - #162876 (Move operations out of `rustc_middle::query::job`)
 - #160108 (Stabilize `windows_process_extensions_main_thread_handle`)
 - #160212 (traits: Fix rigid alias liveness matching)
 - #160544 (Stabilize `feature(trim_prefix_suffix)` (`{str, [T], Path}::trim_prefix` and `{str, [T]}::trim_suffix`))
 - #161305 (Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha)
 - #161838 (tests: accept LLVM 24 optimization in this test)
 - #162312 (core: Rewrite docs for try_as_dyn)
 - #162785 (Avoid creating overlapping assignments in MatchBranchSimplification)
 - #162805 (Add `must_use` lint to `ExitCode`)
 - #162825 (core: Add examples for `debug_closure_helpers`)
 - #162841 (enable asm tests for xtensa targets)
 - #162842 (reintroduce check RibKind::ConstParamTy did in direct consts)
 - #162845 (mgca: fix issue with mismatched array valtree/valtree tys)
 - #162856 (Stabilize CommandExt::show_window)
 - #162865 (Complex conjugate, negation and default)
 - #162874 (Add support for `annotate_snippets::snippet::AnnotationKind::Visible`)
 - #162881 (Simplify the macro for forwarding Decoder methods )
 - #162888 (Fix a typo on the Armv7-R platform docs page)
rust-bors Bot pushed a commit that referenced this pull request Sep 17, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #161596 (coretests: Add more pattern tests.)
 - #162411 (Make Receiver `#[rustc_dyn_incompatible_trait]`)
 - #162760 (yeet alias new_from_def_id)
 - #162796 (libtest: do not early exit from test runners)
 - #162844 (Add loan reachability traces to polonius MIR dumps)
 - #162876 (Move operations out of `rustc_middle::query::job`)
 - #160108 (Stabilize `windows_process_extensions_main_thread_handle`)
 - #160212 (traits: Fix rigid alias liveness matching)
 - #160544 (Stabilize `feature(trim_prefix_suffix)` (`{str, [T], Path}::trim_prefix` and `{str, [T]}::trim_suffix`))
 - #161305 (Use the entire type of a dropped local to compute variance (edge direction) for Polonius alpha)
 - #161838 (tests: accept LLVM 24 optimization in this test)
 - #162312 (core: Rewrite docs for try_as_dyn)
 - #162785 (Avoid creating overlapping assignments in MatchBranchSimplification)
 - #162805 (Add `must_use` lint to `ExitCode`)
 - #162825 (core: Add examples for `debug_closure_helpers`)
 - #162841 (enable asm tests for xtensa targets)
 - #162842 (reintroduce check RibKind::ConstParamTy did in direct consts)
 - #162845 (mgca: fix issue with mismatched array valtree/valtree tys)
 - #162856 (Stabilize CommandExt::show_window)
 - #162865 (Complex conjugate, negation and default)
 - #162874 (Add support for `annotate_snippets::snippet::AnnotationKind::Visible`)
 - #162881 (Simplify the macro for forwarding Decoder methods )
 - #162888 (Fix a typo on the Armv7-R platform docs page)
@rust-bors
rust-bors Bot merged commit b47b950 into rust-lang:main Sep 17, 2026
14 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 17, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 17, 2026
Rollup merge of #162805 - ChrisDenton:exit-code-must-use, r=jhpratt

Add `must_use` lint to `ExitCode`

An [`ExitCode`](https://doc.rust-lang.org/nightly/std/process/struct.ExitCode.html) is intended to be returned from `main` (or used in other ways of terminating a process). It's also a `Result` like type in that it has success and error values. It's *probably* a mistake if it's ignored but if not it makes sense to require users to explicitly acknowledge that ignoring it is intentional (e.g. with `let _ = ...`).
@ChrisDenton
ChrisDenton deleted the exit-code-must-use branch September 17, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants