@@ -1103,24 +1103,30 @@ fn emit_warnings(
1103
1103
new_cx. resolve_features = im_rc:: HashMap :: new ( ) ;
1104
1104
let mut features_from_dep = HashMap :: new ( ) ;
1105
1105
for ( summary, method) in summaries {
1106
+ let replacement = & cx. activations [ & resolve
1107
+ . replacements ( )
1108
+ . get ( & summary. package_id ( ) )
1109
+ . unwrap_or ( & summary. package_id ( ) )
1110
+ . as_activations_key ( ) ]
1111
+ . 0 ;
1106
1112
for ( dep, features) in new_cx
1107
- . resolve_features ( None , summary , & method, config)
1108
- . expect ( "can not resolve_features for a required summary " )
1113
+ . resolve_features ( None , replacement , & method, config)
1114
+ . expect ( "can not resolve_features for a required summery " )
1109
1115
{
1110
- features_from_dep. insert ( ( summary . package_id ( ) , dep) , features) ;
1116
+ features_from_dep. insert ( ( replacement . package_id ( ) , dep) , features) ;
1111
1117
}
1112
1118
}
1113
1119
// crates enable features for their dependencies.
1114
1120
// So by iterating reverse topologically we process all of the parents before each child.
1115
1121
// Then we know all the needed features for each crate.
1116
1122
let topological_sort = resolve. sort ( ) ;
1117
- for summary in topological_sort. iter ( ) . rev ( ) . map ( |id| {
1118
- cx . activations
1119
- . get ( & id . as_activations_key ( ) )
1120
- . expect ( "id in dependency graph but not in activations" )
1121
- . 0
1122
- . clone ( )
1123
- } ) {
1123
+ for id in topological_sort
1124
+ . iter ( )
1125
+ . rev ( )
1126
+ . filter ( | & id| !resolve . replacements ( ) . contains_key ( id ) )
1127
+ {
1128
+ let summary = & cx . activations [ & id . as_activations_key ( ) ] . 0 ;
1129
+
1124
1130
for ( parent, deps) in cx. parents . edges ( & summary. package_id ( ) ) {
1125
1131
for dep in deps. iter ( ) {
1126
1132
let features = features_from_dep
@@ -1133,7 +1139,7 @@ fn emit_warnings(
1133
1139
uses_default_features : dep. uses_default_features ( ) ,
1134
1140
} ;
1135
1141
for ( dep, features) in new_cx
1136
- . resolve_features ( None , & summary, & method, config)
1142
+ . resolve_features ( None , summary, & method, config)
1137
1143
. expect ( "can not resolve_features for a used dep" )
1138
1144
{
1139
1145
features_from_dep. insert ( ( summary. package_id ( ) , dep) , features) ;
0 commit comments