Skip to content

Conversation

scottmcm
Copy link
Member

Since structs are always VariantIdx(0), there's a bunch of files where the only reason they had VariantIdx or vec::Idx imported at all was to get the first variant.

So this uses a constant for that, and adds some doc-comments to VariantIdx while I'm there, since it doesn't have any today.

@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2023

r? @oli-obk

(rustbot has picked a reviewer for you, use r? to override)

@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 Mar 26, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occured in rustc_ty_utils::consts.rs

cc @BoxyUwU

Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant.

So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
@scottmcm scottmcm force-pushed the update-variantidx branch from 88674f6 to 0439d13 Compare March 26, 2023 01:58
@compiler-errors
Copy link
Member

cool beans

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 26, 2023

📌 Commit 0439d13 has been approved by compiler-errors

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Mar 26, 2023

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

@bors bors 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 Mar 26, 2023
@scottmcm scottmcm assigned compiler-errors and unassigned oli-obk Mar 26, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 26, 2023
…iler-errors

Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`

Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant.

So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since [it doesn't have any today](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/struct.VariantIdx.html).
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 26, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#109007 (rustdoc: skip `// some variants omitted` if enum is `#[non_exhaustive]`)
 - rust-lang#109593 (Rustdoc Book refer to rustdoc::missing_doc_code_examples. Fixes rust-lang#109592.)
 - rust-lang#109595 (Improve "Auto-hide trait implementation documentation" GUI test)
 - rust-lang#109619 (Still-further-specializable projections are ambiguous in new solver)
 - rust-lang#109620 (Correct typo (`back_box` -> `black_box`))
 - rust-lang#109621 (Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4aa4ce6 into rust-lang:master Mar 26, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 26, 2023
@scottmcm scottmcm deleted the update-variantidx branch March 26, 2023 18:33
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.

5 participants