summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/base.rs
diff options
context:
space:
mode:
authorCharles Lew <crlf0710@gmail.com>2021-08-18 12:45:18 +0800
committerCharles Lew <crlf0710@gmail.com>2021-08-18 13:00:27 +0800
commit6b1c52ff254c40b3b5f7a3e16db9cf3f8e9b35e0 (patch)
treef54e6891a038bf071fde7fa2e145e111cb4cb560 /compiler/rustc_codegen_ssa/src/base.rs
parent1e605023ec3bf85fc9997741de5c6dae031c791d (diff)
downloadrust-6b1c52ff254c40b3b5f7a3e16db9cf3f8e9b35e0.tar.gz
rust-6b1c52ff254c40b3b5f7a3e16db9cf3f8e9b35e0.zip
Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation processing.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/base.rs')
-rw-r--r--compiler/rustc_codegen_ssa/src/base.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs
index 064a51c8f60..a5143a755fe 100644
--- a/compiler/rustc_codegen_ssa/src/base.rs
+++ b/compiler/rustc_codegen_ssa/src/base.rs
@@ -150,19 +150,8 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
 
             // trait upcasting coercion
 
-            // if both of the two `principal`s are `None`, this function would have returned early above.
-            // and if one of the two `principal`s is `None`, typechecking would have rejected this case.
-            let principal_a = data_a
-                .principal()
-                .expect("unsized_info: missing principal trait for trait upcasting coercion");
-            let principal_b = data_b
-                .principal()
-                .expect("unsized_info: missing principal trait for trait upcasting coercion");
-
-            let vptr_entry_idx = cx.tcx().vtable_trait_upcasting_coercion_new_vptr_slot((
-                principal_a.with_self_ty(cx.tcx(), source),
-                principal_b.with_self_ty(cx.tcx(), source),
-            ));
+            let vptr_entry_idx =
+                cx.tcx().vtable_trait_upcasting_coercion_new_vptr_slot((source, target));
 
             if let Some(entry_idx) = vptr_entry_idx {
                 let ptr_ty = cx.type_i8p();