gccrs
gccrs copied to clipboard
Check for pointee of derive(CoercePointee) to be marked ?Sized
For example:
#[repr(transparent)]
#[derive(CoercePointee)]
struct A<T: MyTrait>(Box<T>);
This currently compiles with crab1.
It should actually give out an error reporting that the trait(generic type) must be marked ?Sized. Meaning that the size of the pointee is not known at compile time. As all types of rust are implicitly marked Sized the user has to specifically bound the pointee's type with ?Sized.
rustc (1.101.0-nightly (c1070d693 2026-09-28)) gives out the following error:
error[E0802]: `derive(CoercePointee)` requires `T` to be marked `?Sized`
TODO:
- We need to check if the type of the pointee of a CoercePointee'd struct has the
?Sizedbound marked for the generic type - If
?Sizedbound is not satisfied then we return ErrorCodeE0802and display the reason similar to rustc