gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Check for pointee of derive(CoercePointee) to be marked ?Sized

Open wesley-lewis opened this issue 1 month ago • 0 comments

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 ?Sized bound marked for the generic type
  • If ?Sized bound is not satisfied then we return ErrorCode E0802 and display the reason similar to rustc

References:

wesley-lewis avatar Oct 06 '26 20:10 wesley-lewis