@@ -919,14 +919,14 @@ fn collect_eii_linkage(tcx: TyCtxt<'_>) -> Vec<EiiLinkageInfo> {
919919 let mut eiis = FxIndexMap :: < DefId , FoundEii > :: default ( ) ;
920920
921921 for & cnum in tcx. crates ( ( ) ) . iter ( ) . chain ( iter:: once ( & LOCAL_CRATE ) ) {
922- for ( did, ( decl, impls) ) in tcx. externally_implementable_items ( cnum) {
923- eiis. entry ( * did)
924- . or_insert_with ( || FoundEii { decl : * decl , impls : Default :: default ( ) } )
922+ for ( & did, & ( decl, ref impls) ) in tcx. externally_implementable_items ( cnum) {
923+ eiis. entry ( did)
924+ . or_insert_with ( || FoundEii { decl, impls : Default :: default ( ) } )
925925 . impls
926926 . extend (
927927 impls
928928 . into_iter ( )
929- . map ( |( did, imp) | ( * did, FoundImpl { imp : * imp, impl_crate : cnum } ) ) ,
929+ . map ( |( & did, & imp) | ( did, FoundImpl { imp, impl_crate : cnum } ) ) ,
930930 ) ;
931931 }
932932 }
@@ -945,11 +945,9 @@ fn collect_eii_linkage(tcx: TyCtxt<'_>) -> Vec<EiiLinkageInfo> {
945945 }
946946 }
947947
948- // Only this case needs the link-time check. Missing impls and
949- // duplicate explicit impls are handled in `rustc_passes`.
950- if explicit_impls. len ( ) == 1
951- && let Some ( default_impl) = default_impl
952- {
948+ // Link time check is only needed when there may be a default impl in a dylib.
949+ // Other cases emit an error in `rustc_passes` already.
950+ if let Some ( default_impl) = default_impl {
953951 Some ( EiiLinkageInfo {
954952 name : decl. name . name ,
955953 impls : explicit_impls,
0 commit comments