about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/base.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-08-09 00:31:26 +0000
committerMaybe Lapkin <waffle.lapkin@gmail.com>2024-10-17 20:43:31 +0200
commite3800a1a04f338ce69bd403f230a019cebc54ece (patch)
tree45940f80da51d580dbb2e2451c9be4bd1cd06168 /compiler/rustc_codegen_ssa/src/base.rs
parent3a85d3fa785d95a7b7bcf4f160b67bffba7afd4a (diff)
downloadrust-e3800a1a04f338ce69bd403f230a019cebc54ece.tar.gz
rust-e3800a1a04f338ce69bd403f230a019cebc54ece.zip
Allow dropping dyn principal
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/base.rs')
-rw-r--r--compiler/rustc_codegen_ssa/src/base.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs
index d91c0f0790d..f3d9a7d37e6 100644
--- a/compiler/rustc_codegen_ssa/src/base.rs
+++ b/compiler/rustc_codegen_ssa/src/base.rs
@@ -147,7 +147,7 @@ pub fn validate_trivial_unsize<'tcx>(
                 infcx.leak_check(universe, None).is_ok()
             })
         }
-        (None, None) => true,
+        (_, None) => true,
         _ => false,
     }
 }
@@ -175,7 +175,8 @@ fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
         {
             let old_info =
                 old_info.expect("unsized_info: missing old info for trait upcasting coercion");
-            if data_a.principal_def_id() == data_b.principal_def_id() {
+            let b_principal_def_id = data_b.principal_def_id();
+            if data_a.principal_def_id() == b_principal_def_id || b_principal_def_id.is_none() {
                 // Codegen takes advantage of the 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