mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Use pointer casts instead of tramsutes to raw::TraitObject
Casting `*const T` to `*const U` with `U: Sized` is allowed even if `T: ?Sized`. This safely extracts the data pointer out of a trait object, without relying on the memory representation of trait objects.
This commit is contained in:
parent
78aaa85aec
commit
e7c53d4ca2
3 changed files with 10 additions and 52 deletions
|
@ -90,12 +90,3 @@ pub use self::data::LayoutData;
|
|||
// We can't use servo_arc for everything in layout, because the Flow stuff uses
|
||||
// weak references.
|
||||
use servo_arc::Arc as ServoArc;
|
||||
|
||||
/// Stable copy of std::raw::TraitObject
|
||||
/// test/unit/layout/lib.rs asserts that the memory layout matches.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct TraitObject {
|
||||
pub data: *mut (),
|
||||
pub vtable: *mut (),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue