From c95ee9e91dce4fa56c4636e0b8b9cbc4e676b830 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 12 Oct 2018 17:08:36 +0200 Subject: [PATCH] Add comments to remind everyone to keep the `get_vtable` impls in sync --- src/librustc_codegen_llvm/meth.rs | 4 ++++ src/librustc_mir/interpret/traits.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/librustc_codegen_llvm/meth.rs b/src/librustc_codegen_llvm/meth.rs index db06b87f44e1..29c2e71960c2 100644 --- a/src/librustc_codegen_llvm/meth.rs +++ b/src/librustc_codegen_llvm/meth.rs @@ -94,6 +94,10 @@ pub fn get_vtable( }); let (size, align) = cx.size_and_align_of(ty); + // ///////////////////////////////////////////////////////////////////////////////////////////// + // If you touch this code, be sure to also make the corresponding changes to + // `get_vtable` in rust_mir/interpret/traits.rs + // ///////////////////////////////////////////////////////////////////////////////////////////// let components: Vec<_> = [ callee::get_fn(cx, monomorphize::resolve_drop_in_place(cx.tcx, ty)), C_usize(cx, size.bytes()), diff --git a/src/librustc_mir/interpret/traits.rs b/src/librustc_mir/interpret/traits.rs index 30591a4ff5a5..2b0febc1ce71 100644 --- a/src/librustc_mir/interpret/traits.rs +++ b/src/librustc_mir/interpret/traits.rs @@ -46,6 +46,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> let ptr_size = self.pointer_size(); let ptr_align = self.tcx.data_layout.pointer_align; + // ///////////////////////////////////////////////////////////////////////////////////////// + // If you touch this code, be sure to also make the corresponding changes to + // `get_vtable` in rust_codegen_llvm/meth.rs + // ///////////////////////////////////////////////////////////////////////////////////////// let vtable = self.memory.allocate( ptr_size * (3 + methods.len() as u64), ptr_align,