Skip to content

Commit a513981

Browse files
committed
ProjectionElem::Subtype -> CastKind::Subtype
1 parent c381d09 commit a513981

File tree

4 files changed

+3
-15
lines changed

4 files changed

+3
-15
lines changed

rustc_public/src/mir/body.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -836,14 +836,6 @@ pub enum ProjectionElem {
836836
/// Like an explicit cast from an opaque type to a concrete type, but without
837837
/// requiring an intermediate variable.
838838
OpaqueCast(Ty),
839-
840-
/// A `Subtype(T)` projection is applied to any `StatementKind::Assign` where
841-
/// type of lvalue doesn't match the type of rvalue, the primary goal is making subtyping
842-
/// explicit during optimizations and codegen.
843-
///
844-
/// This projection doesn't impact the runtime behavior of the program except for potentially changing
845-
/// some type metadata of the interpreter or codegen backend.
846-
Subtype(Ty),
847839
}
848840

849841
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
@@ -1028,6 +1020,7 @@ pub enum CastKind {
10281020
PtrToPtr,
10291021
FnPtrToPtr,
10301022
Transmute,
1023+
Subtype,
10311024
}
10321025

10331026
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
@@ -1089,7 +1082,7 @@ impl ProjectionElem {
10891082
Self::subslice_ty(ty, *from, *to, *from_end)
10901083
}
10911084
ProjectionElem::Downcast(_) => Ok(ty),
1092-
ProjectionElem::OpaqueCast(ty) | ProjectionElem::Subtype(ty) => Ok(*ty),
1085+
ProjectionElem::OpaqueCast(ty) => Ok(*ty),
10931086
}
10941087
}
10951088

rustc_public/src/mir/visit.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ macro_rules! visit_place_fns {
471471
ProjectionElem::Subslice { from: _, to: _, from_end: _ } => {}
472472
ProjectionElem::Downcast(_idx) => {}
473473
ProjectionElem::OpaqueCast(ty) => self.visit_ty(ty, location),
474-
ProjectionElem::Subtype(ty) => self.visit_ty(ty, location),
475474
}
476475
}
477476
};
@@ -512,7 +511,6 @@ macro_rules! visit_place_fns {
512511
ProjectionElem::Subslice { from: _, to: _, from_end: _ } => {}
513512
ProjectionElem::Downcast(_idx) => {}
514513
ProjectionElem::OpaqueCast(ty) => self.visit_ty(ty, location),
515-
ProjectionElem::Subtype(ty) => self.visit_ty(ty, location),
516514
}
517515
}
518516
};

rustc_public/src/unstable/convert/internal.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,6 @@ impl RustcInternal for ProjectionElem {
703703
ProjectionElem::OpaqueCast(ty) => {
704704
rustc_middle::mir::PlaceElem::OpaqueCast(ty.internal(tables, tcx))
705705
}
706-
ProjectionElem::Subtype(ty) => {
707-
rustc_middle::mir::PlaceElem::Subtype(ty.internal(tables, tcx))
708-
}
709706
}
710707
}
711708
}

rustc_public/src/unstable/convert/stable/mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl<'tcx> Stable<'tcx> for mir::CastKind {
356356
PtrToPtr => crate::mir::CastKind::PtrToPtr,
357357
FnPtrToPtr => crate::mir::CastKind::FnPtrToPtr,
358358
Transmute => crate::mir::CastKind::Transmute,
359+
Subtype => crate::mir::CastKind::Subtype,
359360
}
360361
}
361362
}
@@ -453,7 +454,6 @@ impl<'tcx> Stable<'tcx> for mir::PlaceElem<'tcx> {
453454
// found at https://github.com/rust-lang/rust/pull/117517#issuecomment-1811683486
454455
Downcast(_, idx) => crate::mir::ProjectionElem::Downcast(idx.stable(tables, cx)),
455456
OpaqueCast(ty) => crate::mir::ProjectionElem::OpaqueCast(ty.stable(tables, cx)),
456-
Subtype(ty) => crate::mir::ProjectionElem::Subtype(ty.stable(tables, cx)),
457457
UnwrapUnsafeBinder(..) => todo!("FIXME(unsafe_binders):"),
458458
}
459459
}

0 commit comments

Comments
 (0)