-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Limited syntax support for return type notations (RTN) #14465
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Limited syntactic support for experimental return type notations. rust-lang/rust#109417
The CI fails at the |
Only if they can be annoying, like diagnostics with false positives. It's an unstable feature, we give no guarantees. |
@bors r+ |
☀️ Test successful - checks-actions |
Parse associated return type bounds This PR implements parser support for associated return type bounds: `T: Foo<bar(): Send>`. This PR does not implement associated return types (`T::bar(): Send`) because it's not implemented even in rustc, and also removes `(..)`-style return type notation because it has been removed in rust-lang/rust#110203 (effectively reverting #14465). I don't plan to proactively follow this unstable feature unless an RFC is accepted and my main motivation here is to remove no-longer-valid syntax `(..)` from our parser, nevertheless adding minimal parser support so anyone interested (as can be seen in #14465) can experiment it without rust-analyzer's syntax errors.
Experimental RTN bound support was recently merged into rustc (rust-lang/rust#109417), the goal of this PR is to allow experimentation without syntax errors everywhere.
The parsing implemented currently aligns with the state of the tracking issue, it only supports the form
T<foo(..): Bounds>
. The parser always checks for the presence of..
to disambiguate fromFn*()
types, this is not ideal but I didn't want to spend too much time as it is an experimental feature.