summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2024-09-15 16:47:42 +0200
committerLukas Markeffsky <@>2024-09-24 22:17:55 +0200
commit46ecb23198fa83136a266cb5a18675d2d342ab18 (patch)
tree7708e1bcb9a223316a7fe8535ed0702c95214778 /compiler/rustc_mir_transform/src
parent67bb749c2e1cf503fee64842963dd3e72a417a3f (diff)
downloadrust-46ecb23198fa83136a266cb5a18675d2d342ab18.tar.gz
rust-46ecb23198fa83136a266cb5a18675d2d342ab18.zip
unify dyn* coercions with other pointer coercions
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/mentioned_items.rs6
-rw-r--r--compiler/rustc_mir_transform/src/validate.rs6
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_mir_transform/src/mentioned_items.rs b/compiler/rustc_mir_transform/src/mentioned_items.rs
index f24de609e6b..9f9b39b02d3 100644
--- a/compiler/rustc_mir_transform/src/mentioned_items.rs
+++ b/compiler/rustc_mir_transform/src/mentioned_items.rs
@@ -70,11 +70,11 @@ impl<'tcx> Visitor<'tcx> for MentionedItemsVisitor<'_, 'tcx> {
         match *rvalue {
             // We need to detect unsizing casts that required vtables.
             mir::Rvalue::Cast(
-                mir::CastKind::PointerCoercion(PointerCoercion::Unsize),
+                mir::CastKind::PointerCoercion(PointerCoercion::Unsize)
+                | mir::CastKind::PointerCoercion(PointerCoercion::DynStar),
                 ref operand,
                 target_ty,
-            )
-            | mir::Rvalue::Cast(mir::CastKind::DynStar, ref operand, target_ty) => {
+            ) => {
                 // This isn't monomorphized yet so we can't tell what the actual types are -- just
                 // add everything that may involve a vtable.
                 let source_ty = operand.ty(self.body, self.tcx);
diff --git a/compiler/rustc_mir_transform/src/validate.rs b/compiler/rustc_mir_transform/src/validate.rs
index 914dddc1a56..2b6498409d0 100644
--- a/compiler/rustc_mir_transform/src/validate.rs
+++ b/compiler/rustc_mir_transform/src/validate.rs
@@ -1128,9 +1128,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
             Rvalue::Cast(kind, operand, target_type) => {
                 let op_ty = operand.ty(self.body, self.tcx);
                 match kind {
-                    CastKind::DynStar => {
-                        // FIXME(dyn-star): make sure nothing needs to be done here.
-                    }
                     // FIXME: Add Checks for these
                     CastKind::PointerWithExposedProvenance | CastKind::PointerExposeProvenance => {}
                     CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {
@@ -1208,6 +1205,9 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                         // This is used for all `CoerceUnsized` types,
                         // not just pointers/references, so is hard to check.
                     }
+                    CastKind::PointerCoercion(PointerCoercion::DynStar) => {
+                        // FIXME(dyn-star): make sure nothing needs to be done here.
+                    }
                     CastKind::IntToInt | CastKind::IntToFloat => {
                         let input_valid = op_ty.is_integral() || op_ty.is_char() || op_ty.is_bool();
                         let target_valid = target_type.is_numeric() || target_type.is_char();