@@ -10,7 +10,7 @@ use crate::sources::{IndexSummary, PathSource, RecursivePathSource};
1010use crate :: util:: edit_distance:: { closest, edit_distance} ;
1111use crate :: util:: errors:: CargoResult ;
1212use crate :: util:: { GlobalContext , OptVersionReq , VersionExt } ;
13- use anyhow:: Error ;
13+ use anyhow:: { Error , anyhow } ;
1414
1515use super :: context:: ResolverContext ;
1616use super :: types:: { ConflictMap , ConflictReason } ;
@@ -387,12 +387,26 @@ pub(super) fn activation_error(
387387 } ) ;
388388 let _ = writeln ! ( & mut msg, "perhaps you meant: {suggestions}" ) ;
389389 } else {
390+ let package_path = resolver_ctx
391+ . parents
392+ . path_to_bottom ( & parent. package_id ( ) )
393+ . into_iter ( )
394+ . map ( |( pkg_id, _) | pkg_id. clone ( ) )
395+ . collect :: < Vec < PackageId > > ( ) ;
396+
390397 let sid = dep. source_id ( ) ;
391- let path = dep
392- . source_id ( )
393- . url ( )
394- . to_file_path ( )
395- . expect ( "failed to get the path" ) ;
398+ let path = match dep. source_id ( ) . url ( ) . to_file_path ( ) {
399+ Ok ( path) => path,
400+ Err ( _) => {
401+ return ResolveError {
402+ cause : anyhow ! (
403+ "no matching package found named '{}' found" ,
404+ dep. package_name( )
405+ ) ,
406+ package_path,
407+ } ;
408+ }
409+ } ;
396410 let requested = dep. package_name ( ) . as_str ( ) ;
397411
398412 if let Some ( gctx) = gctx {
@@ -680,7 +694,7 @@ fn inspect_recursive_packages(
680694
681695fn _inspect_else_packages ( path : & Path ) {
682696 let entry_path = read_dir ( path) ;
683- let entry_result = entry_path
697+ let _entry_result = entry_path
684698 . expect ( "failed to get the path" )
685699 . map ( |f| {
686700 f. expect ( "failed to get the path" )
@@ -690,7 +704,5 @@ fn _inspect_else_packages(path: &Path) {
690704 } )
691705 . collect :: < Vec < _ > > ( ) ;
692706
693- println ! ( "{:?}" , entry_result) ;
694-
695707 // let walkdir = WalkDir::new(entry_path);
696708}
0 commit comments