about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-23 13:52:02 -0400
committerMichael Goulet <michael@errs.io>2024-09-25 11:13:59 -0400
commit3209943604a9b3565a3cef4c43b567f65cfdf192 (patch)
tree5872a492b6fc7cd3cb477a6f34d41aea5e79e269 /compiler/rustc_mir_transform
parent8fc8e03150ed69cc37a3e21b319a4d9bf247292f (diff)
downloadrust-3209943604a9b3565a3cef4c43b567f65cfdf192.tar.gz
rust-3209943604a9b3565a3cef4c43b567f65cfdf192.zip
Add a debug assertion in codegen that unsize casts of the same principal trait def id are truly NOPs
Diffstat (limited to 'compiler/rustc_mir_transform')
-rw-r--r--compiler/rustc_mir_transform/src/validate.rs15
1 files changed, 0 insertions, 15 deletions
diff --git a/compiler/rustc_mir_transform/src/validate.rs b/compiler/rustc_mir_transform/src/validate.rs
index c9a844e4734..e353be6a105 100644
--- a/compiler/rustc_mir_transform/src/validate.rs
+++ b/compiler/rustc_mir_transform/src/validate.rs
@@ -1233,21 +1233,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
                         )) {
                             self.fail(location, format!("Unsize coercion, but `{op_ty}` isn't coercible to `{target_type}`"));
                         }
-
-                        // FIXME: Codegen has an additional assumption, where if the
-                        // principal trait def id of what's being casted doesn't change,
-                        // then we don't need to adjust the vtable at all. This
-                        // corresponds to the fact that `dyn Tr<A>: Unsize<dyn Tr<B>>`
-                        // requires that `A = B`; we don't allow *upcasting* objects
-                        // between the same trait with different args. Nothing actually
-                        // validates this, though. While it's true right now, if we for
-                        // some reason were to relax the `Unsize` trait, it could become
-                        // unsound. We should eventually validate that, but it would
-                        // require peeling `&Box<Struct<.., dyn Tr<A>, ..>>` down to
-                        // the trait object that's being unsized, and that's rather
-                        // annoying, and also it would need to be opportunistic since
-                        // this MIR is not yet fully monomorphized, so we may bottom
-                        // out in an alias or a projection or something.
                     }
                     CastKind::PointerCoercion(PointerCoercion::DynStar, _) => {
                         // FIXME(dyn-star): make sure nothing needs to be done here.