parse: Tweak the function parameter edition check · rust-lang/rust@6b27e8d (original) (raw)

8 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1544,9 +1544,7 @@ impl<'a> Parser<'a> {
1544 1544
1545 1545 let is_name_required = match self.token.kind {
1546 1546 token::DotDotDot => false,
1547 -// FIXME: Consider using interpolated token for this edition check,
1548 -// it should match the intent of edition hygiene better.
1549 - _ => req_name(self.token.uninterpolate().span.edition()),
1547 + _ => req_name(self.token.span.edition()),
1550 1548 };
1551 1549 let (pat, ty) = if is_name_required |
1552 1550 debug!("parse_param_general parse_pat (is_name_required:{})", is_name_required);

File renamed without changes.

File renamed without changes.

File renamed without changes.

File renamed without changes.

File renamed without changes.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1 +// check-pass
2 +// edition:2018
3 +// aux-build:anon-params-edition-hygiene.rs
4 +
5 +#[macro_use]
6 +extern crate anon_params_edition_hygiene;
7 +
8 +generate_trait_2015!(u8);
9 +
10 +fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
1 +// edition:2015
2 +
3 +#[macro_export]
4 +macro_rules! generate_trait_2015 {
5 +($Type: ident) => {
6 +trait Trait {
7 +fn method($Type) {}
8 +}
9 +};
10 +}
11 +
12 +fn main() {}