Remove ShallowInitBox.

This commit is contained in:
Camille Gillot 2025-10-15 23:08:15 +00:00
parent 1210e9fa3e
commit 6d4b1b38e7
27 changed files with 8 additions and 173 deletions

View file

@ -567,13 +567,6 @@ pub enum Rvalue {
/// [#74836]: https://github.com/rust-lang/rust/issues/74836
Repeat(Operand, TyConst),
/// Transmutes a `*mut u8` into shallow-initialized `Box<T>`.
///
/// This is different from a normal transmute because dataflow analysis will treat the box as
/// initialized but its content as uninitialized. Like other pointer casts, this in general
/// affects alias analysis.
ShallowInitBox(Operand, Ty),
/// Creates a pointer/reference to the given thread local.
///
/// The yielded type is a `*mut T` if the static is mutable, otherwise if the static is extern a
@ -651,7 +644,6 @@ impl Rvalue {
}
AggregateKind::RawPtr(ty, mutability) => Ok(Ty::new_ptr(ty, mutability)),
},
Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)),
Rvalue::CopyForDeref(place) => place.ty(locals),
}
}

View file

@ -383,7 +383,6 @@ fn pretty_rvalue<W: Write>(writer: &mut W, rval: &Rvalue) -> io::Result<()> {
Rvalue::Repeat(op, cnst) => {
write!(writer, "[{}; {}]", pretty_operand(op), pretty_ty_const(cnst))
}
Rvalue::ShallowInitBox(_, _) => Ok(()),
Rvalue::ThreadLocalRef(item) => {
write!(writer, "thread_local_ref{item:?}")
}

View file

@ -277,10 +277,6 @@ macro_rules! make_mir_visitor {
self.visit_operand(op, location);
self.visit_ty_const(constant, location);
}
Rvalue::ShallowInitBox(op, ty) => {
self.visit_ty(ty, location);
self.visit_operand(op, location)
}
Rvalue::ThreadLocalRef(_) => {}
Rvalue::UnaryOp(_, op) | Rvalue::Use(op) => {
self.visit_operand(op, location);

View file

@ -240,9 +240,6 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
let operands = operands.iter().map(|op| op.stable(tables, cx)).collect();
crate::mir::Rvalue::Aggregate(agg_kind.stable(tables, cx), operands)
}
ShallowInitBox(op, ty) => {
crate::mir::Rvalue::ShallowInitBox(op.stable(tables, cx), ty.stable(tables, cx))
}
CopyForDeref(place) => crate::mir::Rvalue::CopyForDeref(place.stable(tables, cx)),
WrapUnsafeBinder(..) => todo!("FIXME(unsafe_binders):"),
}