diff options
Diffstat (limited to 'vendor/syn/src/generics.rs')
-rw-r--r-- | vendor/syn/src/generics.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/syn/src/generics.rs b/vendor/syn/src/generics.rs index 9c2802f87..6d4fe847e 100644 --- a/vendor/syn/src/generics.rs +++ b/vendor/syn/src/generics.rs @@ -828,6 +828,31 @@ pub mod parsing { } } + impl TypeParamBound { + pub(crate) fn parse_multiple( + input: ParseStream, + allow_plus: bool, + ) -> Result<Punctuated<Self, Token![+]>> { + let mut bounds = Punctuated::new(); + loop { + bounds.push_value(input.parse()?); + if !(allow_plus && input.peek(Token![+])) { + break; + } + bounds.push_punct(input.parse()?); + if !(input.peek(Ident::peek_any) + || input.peek(Token![::]) + || input.peek(Token![?]) + || input.peek(Lifetime) + || input.peek(token::Paren)) + { + break; + } + } + Ok(bounds) + } + } + #[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))] impl Parse for TraitBound { fn parse(input: ParseStream) -> Result<Self> { |