Skip to content
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

impl SliceIndex<str> for (Bound<usize>, Bound<usize>) #111081

Merged
merged 2 commits into from Aug 1, 2023

Conversation

mattfbacon
Copy link
Contributor

@mattfbacon mattfbacon commented May 1, 2023

This impl is conspicuously missing.

@rustbot
Copy link
Collaborator

rustbot commented May 1, 2023

r? @Mark-Simulacrum

(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-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 1, 2023
@rust-log-analyzer

This comment has been minimized.

@Nilstrieb Nilstrieb added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 1, 2023
@mattfbacon mattfbacon force-pushed the master branch 2 times, most recently from ec42434 to 1015484 Compare May 1, 2023 21:54
@mattfbacon
Copy link
Contributor Author

mattfbacon commented May 2, 2023

I noticed that there are similar functions for converting Bound pairs to Ranges in core::slice::index. What would be a good approach to share them with the string module? Maybe move all of the SliceIndex impls to their own module?

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2023
@Mark-Simulacrum
Copy link
Member

Marking as waiting on team as this will need T-libs-api FCP.

@dtolnay dtolnay added the needs-fcp This change is insta-stable, so needs a completed FCP to proceed. label May 30, 2023
@Amanieu
Copy link
Member

Amanieu commented May 30, 2023

I noticed that there are similar functions for converting Bound pairs to Ranges in core::slice::index. What would be a good approach to share them with the string module? Maybe move all of the SliceIndex impls to their own module?

Yes, please re-use the to_range function from core::slice::index. You can make it pub(crate) for this purpose.

@Amanieu
Copy link
Member

Amanieu commented May 30, 2023

Since we already have these on slices, it makes sense to have them on str as well.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented May 30, 2023

Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels May 30, 2023
@mattfbacon
Copy link
Contributor Author

I noticed that there are similar functions for converting Bound pairs to Ranges in core::slice::index. What would be a good approach to share them with the string module? Maybe move all of the SliceIndex impls to their own module?

Yes, please re-use the to_range function from core::slice::index. You can make it pub(crate) for this purpose.

Done. I also had to make core::slice::index pub(crate).

@mattfbacon mattfbacon marked this pull request as ready for review May 31, 2023 00:56
@rust-log-analyzer

This comment has been minimized.

@mattfbacon
Copy link
Contributor Author

Hmm, maybe #71146 should also be extended to str.

@Amanieu
Copy link
Member

Amanieu commented Jun 1, 2023

Yes, I agree that extending #71146 for *const str makes sense. This should be done in a separate PR.

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Jun 4, 2023
@rfcbot
Copy link

rfcbot commented Jun 4, 2023

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jun 4, 2023
@Amanieu Amanieu removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Jun 6, 2023
@rfcbot rfcbot added the finished-final-comment-period The final comment period is finished for this PR / Issue. label Jun 14, 2023
@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jun 14, 2023
@rfcbot
Copy link

rfcbot commented Jun 14, 2023

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@Amanieu
Copy link
Member

Amanieu commented Jun 14, 2023

@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 14, 2023
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Jun 15, 2023
@mattfbacon
Copy link
Contributor Author

Do you mean that I should create a PR for that method, then wait for it to merge, then return to this one?

@workingjubilee
Copy link
Contributor

Do you mean that I should create a PR for that method, then wait for it to merge, then return to this one?

Or we can merge this one with whatever internal implementation works now, and you can do another PR fixing it up with the nightly API you want that extends slice_ptr_len. Either way! The order isn't important, but this one won't land until you rebase it.

@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Contributor

Excellent, thank you!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 31, 2023

📌 Commit f189d00 has been approved by workingjubilee

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 31, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#111081 (impl SliceIndex<str> for (Bound<usize>, Bound<usize>))
 - rust-lang#113394 (style-guide: Document style editions, start 2024 style edition)
 - rust-lang#113588 (bootstrap: use git merge-base for LLVM CI download logic)
 - rust-lang#113743 (Directly link more target docs)
 - rust-lang#114262 (Improve the rust style guide doc)
 - rust-lang#114309 (Update books)
 - rust-lang#114313 ([rustc_data_structures] Simplify SortedMap::insert.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 14a5dc5 into rust-lang:master Aug 1, 2023
11 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Aug 1, 2023
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Oct 6, 2023
Language
--------

- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.]
  (rust-lang/rust#111717)
- [Make `noop_method_call` warn by default.]
  (rust-lang/rust#111916)
- [Support interpolated block for `try` and `async` in macros.]
  (rust-lang/rust#112953)
- [Make `unconditional_recursion` lint detect recursive drops.]
  (rust-lang/rust#113902)
- [Future compatibility warning for some impls being incorrectly
  considered not overlapping.]
  (rust-lang/rust#114023)
- [The `invalid_reference_casting` lint is now **deny-by-default**
  (instead of allow-by-default)]
  (rust-lang/rust#112431)

Compiler
--------

- [Write version information in a `.comment` section like GCC/Clang.]
  (rust-lang/rust#97550)
- [Add documentation on v0 symbol mangling.]
  (rust-lang/rust#97571)
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.]
  (rust-lang/rust#114562)
- [Only check outlives goals on impl compared to trait.]
  (rust-lang/rust#109356)
- [Infer type in irrefutable slice patterns with fixed length as array.]
  (rust-lang/rust#113199)
- [Discard default auto trait impls if explicit ones exist.]
  (rust-lang/rust#113312)
- Add several new tier 3 targets:
    - [`aarch64-unknown-teeos`]
      (rust-lang/rust#113480)
    - [`csky-unknown-linux-gnuabiv2`]
      (rust-lang/rust#113658)
    - [`riscv64-linux-android`]
      (rust-lang/rust#112858)
    - [`riscv64gc-unknown-hermit`]
      (rust-lang/rust#114004)
    - [`x86_64-unikraft-linux-musl`]
      (rust-lang/rust#113411)
    - [`x86_64-unknown-linux-ohos`]
      (rust-lang/rust#113061)
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.]
  (rust-lang/rust#112922)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.]
  (rust-lang/rust#94748)
- [Merge functionality of `io::Sink` into `io::Empty`.]
  (rust-lang/rust#98154)
- [Implement `RefUnwindSafe` for `Backtrace`]
  (rust-lang/rust#100455)
- [Make `ExitStatus` implement `Default`]
  (rust-lang/rust#106425)
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`]
  (rust-lang/rust#111081)
- [Change default panic handler message format.]
  (rust-lang/rust#112849)
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.]
  (rust-lang/rust#111071)
- [Correct the (deprecated) Android `stat` struct definitions.]
  (rust-lang/rust#113130)

Stabilized APIs
---------------

- [Unsigned `{integer}::div_ceil`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.div_ceil)
- [Unsigned `{integer}::next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
- [Unsigned `{integer}::checked_next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
- [`std::ffi::FromBytesUntilNulError`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
- [`std::os::unix::fs::chown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
- [`std::os::unix::fs::fchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
- [`std::os::unix::fs::lfchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
- [`LocalKey::<Cell<T>>::get`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
- [`LocalKey::<Cell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
- [`LocalKey::<Cell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
- [`LocalKey::<Cell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
- [`LocalKey::<RefCell<T>>::with_borrow`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
- [`LocalKey::<RefCell<T>>::with_borrow_mut`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
- [`LocalKey::<RefCell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
- [`LocalKey::<RefCell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
- [`LocalKey::<RefCell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)

These APIs are now stable in const contexts:

- [`rc::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
- [`sync::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
- [`NonNull::as_ref`]
  (https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)

Cargo
-----

- [Encode URL params correctly for `SourceId` in `Cargo.lock`.]
  (rust-lang/cargo#12280)
- [Bail out an error when using `cargo::` in custom build script.]
  (rust-lang/cargo#12332)

Compatibility Notes
-------------------

- [Update the minimum external LLVM to 15.]
  (rust-lang/rust#114148)
- [Check for non-defining uses of return position `impl Trait`.]
  (rust-lang/rust#112842)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Remove LLVM pointee types, supporting only opaque pointers.]
  (rust-lang/rust#105545)
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.]
  (rust-lang/rust#112235)
- [Replace in-tree `rustc_apfloat` with the new version of the crate.]
  (rust-lang/rust#113843)
- [Update to LLVM 17.]
  (rust-lang/rust#114048)
- [Add `internal_features` lint for internal unstable features.]
  (rust-lang/rust#108955)
- [Mention style for new syntax in tracking issue template.]
  (rust-lang/rust#113586)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 16, 2023
Pkgsrc changes:
 * Adjust patches and cargo checksums to new versions.
 * For an external LLVM, set dependency of llvm >= 15, in accordance
   with the upstream changes.
 * Add a patch with a backport from LLVM 17.0.3 fixing codegen for
   PPC, ref. rust-lang/rust#116845

Upstream changes:

Version 1.73.0 (2023-10-05)
==========================

Language
--------

- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.]
  (rust-lang/rust#111717)
- [Make `noop_method_call` warn by default.]
  (rust-lang/rust#111916)
- [Support interpolated block for `try` and `async` in macros.]
  (rust-lang/rust#112953)
- [Make `unconditional_recursion` lint detect recursive drops.]
  (rust-lang/rust#113902)
- [Future compatibility warning for some impls being incorrectly
  considered not overlapping.]
  (rust-lang/rust#114023)
- [The `invalid_reference_casting` lint is now **deny-by-default**
  (instead of allow-by-default)]
  (rust-lang/rust#112431

Compiler
--------

- [Write version information in a `.comment` section like GCC/Clang.]
  (rust-lang/rust#97550)
- [Add documentation on v0 symbol mangling.]
  (rust-lang/rust#97571)
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.]
  (rust-lang/rust#114562)
- [Only check outlives goals on impl compared to trait.]
  (rust-lang/rust#109356)
- [Infer type in irrefutable slice patterns with fixed length as array.]
  (rust-lang/rust#113199)
- [Discard default auto trait impls if explicit ones exist.]
  (rust-lang/rust#113312)
- Add several new tier 3 targets:
    - [`aarch64-unknown-teeos`]
      (rust-lang/rust#113480)
    - [`csky-unknown-linux-gnuabiv2`]
      (rust-lang/rust#113658)
    - [`riscv64-linux-android`]
      (rust-lang/rust#112858)
    - [`riscv64gc-unknown-hermit`]
      (rust-lang/rust#114004)
    - [`x86_64-unikraft-linux-musl`]
      (rust-lang/rust#113411)
    - [`x86_64-unknown-linux-ohos`]
      (rust-lang/rust#113061)
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.]
  (rust-lang/rust#112922)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.]
  (rust-lang/rust#94748)
- [Merge functionality of `io::Sink` into `io::Empty`.]
  (rust-lang/rust#98154)
- [Implement `RefUnwindSafe` for `Backtrace`]
  (rust-lang/rust#100455)
- [Make `ExitStatus` implement `Default`]
  (rust-lang/rust#106425)
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`]
  (rust-lang/rust#111081)
- [Change default panic handler message format.]
  (rust-lang/rust#112849)
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.]
  (rust-lang/rust#111071)
- [Correct the (deprecated) Android `stat` struct definitions.]
  (rust-lang/rust#113130)

Stabilized APIs
---------------

- [Unsigned `{integer}::div_ceil`]
  (https://doc.rust-lang.org/stable/std/primitiv e.u32.html#method.div_ceil)
- [Unsigned `{integer}::next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
- [Unsigned `{integer}::checked_next_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
- [`std::ffi::FromBytesUntilNulError`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
- [`std::os::unix::fs::chown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
- [`std::os::unix::fs::fchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
- [`std::os::unix::fs::lfchown`]
  (https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
- [`LocalKey::<Cell<T>>::get`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
- [`LocalKey::<Cell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
- [`LocalKey::<Cell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
- [`LocalKey::<Cell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
- [`LocalKey::<RefCell<T>>::with_borrow`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
- [`LocalKey::<RefCell<T>>::with_borrow_mut`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
- [`LocalKey::<RefCell<T>>::set`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
- [`LocalKey::<RefCell<T>>::take`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
- [`LocalKey::<RefCell<T>>::replace`]
  (https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)

These APIs are now stable in const contexts:

- [`rc::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
- [`sync::Weak::new`]
  (https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
- [`NonNull::as_ref`]
  (https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)

Cargo
-----

- [Encode URL params correctly for `SourceId` in `Cargo.lock`.]
  (rust-lang/cargo#12280)
- [Bail out an error when using `cargo::` in custom build script.]
  (rust-lang/cargo#12332)

Misc
----

Compatibility Notes
-------------------

- [Update the minimum external LLVM to 15.]
  (rust-lang/rust#114148)
- [Check for non-defining uses of return position `impl Trait`.]
  (rust-lang/rust#112842)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they
represent significant improvements to the performance or internals
of rustc and related tools.

- [Remove LLVM pointee types, supporting only opaque pointers.]
  (rust-lang/rust#105545)
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.]
  (rust-lang/rust#112235)
- [Replace in-tree `rustc_apfloat` with the new version of the crate.]
  (rust-lang/rust#113843)
- [Update to LLVM 17.]
  (rust-lang/rust#114048)
- [Add `internal_features` lint for internal unstable features.]
  (rust-lang/rust#108955)
- [Mention style for new syntax in tracking issue template.]
  (rust-lang/rust#113586)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet