parse: Tweak the function parameter edition check

Move anon-params tests to ui/anon-params.
This commit is contained in:
Vadim Petrochenkov 2020-03-10 21:02:15 +03:00
parent dd155df0a6
commit 6b27e8d2a6
8 changed files with 23 additions and 3 deletions

View File

@ -1544,9 +1544,7 @@ impl<'a> Parser<'a> {
let is_name_required = match self.token.kind {
token::DotDotDot => false,
// FIXME: Consider using interpolated token for this edition check,
// it should match the intent of edition hygiene better.
_ => req_name(self.token.uninterpolate().span.edition()),
_ => req_name(self.token.span.edition()),
};
let (pat, ty) = if is_name_required || self.is_named_param() {
debug!("parse_param_general parse_pat (is_name_required:{})", is_name_required);

View File

@ -0,0 +1,10 @@
// check-pass
// edition:2018
// aux-build:anon-params-edition-hygiene.rs
#[macro_use]
extern crate anon_params_edition_hygiene;
generate_trait_2015!(u8);
fn main() {}

View File

@ -0,0 +1,12 @@
// edition:2015
#[macro_export]
macro_rules! generate_trait_2015 {
($Type: ident) => {
trait Trait {
fn method($Type) {}
}
};
}
fn main() {}