-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
T: ?Sized
does not work in where
clauses
#20503
Comments
Note that we don't currently accept |
@nick29581 I will poke into this. |
There are a few edge cases here. In particular, specifying impl<T> Foo<T> {
fn foo(&self) where T: ?Sized { ... }
} Although allowing that could potentially be useful, I suspect it would complicate the implementation and be slightly unclear anyway. Additionally, specifying |
What needs to be done in order to get this working? Is it just a parsing issue? |
Triage: still a really annoying problem. |
@gankro I can fix this, probably my fault anyways. |
This is still a bit of a wart, and tripped me up the first time I wanted to use a |
I hit this issue today. |
@jroesch although it was a few months ago, do you remember enough context to write a very quick summary of where changes would need to be made to fix this? |
Ran into this one today. Is it just a parsing problem? |
IIRC this also needs to be handled in astconv |
|
There at least should be some better error message telling one to put ?Sized into the definition instead of the where clause. |
This is really a papercut issue. While when I hit I generally remember "Oh yeah, this bug again" and promptly fixes it, it still would be a much smoother experience if I did not have to. Note that in the same vein, it is not supported in a trait bounds either (eg: |
I tried to fix this but have immediately drowned in philosophical questions.
is desugared into
and
is desugared into
A few conclusions from this:
So, how I think the fix should look:
Other stuff:
|
Support `?Sized` in where clauses Implemented as described in #20503 (comment) - `?Trait` bounds are moved on type parameter definitions when possible, reported as errors otherwise. (It'd be nice to unify bounds and where clauses in HIR, but this is mostly blocked by rustdoc now - it needs to render bounds in pleasant way and the best way to do it so far is to mirror what was written in source code.) Fixes #20503 r? @nikomatsakis
The RFC states that the syntax should work in
where
clauses.The text was updated successfully, but these errors were encountered: