diff --git a/src/generics.rs b/src/generics.rs index f1555228d4..746184826f 100644 --- a/src/generics.rs +++ b/src/generics.rs @@ -1046,10 +1046,8 @@ pub(crate) mod parsing { let mut params = Punctuated::new(); loop { let lookahead = input.lookahead1(); - params.push_value(if lookahead.peek(Lifetime) { - input.parse().map(CapturedParam::Lifetime)? - } else if lookahead.peek(Ident) { - input.parse().map(CapturedParam::Ident)? + params.push_value(if lookahead.peek(Lifetime) || lookahead.peek(Ident) { + input.parse::()? } else if lookahead.peek(Token![>]) { break; } else { @@ -1073,6 +1071,21 @@ pub(crate) mod parsing { }) } } + + #[cfg(feature = "full")] + #[cfg_attr(docsrs, doc(cfg(feature = "parsing")))] + impl Parse for CapturedParam { + fn parse(input: ParseStream) -> Result { + let lookahead = input.lookahead1(); + if lookahead.peek(Lifetime) { + input.parse().map(CapturedParam::Lifetime) + } else if lookahead.peek(Ident) { + input.parse().map(CapturedParam::Ident) + } else { + Err(lookahead.error()) + } + } + } } #[cfg(feature = "printing")]