Skip to content

Commit b047c09

Browse files
committed
remove copyforderef from custom_mir
it did not create DerefTemp locals when used, so it was never actually correct.
1 parent 1798f22 commit b047c09

File tree

5 files changed

+1
-32
lines changed

5 files changed

+1
-32
lines changed

compiler/rustc_mir_build/src/builder/custom/parse/instruction.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
249249
},
250250
@call(mir_len, args) => Ok(Rvalue::Len(self.parse_place(args[0])?)),
251251
@call(mir_ptr_metadata, args) => Ok(Rvalue::UnaryOp(UnOp::PtrMetadata, self.parse_operand(args[0])?)),
252-
@call(mir_copy_for_deref, args) => Ok(Rvalue::CopyForDeref(self.parse_place(args[0])?)),
253252
ExprKind::Borrow { borrow_kind, arg } => Ok(
254253
Rvalue::Ref(self.tcx.lifetimes.re_erased, *borrow_kind, self.parse_place(*arg)?)
255254
),

compiler/rustc_span/src/symbol.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,6 @@ symbols! {
13891389
mir_cast_ptr_to_ptr,
13901390
mir_cast_transmute,
13911391
mir_checked,
1392-
mir_copy_for_deref,
13931392
mir_debuginfo,
13941393
mir_deinit,
13951394
mir_discriminant,

library/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-
//! - [`Discriminant`], [`Len`], and [`CopyForDeref`] have associated functions.
236+
//! - [`Discriminant`] and [`Len`] have associated functions.
237237
//! - Unary and binary operations use their normal Rust syntax - `a * b`, `!c`, etc.
238238
//! - The binary operation `Offset` can be created via [`Offset`].
239239
//! - Checked binary operations are represented by wrapping the associated binop in [`Checked`].
@@ -406,7 +406,6 @@ define!(
406406
"mir_ptr_metadata",
407407
fn PtrMetadata<P: ?Sized>(place: *const P) -> <P as ::core::ptr::Pointee>::Metadata
408408
);
409-
define!("mir_copy_for_deref", fn CopyForDeref<T>(place: T) -> T);
410409
define!("mir_retag", fn Retag<T>(place: T));
411410
define!("mir_move", fn Move<T>(place: T) -> T);
412411
define!("mir_static", fn Static<T>(s: T) -> &'static T);

tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/mir-opt/building/custom/projections.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,6 @@ fn simple_index(a: [i32; 10], b: &[i32]) -> i32 {
7979
}
8080
}
8181

82-
// EMIT_MIR projections.copy_for_deref.built.after.mir
83-
#[custom_mir(dialect = "runtime", phase = "initial")]
84-
fn copy_for_deref(x: (&i32, i32)) -> i32 {
85-
mir! {
86-
let temp: &i32;
87-
{
88-
temp = CopyForDeref(x.0);
89-
RET = *temp;
90-
Return()
91-
}
92-
}
93-
}
94-
9582
fn main() {
9683
assert_eq!(unions(U { a: 5 }), 5);
9784
assert_eq!(tuples((5, 6)), (5, 6));
@@ -103,7 +90,4 @@ fn main() {
10390
assert_eq!(o, Some(10));
10491

10592
assert_eq!(simple_index([0; 10], &[0; 10]), 0);
106-
107-
let one = 1;
108-
assert_eq!(copy_for_deref((&one, one)), 1);
10993
}

0 commit comments

Comments
 (0)