For the next Rust upgrade you should be aware of a subtle breaking change -
the compiler's internal representation of trait objects has changed.
Previously trait objects were represented as a pair of pointer-to-vtable,
pointer-to-data. That order has been reveresed to pointer-to-data,
pointer-to-vtable (to make it uniform with pointers to slices). If you
transmute one of these fat pointers into a struct (or anything else,
assuming an ordering) and use its fields, you will get some really weird
bugs, possibly nowhere near the actual transmute. A quick look at the Servo
code indicates you are doing this. The correct thing to do is to transmute
to core::raw::TraitObject.

To help find these evil transmutes, I added a lint (allow by default) -
TRANSMUTE_FAT_PTR - which will show you any instances where you transmute
to or from any fat pointer. There will be lots of false positives - where
you are transmuting to/from just to change the lifetime or mutability or
where you're already using the core::raw structs.

Let me know if you have any questions about the change.

Cheers, Nick
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to