`derive(CoercePointee)` accepts `?Sized + Sized`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
derive(CoercePointee) checks whether the generic type is ?Sized, and rejects the code if it is not marked as ?Sized. However, making it ?Sized + Sized is still accepted by the macro. That is, the following code compiles:
#![feature(derive_coerce_pointee)]
use std::marker::CoercePointee;
#[derive(CoercePointee)]
#[repr(transparent)]
struct Foo<T: ?Sized + Sized>(*const T);
Is the fact that ?Sized is required effectively just a lint, or is it important for some other reason? Currently, the check doesn't actually enforce anything, and it's possible to accidentally require Sized with something like T: ?Sized + Clone.
Meta
Reproducible on the playground with version 1.93.0-nightly (2025-11-01 bd3ac0330018c23b111b)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue's Rust snippet with the nightly compiler and inspect the derive(CoercePointee) validation that checks ?Sized bounds. Determine whether ?Sized + Sized and bounds such as ?Sized + Clone should be rejected, then add regression coverage showing the intended diagnostic or acceptance behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100