From a153bc946459ab8e15058850a3d3e4c0ca60f62d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 2 Oct 2021 18:08:43 -0700 Subject: [PATCH] Add regression test for issue 1073 --- tests/test_item.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/test_item.rs b/tests/test_item.rs index a991e62d33..96df4b1aad 100644 --- a/tests/test_item.rs +++ b/tests/test_item.rs @@ -299,3 +299,38 @@ fn test_impl_type_parameter_defaults() { self_ty: Type::Tuple, }"###); } + +#[test] +fn test_impl_trait_trailing_plus() { + let tokens = quote! { + fn f() -> impl Sized + {} + }; + + snapshot!(tokens as Item, @r###" + Item::Fn { + vis: Inherited, + sig: Signature { + ident: "f", + generics: Generics, + output: Type( + Type::ImplTrait { + bounds: [ + Trait(TraitBound { + modifier: None, + path: Path { + segments: [ + PathSegment { + ident: "Sized", + arguments: None, + }, + ], + }, + }), + ], + }, + ), + }, + block: Block, + } + "###); +}