-
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
Remove/justify all &T
to &mut T
transmutes
#13933
Comments
bors
added a commit
that referenced
this issue
May 5, 2014
Turning a `&T` into an `&mut T` is undefined behaviour, and needs to be done very very carefully. Providing a convenience function for exactly this task is a bad idea, just tempting people into doing the wrong thing. (The right thing is to use types like `Cell`, `RefCell` or `Unsafe`.) cc #13933
Merged
arielb1
pushed a commit
to arielb1/rust
that referenced
this issue
May 28, 2014
The IO libraries casted self to mut so they can pass it to seek(SEEK_CUR, 0). Fix this by introducing a private seek function that takes &self - of course one should be careful with it if he lacks an exclusive reference to self.
arielb1
pushed a commit
to arielb1/rust
that referenced
this issue
May 28, 2014
directly use the internal pointer instead.
bors
added a commit
that referenced
this issue
May 29, 2014
Fix issue #13933 in a few files. A more complete fix would require core::raw::MutSlice.
bors
added a commit
that referenced
this issue
Jun 11, 2014
**Update** I've reimplemented this using `Cell` and `RefCell`, as suggested by @alexcrichton. By taking care with the duration of the borrows, I was able to maintain the recursive allocation feature (now covered by a test) without the use of `Unsafe`, and without breaking the non-aliasing `&mut` invariant. **Original** Changes both `Arena` and `TypedArena` to contain an inner struct wrapped in a `Unsafe`, and change field access to go through those instead of transmuting `&self` to `&mut self`. Part of #13933
I believe these are all now basically gone:
|
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 13, 2023
Refine search for const and function assoc items This changes our searching behavior, before we always associated all usages and definitions of associated items with all implementations of a trait and the trait itself. Now, when searching for references of a an associated trait item, we still do the same and consider all implementations, but when searching for an associated item of an implementation we now only consider the uses of that specific implementations associated item. This does not affect associated type aliases as we unfortunately are missing information in the IDE layer here still.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is undefined behaviour, and so would preferably be avoided by using
Unsafe
etc.#13934 removed the
transmute_mut
function, replacing it with (closer to) correct code where possible &transmute::<&_, &mut
where not possible (that code snippet is the longest sequence that means grep will find all of the calls I inserted). There's fixmes pointing to this issue too.The text was updated successfully, but these errors were encountered: