-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Recover param: Ty = EXPR
#137396
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
base: master
Are you sure you want to change the base?
Recover param: Ty = EXPR
#137396
Conversation
r? fmease |
3ddd6ac
to
70a1e44
Compare
70a1e44
to
9929d57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second glance, I would think parse_param_general
is 'a better fit' for this compared to parse_ty_for_param
(which should probably only concern itself with parsing types).
Mostly an organizational nitpick since it shouldn't be able to affect behavior (CC anon params in Rust 2015). I was only able to find trait T { fn f((x)=0 fn) {} }
which will emit two errors under this PR in Rust 2015 (parameter defaults are not supported
and expected `:`, found `=`
) instead of one and would keep emitting a single one if the logic was moved into parse_param_general
I think but that's hardly interesting.
nw, r=me then
r=me with or without moving the logic into parse_param_general
. Sorry for the churn / wrong signal there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(preexisting: the patterns aren't allowed in methods without bodies
parser recovery is fragile already: it suggests the more butchered _: )=0
for trait T { fn f((x)=0); }
under Rust 2015)
Fixes #137310
Pretty basic recovery here, but better than giving an unexpected token error.