Skip to content

Commit 22d7b2f

Browse files
committed
Auto merge of rust-lang#145513 - beepster4096:erasedereftemps, r=saethlin,cjgillot
Validate CopyForDeref and DerefTemps better and remove them from runtime MIR (split from my WIP rust-lang#145344) This PR: - Removes `Rvalue::CopyForDeref` and `LocalInfo::DerefTemp` from runtime MIR - Using a new mir pass `EraseDerefTemps` - `CopyForDeref(x)` is turned into `Use(Copy(x))` - `DerefTemp` is turned into `Boring` - Not sure if this part is actually necessary, it made more sense in rust-lang#145344 with `DerefTemp` storing actual data that I wanted to keep from having to be kept in sync with the rest of the body in runtime MIR - Checks in validation that `CopyForDeref` and `DerefTemp` are only used together - Removes special handling for `CopyForDeref` from many places - Removes `CopyForDeref` from `custom_mir` reverting rust-lang#111587 - In runtime MIR simple copies can be used instead - In post cleanup analysis MIR it was already wrong to use due to the lack of support for creating `DerefTemp` locals - Possibly this should be its own PR? - Adds an argument to `deref_finder` to avoid creating new `DerefTemp`s and `CopyForDeref` in runtime MIR. - Ideally we would just avoid making intermediate derefs instead of fixing it at the end of a pass / during shim building - Removes some usages of `deref_finder` that I found out don't actually do anything r? oli-obk
2 parents 7b9ef60 + 2c9c0de commit 22d7b2f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

core/src/intrinsics/mir.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
//!
234234
//! - Operands implicitly convert to `Use` rvalues.
235235
//! - `&`, `&mut`, `addr_of!`, and `addr_of_mut!` all work to create their associated rvalue.
236-
//! - [`CopyForDeref`], [`CastTransmute`], [`CastPtrToPtr`], [`CastUnsize`], and [`Discriminant`]
236+
//! - [`CastTransmute`], [`CastPtrToPtr`], [`CastUnsize`], and [`Discriminant`]
237237
//! have associated functions.
238238
//! - Unary and binary operations use their normal Rust syntax - `a * b`, `!c`, etc.
239239
//! - The binary operation `Offset` can be created via [`Offset`].
@@ -405,7 +405,6 @@ define!(
405405
"mir_ptr_metadata",
406406
fn PtrMetadata<P: ?Sized>(place: *const P) -> <P as ::core::ptr::Pointee>::Metadata
407407
);
408-
define!("mir_copy_for_deref", fn CopyForDeref<T>(place: T) -> T);
409408
define!("mir_retag", fn Retag<T>(place: T));
410409
define!("mir_move", fn Move<T>(place: T) -> T);
411410
define!("mir_static", fn Static<T>(s: T) -> &'static T);

0 commit comments

Comments
 (0)