Skip to content

Conversation

fmease
Copy link

@fmease fmease commented Jul 31, 2025

Hello there 👋, I'm a member of the Rust compiler team.

?Sized bounds in associated type bounds don't have any effect. The bound Deref<Target: ?Sized> can simply be replaced with Deref without any change in semantics (Target is already maybe-sized since it's defined like type Target: ?Sized; in the std library; writing Deref doesn't implicitly add a Sized requirement, nor does writing Deref<Target:> (sic!)).

It's a bug in the current version of the Rust compiler that writing TraitRef<AssocTy: ?Sized> is allowed, it should've been forbidden all along. See also rust-lang/rust#135229. The compiler bug is about to be fixed (rust-lang/rust#135331) and these relaxed bounds will soon become a hard error in this position! I sincerely apologize for the inconvenience!


This future breakage was found with the help of crater (see the build log).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant