-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Trait upcasting #60900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trait upcasting #60900
Changes from 1 commit
51e051a
b276f7b
1a721a3
21f2e98
af3d69c
92d5676
2ee0694
e21df4b
a9305a1
b183789
29de923
9549fbd
394a970
041cbfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,12 +58,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { | |
let vtable = self.memory.allocate( | ||
// Compute size of vtable, including 3 entries per supertrait for (drop, size, align) | ||
// metadata. | ||
ptr_size * ( | ||
methods | ||
ptr_size | ||
* (methods | ||
.iter() | ||
.map(|l| u64::try_from(l.len()).unwrap().checked_add(3).unwrap()) | ||
.sum() | ||
), | ||
.sum()), | ||
ptr_align, | ||
MemoryKind::Vtable, | ||
); | ||
|
@@ -73,9 +72,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { | |
// one pointer size each time. | ||
let mut cur_ptr = vtable; | ||
let mut write_ptr = |memory: &mut Memory<'mir, 'tcx, M>, val| -> InterpResult<'_> { | ||
|
||
let res = memory | ||
.get_raw_mut(cur_ptr.alloc_id)? | ||
.write_ptr_sized(tcx, cur_ptr, val)?; | ||
let res = memory.get_raw_mut(cur_ptr.alloc_id)?.write_ptr_sized(tcx, cur_ptr, val)?; | ||
cur_ptr = cur_ptr.offset(ptr_size, tcx)?; | ||
Ok(res) | ||
}; | ||
|
Uh oh!
There was an error while loading. Please reload this page.