|
1 | 1 | use rustc_abi::WrappingRange; |
| 2 | +use rustc_middle::bug; |
2 | 3 | use rustc_middle::mir::SourceInfo; |
3 | 4 | use rustc_middle::ty::{self, Ty, TyCtxt}; |
4 | | -use rustc_middle::{bug, span_bug}; |
5 | 5 | use rustc_session::config::OptLevel; |
6 | 6 | use rustc_span::sym; |
7 | 7 |
|
@@ -60,14 +60,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
60 | 60 | source_info: SourceInfo, |
61 | 61 | ) -> Result<(), ty::Instance<'tcx>> { |
62 | 62 | let span = source_info.span; |
63 | | - let callee_ty = instance.ty(bx.tcx(), bx.typing_env()); |
64 | 63 |
|
65 | | - let ty::FnDef(def_id, fn_args) = *callee_ty.kind() else { |
66 | | - span_bug!(span, "expected fn item type, found {}", callee_ty); |
67 | | - }; |
68 | | - |
69 | | - let name = bx.tcx().item_name(def_id); |
| 64 | + let name = bx.tcx().item_name(instance.def_id()); |
70 | 65 | let name_str = name.as_str(); |
| 66 | + let fn_args = instance.args; |
71 | 67 |
|
72 | 68 | // If we're swapping something that's *not* an `OperandValue::Ref`, |
73 | 69 | // then we can do it directly and avoid the alloca. |
@@ -137,7 +133,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
137 | 133 | sym::vtable_align => ty::COMMON_VTABLE_ENTRIES_ALIGN, |
138 | 134 | _ => bug!(), |
139 | 135 | }; |
140 | | - let value = meth::VirtualIndex::from_index(idx).get_usize(bx, vtable, callee_ty); |
| 136 | + let value = meth::VirtualIndex::from_index(idx).get_usize( |
| 137 | + bx, |
| 138 | + vtable, |
| 139 | + instance.ty(bx.tcx(), bx.typing_env()), |
| 140 | + ); |
141 | 141 | match name { |
142 | 142 | // Size is always <= isize::MAX. |
143 | 143 | sym::vtable_size => { |
|
0 commit comments