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

add (unchecked) indexing methods to raw (and NonNull) slices #73986

Merged
merged 5 commits into from
Jul 14, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jul 3, 2020

This complements the existing (unstable) len method. Unfortunately, for non-null slices, we cannot call this method as_ptr as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the #71146 tracking issue and rename the feature get to slice_ptr_methods or so.

Cc @SimonSapin
Fixes #60639

@rust-highfive
Copy link
Collaborator

r? @sfackler

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 3, 2020
@RalfJung RalfJung changed the title add as_ptr method to raw slices add (unchecked) indexing methods to raw (and NonNull) slices Jul 5, 2020
@RalfJung
Copy link
Member Author

RalfJung commented Jul 5, 2020

I have now extended this PR to resolve #60639 by adding indexing methods to raw slices.

@sfackler
Copy link
Member

sfackler commented Jul 5, 2020

r=me with a tracking issue.

@RalfJung
Copy link
Member Author

RalfJung commented Jul 6, 2020

@sfackler should I make a new one or extend #71146 ?

@RalfJung
Copy link
Member Author

RalfJung commented Jul 12, 2020

Created tracking issue #74265.

@bors r=sfackler

@bors
Copy link
Contributor

bors commented Jul 12, 2020

📌 Commit ff5e107 has been approved by sfackler

@bors
Copy link
Contributor

bors commented Jul 12, 2020

🌲 The tree is currently closed for pull requests below priority 30, 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 Jul 12, 2020
@RalfJung
Copy link
Member Author

@bors rollup=always
I'd say this is pretty low-risk, given it passes PR CI.

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 13, 2020
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
add (unchecked) indexing methods to raw (and NonNull) slices

This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name.

If this looks reasonable to accept, I propose to reuse the rust-lang#71146 tracking issue and rename the feature get to `slice_ptr_methods` or so.

Cc @SimonSapin
Fixes rust-lang#60639
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 14, 2020
…arth

Rollup of 15 pull requests

Successful merges:

 - rust-lang#71237 (Add Ayu theme to rustdoc)
 - rust-lang#73720 (Clean up E0704 error explanation)
 - rust-lang#73866 (Obviate #[allow(improper_ctypes_definitions)])
 - rust-lang#73965 (typeck: check for infer before type impls trait)
 - rust-lang#73986 (add (unchecked) indexing methods to raw (and NonNull) slices)
 - rust-lang#74173 (Detect tuple struct incorrectly used as struct pat)
 - rust-lang#74220 (Refactor Windows `parse_prefix`)
 - rust-lang#74227 (Remove an unwrap in layout computation)
 - rust-lang#74239 (Update llvm-project to latest origin/rustc/10.0-2020-05-05 commit )
 - rust-lang#74257 (don't mark linux kernel module targets as a unix environment)
 - rust-lang#74270 (typeck: report placeholder type error w/out span)
 - rust-lang#74296 (Clarify the description for rfind)
 - rust-lang#74310 (Use `ArrayVec` in `SparseBitSet`.)
 - rust-lang#74316 (Remove unnecessary type hints from Wake internals)
 - rust-lang#74324 (Update Clippy)

Failed merges:

r? @ghost
@bors bors merged commit 79894df into rust-lang:master Jul 14, 2020
@RalfJung RalfJung deleted the raw-slice-as-ptr branch July 20, 2020 12:37
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add get and get_unchecked to *const [T] and *mut [T]
5 participants