pub type_ident: Ident,
/// ident of the method
pub method_ident: Ident,
- /// dereferenced access to any [`Self_`] or [`Ptr(Self_, _)][ptr]` arguments
+ /// dereferenced access to any [`Self_`] or [`Ptr(Self_, _)`][ptr] arguments
///
/// [`Self_`]: ty::Ty::Self_
/// [ptr]: ty::Ty::Ptr
let span = trait_.span;
let mut patterns = Vec::new();
for i in 0..self_args.len() {
- let struct_path = cx.path(span, vec![type_ident]);
+ // We could use `type_ident` instead of `Self`, but in the case of a type parameter
+ // shadowing the struct name, that causes a second, unnecessary E0578 error. #97343
+ let struct_path = cx.path(span, vec![Ident::new(kw::SelfUpper, type_ident.span)]);
let (pat, ident_expr) = trait_.create_struct_pattern(
cx,
struct_path,