impl Parse for MethodTurbofish

This commit is contained in:
David Tolnay 2022-04-05 16:22:54 -07:00
parent e1ffb0756a
commit 6ae1c80118
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1603,27 +1603,7 @@ pub(crate) mod parsing {
let member: Member = input.parse()?;
let turbofish = if member.is_named() && input.peek(Token![::]) {
Some(MethodTurbofish {
colon2_token: input.parse()?,
lt_token: input.parse()?,
args: {
let mut args = Punctuated::new();
loop {
if input.peek(Token![>]) {
break;
}
let value: GenericMethodArgument = input.parse()?;
args.push_value(value);
if input.peek(Token![>]) {
break;
}
let punct = input.parse()?;
args.push_punct(punct);
}
args
},
gt_token: input.parse()?,
})
Some(input.parse::<MethodTurbofish>()?)
} else {
None
};
@ -2116,6 +2096,34 @@ pub(crate) mod parsing {
}
}
#[cfg(feature = "full")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for MethodTurbofish {
fn parse(input: ParseStream) -> Result<Self> {
Ok(MethodTurbofish {
colon2_token: input.parse()?,
lt_token: input.parse()?,
args: {
let mut args = Punctuated::new();
loop {
if input.peek(Token![>]) {
break;
}
let value: GenericMethodArgument = input.parse()?;
args.push_value(value);
if input.peek(Token![>]) {
break;
}
let punct = input.parse()?;
args.push_punct(punct);
}
args
},
gt_token: input.parse()?,
})
}
}
#[cfg(feature = "full")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprLet {