Skip to content

Commit c95ee9e

Browse files
committed
Add comments to remind everyone to keep the get_vtable impls in sync
1 parent ef3ece7 commit c95ee9e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: src/librustc_codegen_llvm/meth.rs

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ pub fn get_vtable(
9494
});
9595

9696
let (size, align) = cx.size_and_align_of(ty);
97+
// /////////////////////////////////////////////////////////////////////////////////////////////
98+
// If you touch this code, be sure to also make the corresponding changes to
99+
// `get_vtable` in rust_mir/interpret/traits.rs
100+
// /////////////////////////////////////////////////////////////////////////////////////////////
97101
let components: Vec<_> = [
98102
callee::get_fn(cx, monomorphize::resolve_drop_in_place(cx.tcx, ty)),
99103
C_usize(cx, size.bytes()),

Diff for: src/librustc_mir/interpret/traits.rs

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
4646

4747
let ptr_size = self.pointer_size();
4848
let ptr_align = self.tcx.data_layout.pointer_align;
49+
// /////////////////////////////////////////////////////////////////////////////////////////
50+
// If you touch this code, be sure to also make the corresponding changes to
51+
// `get_vtable` in rust_codegen_llvm/meth.rs
52+
// /////////////////////////////////////////////////////////////////////////////////////////
4953
let vtable = self.memory.allocate(
5054
ptr_size * (3 + methods.len() as u64),
5155
ptr_align,

0 commit comments

Comments
 (0)