@@ -160,7 +160,16 @@ impl Feature {
160160 ) -> bool {
161161 if let Some ( v) = map. get ( cur) {
162162 for cur in v {
163- if cur != root && ( group. matches ( cur) || rec ( group, map, cur, root) ) {
163+ let fname = if let Some ( slash_idx) = cur. find ( '/' ) {
164+ // The fname may still have a '?' suffix, which is fine.
165+ // Because in that case it doesn't activate that dependency, so it can be ignored.
166+ let ( fname, _) = cur. split_at ( slash_idx) ;
167+ fname
168+ } else {
169+ // Could be 'dep:something', which is fine because it's not a feature.
170+ cur
171+ } ;
172+ if fname != root && ( group. matches ( fname) || rec ( group, map, fname, root) ) {
164173 return true ;
165174 }
166175 }
@@ -396,6 +405,25 @@ mod tests {
396405 vec![ "b" , "async-std" ]
397406 ] ) ;
398407
408+ let map = map ! [
409+ ( "tokio" , v![ ] ) ,
410+ ( "async-std" , v![ ] ) ,
411+ ( "a" , v![ "tokio/full" ] ) ,
412+ ( "b" , v![ "async-std?/alloc" ] )
413+ ] ;
414+ let list = v ! [ "a" , "b" , "tokio" , "async-std" ] ;
415+ let mutually_exclusive_features = [ Feature :: group ( [ "tokio" , "async-std" ] ) ] ;
416+ let filtered = feature_powerset ( & list, None , & [ ] , & mutually_exclusive_features, & map) ;
417+ assert_eq ! ( filtered, vec![
418+ vec![ "a" ] ,
419+ vec![ "b" ] ,
420+ vec![ "a" , "b" ] ,
421+ vec![ "tokio" ] ,
422+ vec![ "b" , "tokio" ] ,
423+ vec![ "async-std" ] ,
424+ vec![ "b" , "async-std" ]
425+ ] ) ;
426+
399427 let map = map ! [ ( "a" , v![ ] ) , ( "b" , v![ "a" ] ) , ( "c" , v![ ] ) , ( "d" , v![ "b" ] ) ] ;
400428 let list = v ! [ "a" , "b" , "c" , "d" ] ;
401429 let mutually_exclusive_features = [ Feature :: group ( [ "a" , "c" ] ) ] ;
0 commit comments