diff --git a/src/item.rs b/src/item.rs index 7c99e6ec98..4c168508cc 100644 --- a/src/item.rs +++ b/src/item.rs @@ -1179,14 +1179,14 @@ pub mod parsing { let mut bounds = Punctuated::new(); if colon_token.is_some() { loop { - bounds.push_value(input.parse::()?); if input.peek(Token![where]) || input.peek(Token![=]) || input.peek(Token![;]) { break; } - bounds.push_punct(input.parse::()?); + bounds.push_value(input.parse::()?); if input.peek(Token![where]) || input.peek(Token![=]) || input.peek(Token![;]) { break; } + bounds.push_punct(input.parse::()?); } } generics.where_clause = input.parse()?; diff --git a/tests/test_item.rs b/tests/test_item.rs index 7695f19906..712c6c6f42 100644 --- a/tests/test_item.rs +++ b/tests/test_item.rs @@ -241,3 +241,28 @@ fn test_supertraits() { } "###); } + +#[test] +fn test_type_empty_bounds() { + #[rustfmt::skip] + let tokens = quote! { + trait Foo { + type Bar: ; + } + }; + + snapshot!(tokens as ItemTrait, @r###" + ItemTrait { + vis: Inherited, + ident: "Foo", + generics: Generics, + items: [ + TraitItem::Type { + ident: "Bar", + generics: Generics, + colon_token: Some, + }, + ], + } + "###); +}