-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Reborrowing mutable pointers is overly permissive #8624
Comments
ghost
assigned nikomatsakis
Aug 19, 2013
nominating production ready |
This is actually deserving of backwards compatible, because the fix will likely cause some APIs to be changed. |
I think the mutable |
Accepted backwards-compatible |
bors
added a commit
that referenced
this issue
Dec 1, 2013
mut_chunks() returns an iterator that produces mutable slices. This is the mutable version of the existing chunks() method on the ImmutableVector trait. EDIT: This uses only safe code now. PREVIOUSLY: I tried to get this working with safe code only, but I couldn't figure out how to make that work. Before #8624, the exact same code worked without the need for the transmute() call. With that fix and without the transmute() call, the compiler complains about the call to mut_slice(). I think the issue is that the mutable slice that is returned will live longer than the self parameter since the self parameter doesn't have an explicit lifetime. However, that is the way that the Iterator trait defines the next() method. I'm sure there is a good reason for that, although I don't quite understand why. Anyway, I think the interface is safe, since the MutChunkIter will only hand out non-overlapping pointers and there is no way to get it to hand out the same pointer twice.
Merged
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Apr 21, 2022
New lint `is_digit_ascii_radix` Closes rust-lang#6399 changelog: Added [`is_digit_ascii_radix`]: recommend `is_ascii_digit()` or `is_ascii_hexdigit()` in place of `is_digit(10)` and `is_digit(16)`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example program should not type check:
The problem is that the rules which limit reborrowing of mut data to unique paths do not consider the lifetime of those unique paths.
The legal signatures for
copy_borrowed_ptr
would be either:fn copy_borrowed_ptr<'a>(&'a mut S<'a>) -> S<'a>
; orfn copy_borrowed_ptr<'a, 'b>(&'a mut S<'b>) -> S<'a>
The text was updated successfully, but these errors were encountered: