about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/traits.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-06-11 07:47:58 +0200
committerRalf Jung <post@ralfj.de>2024-06-11 08:54:49 +0200
commitd041b7cf30bb5b5236cd9148cde7a3017ed28679 (patch)
tree7a9769da950b84e4c7920a3e46e890cfe892ce27 /compiler/rustc_const_eval/src/interpret/traits.rs
parentaf4d6c74efb31e34f75dfe5faf6064a0ff9cbd7c (diff)
downloadrust-d041b7cf30bb5b5236cd9148cde7a3017ed28679.tar.gz
rust-d041b7cf30bb5b5236cd9148cde7a3017ed28679.zip
check for correct trait in size_and_align_of
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/traits.rs')
-rw-r--r--compiler/rustc_const_eval/src/interpret/traits.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/traits.rs b/compiler/rustc_const_eval/src/interpret/traits.rs
index 1df9f5f7b2a..44e7244a513 100644
--- a/compiler/rustc_const_eval/src/interpret/traits.rs
+++ b/compiler/rustc_const_eval/src/interpret/traits.rs
@@ -36,8 +36,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
     pub fn get_vtable_size_and_align(
         &self,
         vtable: Pointer<Option<M::Provenance>>,
+        expected_trait: Option<&'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>>,
     ) -> InterpResult<'tcx, (Size, Align)> {
-        let ty = self.get_ptr_vtable_ty(vtable, None)?;
+        let ty = self.get_ptr_vtable_ty(vtable, expected_trait)?;
         let layout = self.layout_of(ty)?;
         assert!(layout.is_sized(), "there are no vtables for unsized types");
         Ok((layout.size, layout.align.abi))