File tree Expand file tree Collapse file tree 9 files changed +14
-11
lines changed
crates/resolver-tests/src
tests/testsuite/cargo_add/add_no_vendored_package_with_vendor Expand file tree Collapse file tree 9 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ pub fn resolve_with_config_raw(
113113 let matched = match kind {
114114 QueryKind :: Exact => dep. matches ( summary) ,
115115 QueryKind :: Fuzzy => true ,
116+ QueryKind :: Normalized => true ,
116117 } ;
117118 if matched {
118119 self . used . insert ( summary. package_id ( ) ) ;
Original file line number Diff line number Diff line change @@ -588,7 +588,7 @@ fn get_latest_dependency(
588588 }
589589 MaybeWorkspace :: Other ( query) => {
590590 let possibilities = loop {
591- match registry. query_vec ( & query, QueryKind :: Fuzzy ) {
591+ match registry. query_vec ( & query, QueryKind :: Normalized ) {
592592 std:: task:: Poll :: Ready ( res) => {
593593 break res?;
594594 }
@@ -711,7 +711,7 @@ fn select_package(
711711 MaybeWorkspace :: Other ( query) => {
712712 let possibilities = loop {
713713 // Exact to avoid returning all for path/git
714- match registry. query_vec ( & query, QueryKind :: Exact ) {
714+ match registry. query_vec ( & query, QueryKind :: Normalized ) {
715715 std:: task:: Poll :: Ready ( res) => {
716716 break res?;
717717 }
@@ -938,7 +938,7 @@ fn populate_available_features(
938938 }
939939
940940 let possibilities = loop {
941- match registry. query_vec ( & query, QueryKind :: Exact ) {
941+ match registry. query_vec ( & query, QueryKind :: Normalized ) {
942942 std:: task:: Poll :: Ready ( res) => {
943943 break res?;
944944 }
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ impl<'cfg> Source for DirectorySource<'cfg> {
109109 let matches = packages. filter ( |pkg| match kind {
110110 QueryKind :: Exact => dep. matches ( pkg. summary ( ) ) ,
111111 QueryKind :: Fuzzy => true ,
112+ QueryKind :: Normalized => dep. matches ( pkg. summary ( ) ) ,
112113 } ) ;
113114 for summary in matches. map ( |pkg| pkg. summary ( ) . clone ( ) ) {
114115 f ( IndexSummary :: Candidate ( summary) ) ;
Original file line number Diff line number Diff line change @@ -555,6 +555,7 @@ impl<'cfg> Source for PathSource<'cfg> {
555555 let matched = match kind {
556556 QueryKind :: Exact => dep. matches ( s) ,
557557 QueryKind :: Fuzzy => true ,
558+ QueryKind :: Normalized => dep. matches ( s) ,
558559 } ;
559560 if matched {
560561 f ( IndexSummary :: Candidate ( s. clone ( ) ) )
Original file line number Diff line number Diff line change @@ -793,6 +793,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
793793 let matched = match kind {
794794 QueryKind :: Exact => dep. matches( s. as_summary( ) ) ,
795795 QueryKind :: Fuzzy => true ,
796+ QueryKind :: Normalized => true ,
796797 } ;
797798 if !matched {
798799 return ;
@@ -831,7 +832,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
831832 return Poll :: Ready ( Ok ( ( ) ) ) ;
832833 }
833834 let mut any_pending = false ;
834- if kind == QueryKind :: Fuzzy {
835+ if kind == QueryKind :: Fuzzy || kind == QueryKind :: Normalized {
835836 // Attempt to handle misspellings by searching for a chain of related
836837 // names to the original name. The resolver will later
837838 // reject any candidates that have the wrong name, and with this it'll
Original file line number Diff line number Diff line change @@ -180,6 +180,9 @@ pub enum QueryKind {
180180 /// whereas an `Registry` source may return dependencies that have the same
181181 /// canonicalization.
182182 Fuzzy ,
183+ /// Match a denpendency in all ways and will normalize the package name.
184+ /// Each source defines what normalizing means.
185+ Normalized ,
183186}
184187
185188/// A download status that represents if a [`Package`] has already been
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ fn case() {
1515 . arg_line ( "cbindgen" )
1616 . current_dir ( cwd)
1717 . assert ( )
18- . success ( )
18+ . failure ( )
1919 . stdout_matches ( file ! [ "stdout.log" ] )
2020 . stderr_matches ( file ! [ "stderr.log" ] ) ;
2121
Original file line number Diff line number Diff line change 22
33[package ]
44name = " cargo-list-test-fixture"
5- version = " 0.0.0"
6-
7- [dependencies ]
8- aa = " 0.0.0"
5+ version = " 0.0.0"
Original file line number Diff line number Diff line change 1- warning: translating `cbindgen` to `aa`
2- Adding aa v0.0.0 to dependencies
1+ error: the crate `cbindgen` could not be found in registry index.
You can’t perform that action at this time.
0 commit comments