Allow where-clause to end at end of input
diff --git a/src/generics.rs b/src/generics.rs
index 07ea86b..c63cb69 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -771,7 +771,8 @@
                 predicates: {
                     let mut predicates = Punctuated::new();
                     loop {
-                        if input.peek(token::Brace)
+                        if input.is_empty()
+                            || input.peek(token::Brace)
                             || input.peek(Token![,])
                             || input.peek(Token![;])
                             || input.peek(Token![:]) && !input.peek(Token![::])
diff --git a/tests/test_generics.rs b/tests/test_generics.rs
index d3b33ed..5f10593 100644
--- a/tests/test_generics.rs
+++ b/tests/test_generics.rs
@@ -161,3 +161,12 @@
     let second_bound = &predicate.bounds[1];
     assert_eq!(quote!(#second_bound).to_string(), "Send");
 }
+
+#[test]
+fn test_where_clause_at_end_of_input() {
+    let tokens = quote! {
+        where
+    };
+    let where_clause = syn::parse2::<WhereClause>(tokens).unwrap();
+    assert_eq!(where_clause.predicates.len(), 0);
+}