@@ -1600,8 +1600,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
16001600 if !self . diagnostic_metadata . currently_processing_generics && !single_uppercase_char {
16011601 return None ;
16021602 }
1603- match ( self . diagnostic_metadata . current_item , single_uppercase_char) {
1604- ( Some ( Item { kind : ItemKind :: Fn ( ..) , ident, .. } ) , _) if ident. name == sym:: main => {
1603+ match ( self . diagnostic_metadata . current_item , single_uppercase_char, self . diagnostic_metadata . currently_processing_generics ) {
1604+ ( Some ( Item { kind : ItemKind :: Fn ( ..) , ident, .. } ) , _, _ ) if ident. name == sym:: main => {
16051605 // Ignore `fn main()` as we don't want to suggest `fn main<T>()`
16061606 }
16071607 (
@@ -1613,9 +1613,11 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
16131613 | kind @ ItemKind :: Union ( ..) ,
16141614 ..
16151615 } ) ,
1616- true ,
1616+ true , _
16171617 )
1618- | ( Some ( Item { kind, .. } ) , false ) => {
1618+ // Without the 2nd `true`, we'd suggest `impl <T>` for `impl T` when a type `T` isn't found
1619+ | ( Some ( Item { kind : kind @ ItemKind :: Impl ( ..) , .. } ) , true , true )
1620+ | ( Some ( Item { kind, .. } ) , false , _) => {
16191621 // Likely missing type parameter.
16201622 if let Some ( generics) = kind. generics ( ) {
16211623 if span. overlaps ( generics. span ) {
0 commit comments