From 8ae37b75d6c66f0b794dcc39db0a930200c18e79 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 22 Mar 2023 15:50:01 -0700 Subject: [PATCH] Fix duplicated name of mut self bare fn arg --- src/ty.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ty.rs b/src/ty.rs index 69d0deedf0..9b341dafaf 100644 --- a/src/ty.rs +++ b/src/ty.rs @@ -917,7 +917,7 @@ pub(crate) mod parsing { } let mut has_self = false; - let name = if (input.peek(Ident) || input.peek(Token![_]) || { + let mut name = if (input.peek(Ident) || input.peek(Token![_]) || { has_self = allow_self && input.peek(Token![self]); has_self }) && input.peek2(Token![:]) @@ -945,7 +945,10 @@ pub(crate) mod parsing { let ty = match ty { Some(ty) if !has_mut_self => ty, - _ => Type::Verbatim(verbatim::between(begin, input)), + _ => { + name = None; + Type::Verbatim(verbatim::between(begin, input)) + } }; Ok(BareFnArg { attrs, name, ty })