You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've used Rust for a while now, and a long time ago struggled with needing to add : Sized to some types. Apparently quite a while ago, this changed to Sized being default and needing to request unsizedness in certain contexts. I had been struggling thinking
Had simply become impossible (I haven't needed it since pre-1.0 so it could've been true) until I went on the Rust Discord and had it revealed that, in fact, Sized is the default and ?Sized needs to be requested; an un-constraint rather than a constraint.
Unfortunately, I've been operating under this assumption for a while so I have some code with associated types that needs Sized behavior that explicitly calls for type Assoc: Sized or <T: Sized>. It might be worth linting against Sized constraints and noting it's effectively a non-constraint.
One consideration is that : Sized could potentially be seen as documentation (i.e. "hello future coder do not change this to ?Sized please or things will break"), so I don't know if it should be on by default or not.
I've used Rust for a while now, and a long time ago struggled with needing to add
: Sized
to some types. Apparently quite a while ago, this changed toSized
being default and needing to request unsizedness in certain contexts. I had been struggling thinkingHad simply become impossible (I haven't needed it since pre-1.0 so it could've been true) until I went on the Rust Discord and had it revealed that, in fact,
Sized
is the default and?Sized
needs to be requested; an un-constraint rather than a constraint.Unfortunately, I've been operating under this assumption for a while so I have some code with associated types that needs
Sized
behavior that explicitly calls fortype Assoc: Sized
or<T: Sized>
. It might be worth linting againstSized
constraints and noting it's effectively a non-constraint.One consideration is that
: Sized
could potentially be seen as documentation (i.e. "hello future coder do not change this to?Sized
please or things will break"), so I don't know if it should be on by default or not.Related to #1368.
The text was updated successfully, but these errors were encountered: