Skip to content

Incoming breakage: Remove unnecessary ?Sized bounds #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fmease
Copy link

@fmease fmease commented Jan 10, 2025

Hello there 👋

?Sized bounds in associated type bounds don't have any effect. Deref<Target: ?Sized> can simply be replaced with Deref without any change in semantics.

If you look at the definition of trait Deref, you can see type Target: ?Sized which states that <T as Deref>::Target is not necessarily Sized by default for all types T. Therefore a bound like C: Deref implies that Target is maybe-Sized. Even C: Deref<Target: > (sic!) doesn't mean C: Deref<Target: Sized> just as where <C as Deref>::Target: (sic!) doesn't mean where <C as Deref>::Target: Sized.

It's a bug in the current version of the Rust compiler that writing Trait<Assoc: ?Sized> is allowed, it should've been forbidden all along. See also rust-lang/rust#135229.

The compiler bug will likely be fixed soon. To avoid your crate from breaking in the future, I've removed the offending bounds.

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