-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove TrailingToken
.
#127842
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
Remove TrailingToken
.
#127842
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ use crate::errors::{ | |
WhereClauseBeforeTupleStructBodySugg, | ||
}; | ||
|
||
use super::{ForceCollect, Parser, TrailingToken}; | ||
use super::{ForceCollect, Parser}; | ||
|
||
use ast::token::Delimiter; | ||
use rustc_ast::token; | ||
|
@@ -229,13 +229,13 @@ impl<'a> Parser<'a> { | |
span: where_predicate.span(), | ||
}); | ||
// FIXME - try to continue parsing other generics? | ||
return Ok((None, TrailingToken::None)); | ||
return Ok((None, false)); | ||
} | ||
Err(err) => { | ||
err.cancel(); | ||
// FIXME - maybe we should overwrite 'self' outside of `collect_tokens`? | ||
this.restore_snapshot(snapshot); | ||
return Ok((None, TrailingToken::None)); | ||
return Ok((None, false)); | ||
} | ||
} | ||
} else { | ||
|
@@ -249,14 +249,14 @@ impl<'a> Parser<'a> { | |
.emit_err(errors::AttrWithoutGenerics { span: attrs[0].span }); | ||
} | ||
} | ||
return Ok((None, TrailingToken::None)); | ||
return Ok((None, false)); | ||
}; | ||
|
||
if !this.eat(&token::Comma) { | ||
done = true; | ||
} | ||
// We just ate the comma, so no need to use `TrailingToken` | ||
Ok((param, TrailingToken::None)) | ||
// We just ate the comma, so no need to capture the trailing token. | ||
Ok((param, false)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Including commas into the On the other hand, proc macros probably should see the trailing comma as a part of their input, so they could correctly expand into nothing if necessary, like |
||
})?; | ||
|
||
if let Some(param) = param { | ||
|
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.
I would expect a
next_token == token::Comma
here, because match arms are separated by commas.I suspect this may cause issues with configured out arms inside derive/cfg_eval.