Skip to content

LivenessValues: use dedicated enum rather than mutually exclusive Options#157035

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
amandasystems:region-values-either
Jun 2, 2026
Merged

LivenessValues: use dedicated enum rather than mutually exclusive Options#157035
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
amandasystems:region-values-either

Conversation

@amandasystems
Copy link
Copy Markdown
Contributor

@amandasystems amandasystems commented May 27, 2026

I was reading through LivenessValues and realised it had a lot of comments explaining that two Options were mutually exclusive, plus some redundant logic to handle this.

This is a drive-by fix to use an Either a dedicated enum instead, which makes that property obvious from the code. It also removes the repeated logic.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 27, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 27, 2026

r? @jackh726

rustbot has assigned @jackh726.
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: borrowck, compiler
  • borrowck, compiler expanded to 73 candidates
  • Random selection from 18 candidates

@amandasystems amandasystems marked this pull request as draft May 27, 2026 19:40
@rustbot rustbot 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 May 27, 2026
@amandasystems amandasystems force-pushed the region-values-either branch 2 times, most recently from 04c1272 to e8beadf Compare May 27, 2026 20:02
@amandasystems amandasystems marked this pull request as ready for review May 27, 2026 20:04
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 27, 2026
@amandasystems
Copy link
Copy Markdown
Contributor Author

Sorry, read through the diff AGAIN and of course noticed a few mistakes I hadn't seen in the terminal window.

@jackh726
Copy link
Copy Markdown
Member

Pls use an enum instead of Either, then r=me

@bors delegate+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 29, 2026

✌️ @amandasystems, you can now approve this pull request!

If @jackh726 told you to "r=me" after making some further change, then please make that change and post @bors r=jackh726.

View changes since this delegation.

@amandasystems amandasystems force-pushed the region-values-either branch from e8beadf to 6d67c7d Compare June 1, 2026 14:22
@amandasystems amandasystems changed the title LivenessValues: use Either rather than mutually exclusive Options LivenessValues: use dedicated enum rather than mutually exclusive Options Jun 1, 2026
Comment thread compiler/rustc_borrowck/src/region_infer/values.rs Outdated
@amandasystems amandasystems force-pushed the region-values-either branch from 6d67c7d to a5b1187 Compare June 1, 2026 15:28
@amandasystems
Copy link
Copy Markdown
Contributor Author

That seems spurious to me but I can’t find a bors or rustbot command to restart CI. If anyone who can do that reads this please do!

@jackh726
Copy link
Copy Markdown
Member

jackh726 commented Jun 2, 2026

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 2, 2026

📌 Commit a5b1187 has been approved by jackh726

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 5. This pull request will be tested once the tree is reopened.

@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 Jun 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 2, 2026
…, r=jackh726

`LivenessValues`: use dedicated enum rather than mutually exclusive `Option`s

I was reading through `LivenessValues` and realised it had a lot of comments explaining that two `Option`s were mutually exclusive, plus some redundant logic to handle this.

This is a drive-by fix to use ~~an `Either`~~ a dedicated enum instead, which makes that property obvious from the code. It also removes the repeated logic.
rust-bors Bot pushed a commit that referenced this pull request Jun 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #157035 (`LivenessValues`: use dedicated enum rather than mutually exclusive `Option`s)
 - #157182 (Restore simpler Encode/Decode impls for u32 and (on 64bit systems) usize)
 - #157310 (rustdoc: Render `impl` restriction)
 - #157070 (Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` proc-macros)
 - #157137 (rustc_target: Use +spe for powerpcspe targets)
 - #157215 (Implement argument-dependent target checking for the `#[repr]` parser)
 - #157235 (additional changes for issue-144595)
 - #157321 (Remove unnecessary arm in `handle_res`)
 - #157324 (Add test for undefined EII static error)
rust-bors Bot pushed a commit that referenced this pull request Jun 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #157035 (`LivenessValues`: use dedicated enum rather than mutually exclusive `Option`s)
 - #157182 (Restore simpler Encode/Decode impls for u32 and (on 64bit systems) usize)
 - #157310 (rustdoc: Render `impl` restriction)
 - #157070 (Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` proc-macros)
 - #157137 (rustc_target: Use +spe for powerpcspe targets)
 - #157215 (Implement argument-dependent target checking for the `#[repr]` parser)
 - #157235 (additional changes for issue-144595)
 - #157321 (Remove unnecessary arm in `handle_res`)
 - #157324 (Add test for undefined EII static error)
rust-bors Bot pushed a commit that referenced this pull request Jun 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #157035 (`LivenessValues`: use dedicated enum rather than mutually exclusive `Option`s)
 - #157182 (Restore simpler Encode/Decode impls for u32 and (on 64bit systems) usize)
 - #157310 (rustdoc: Render `impl` restriction)
 - #157070 (Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` proc-macros)
 - #157137 (rustc_target: Use +spe for powerpcspe targets)
 - #157215 (Implement argument-dependent target checking for the `#[repr]` parser)
 - #157235 (additional changes for issue-144595)
 - #157321 (Remove unnecessary arm in `handle_res`)
 - #157324 (Add test for undefined EII static error)
@rust-bors rust-bors Bot merged commit 466699e into rust-lang:main Jun 2, 2026
7 of 12 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 2, 2026
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-compiler Relevant 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.

4 participants