Rename IndexVec::last → last_index#109718
Merged
bors merged 1 commit intorust-lang:masterfrom Mar 29, 2023
Merged
Conversation
Collaborator
|
(rustbot has picked a reviewer for you, use r? to override) |
Collaborator
|
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
As I've been trying to replace a `Vec` with an `IndexVec`, having `last` exist on both but returning very different types makes the transition a bit awkward -- the errors are later, where you get things like "there's no `ty` method on `mir::Field`" rather than a more localized error like "hey, there's no `last` on `IndexVec`". So I propose renaming `last` to `last_index` to help distinguish `Vec::last`, which returns an element, and `IndexVec::last_index`, which returns an index. (Similarly, `Iterator::last` also returns an element, not an index.)
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Noratrieb
approved these changes
Mar 29, 2023
Member
Noratrieb
left a comment
There was a problem hiding this comment.
r? Nilstrieb
r=me, the renaming makes a lot of sense
Member
Author
|
CI came in clean, so |
Collaborator
Member
|
@bors r+ rollup |
Collaborator
|
💡 This pull request was already approved, no need to approve it again.
|
Collaborator
Member
|
oh, GitHub didn't refresh for me :D |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 29, 2023
Rollup of 7 pull requests Successful merges: - rust-lang#108335 (rustdoc + rustdoc-json support for `feature(non_lifetime_binders)`) - rust-lang#109534 (rustdoc: Unsupport importing `doc(primitive)` and `doc(keyword)` modules) - rust-lang#109659 (llvm-wrapper: adapt for LLVM API change) - rust-lang#109664 (Use span of placeholders in format_args!() expansion.) - rust-lang#109683 (Check for overflow in `assemble_candidates_after_normalizing_self_ty`) - rust-lang#109713 (Fix mismatched punctuation in Debug impl of AttrId) - rust-lang#109718 (Rename `IndexVec::last` → `last_index`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
4 tasks
celinval
added a commit
to model-checking/kani
that referenced
this pull request
May 16, 2023
Update the toolchain to use nightly-2023-04-16. Changes were related to the following changes to the toolchain: - rust-lang/rust#108944 - rust-lang/rust#108148 - rust-lang/rust#108471 - rust-lang/rust#109358 - rust-lang/rust#109849 - rust-lang/rust#109819 - rust-lang/rust#109718 - rust-lang/rust#109092 - rust-lang/rust#108856 - rust-lang/rust#105613 - rust-lang/rust#103042 - rust-lang/rust#109716 - rust-lang/rust#108340 - rust-lang/rust#102906 - rust-lang/rust#98112 - rust-lang/rust#108080
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As I've been trying to replace a
Vecwith anIndexVec, havinglastexist on both but returning very different types makes the transition a bit awkward -- the errors are later, where you get things like "there's notymethod onmir::Field" rather than a more localized error like "hey, there's nolastonIndexVec".So I propose renaming
lasttolast_indexto help distinguishVec::last, which returns an element, andIndexVec::last_index, which returns an index.(Similarly,
Iterator::lastalso returns an element, not an index.)