diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2024-02-12 21:24:48 +0000 |
|---|---|---|
| committer | Maybe Lapkin <waffle.lapkin@gmail.com> | 2024-07-04 17:56:09 +0200 |
| commit | 5645e8e28578e4b907383323fadde172375409f1 (patch) | |
| tree | c71114cef3e6fb433babb2a44af19b4d814cc4fc /compiler/rustc_codegen_gcc/example/std_example.rs | |
| parent | 9e8ef92da0fbca5935380e79a22142d9951ed050 (diff) | |
| download | rust-5645e8e28578e4b907383323fadde172375409f1.tar.gz rust-5645e8e28578e4b907383323fadde172375409f1.zip | |
Add more checks for pointers with vtable meta
The rules for casting `*mut X<dyn A>` -> `*mut Y<dyn B>` are as follows: - If `B` has a principal - `A` must have exactly the same principal (including generics) - Auto traits of `B` must be a subset of autotraits in `A` Note that `X<_>` and `Y<_>` can be identity, or arbitrary structs with last field being the dyn type. The lifetime of the trait object itself (`dyn ... + 'a`) is not checked. This prevents a few soundness issues with `#![feature(arbitrary_self_types)]` and trait upcasting. Namely, these checks make sure that vtable is always valid for the pointee.
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions
