Skip to content

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

Merged
merged 2 commits into from
Apr 1, 2023

Conversation

tamasfe
Copy link
Contributor

@tamasfe tamasfe commented Apr 1, 2023

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 from Fn*() types, this is not ideal but I didn't want to spend too much time as it is an experimental feature.

Limited syntactic support for experimental return type notations.
rust-lang/rust#109417
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2023
@tamasfe
Copy link
Contributor Author

tamasfe commented Apr 1, 2023

The CI fails at the TODO comment, should I just rename it to FIXME as the error suggests, or is there a common way to feature-gate or mark experimental features that might change drastically or might be removed altogether?

@lnicola
Copy link
Member

lnicola commented Apr 1, 2023

is there a common way to feature-gate or mark experimental features

Only if they can be annoying, like diagnostics with false positives. It's an unstable feature, we give no guarantees.

@Veykril
Copy link
Member

Veykril commented Apr 1, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Apr 1, 2023

📌 Commit 25910bc has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 1, 2023

⌛ Testing commit 25910bc with merge 1ebac28...

@bors
Copy link
Contributor

bors commented Apr 1, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 1ebac28 to master...

@bors bors merged commit 1ebac28 into rust-lang:master Apr 1, 2023
bors added a commit that referenced this pull request May 15, 2023
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.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants