File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use std::task::Poll;
5
5
use crate :: core:: { Dependency , PackageId , Registry , Summary } ;
6
6
use crate :: sources:: source:: QueryKind ;
7
7
use crate :: sources:: IndexSummary ;
8
- use crate :: util:: edit_distance:: edit_distance;
8
+ use crate :: util:: edit_distance:: { closest , edit_distance} ;
9
9
use crate :: util:: errors:: CargoResult ;
10
10
use crate :: util:: { GlobalContext , OptVersionReq , VersionExt } ;
11
11
use anyhow:: Error ;
@@ -160,6 +160,14 @@ pub(super) fn activation_error(
160
160
msg. push_str ( "` but `" ) ;
161
161
msg. push_str ( & * dep. package_name ( ) ) ;
162
162
msg. push_str ( "` does not have that feature.\n " ) ;
163
+ let latest = candidates. last ( ) . expect ( "in the non-empty branch" ) ;
164
+ if let Some ( closest) = closest ( feature, latest. features ( ) . keys ( ) , |k| k) {
165
+ msg. push_str ( " package `" ) ;
166
+ msg. push_str ( & * dep. package_name ( ) ) ;
167
+ msg. push_str ( "` does have feature `" ) ;
168
+ msg. push_str ( closest) ;
169
+ msg. push_str ( "`\n " ) ;
170
+ }
163
171
// p == parent so the full path is redundant.
164
172
}
165
173
ConflictReason :: RequiredDependencyAsFeature ( feature) => {
Original file line number Diff line number Diff line change @@ -280,6 +280,7 @@ fn dependency_activates_typoed_feature() {
280
280
versions that meet the requirements `*` are: 0.0.1
281
281
282
282
package `foo` depends on `bar` with feature `bar` but `bar` does not have that feature.
283
+ package `bar` does have feature `baz`
283
284
284
285
285
286
failed to select a version for `bar` which could resolve this conflict
You can’t perform that action at this time.
0 commit comments