-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename IndexVec::last
→ last_index
#109718
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
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.)
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r? Nilstrieb
r=me, the renaming makes a lot of sense
CI came in clean, so |
@bors r+ rollup |
💡 This pull request was already approved, no need to approve it again.
|
oh, GitHub didn't refresh for me :D |
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
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
As I've been trying to replace a
Vec
with anIndexVec
, havinglast
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 noty
method onmir::Field
" rather than a more localized error like "hey, there's nolast
onIndexVec
".So I propose renaming
last
tolast_index
to help distinguishVec::last
, which returns an element, andIndexVec::last_index
, which returns an index.(Similarly,
Iterator::last
also returns an element, not an index.)