]> git.proxmox.com Git - cargo.git/blobdiff - vendor/syn/src/generics.rs
Update upstream source from tag 'upstream/0.66.0'
[cargo.git] / vendor / syn / src / generics.rs
index 9c2802f87b8e0df25ecdd9c5f9f1ba1f611dcd0a..6d4fe847ed82f923d5dbccfb3120a924750e4cf6 100644 (file)
@@ -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> {