@@ -95,7 +95,6 @@ use std::fmt::Debug;
9595use std:: sync:: Arc ;
9696
9797use allocative:: Allocative ;
98- use buck2_error:: BuckErrorContext ;
9998use buck2_fs:: paths:: abs_path:: AbsPath ;
10099use buck2_fs:: paths:: file_name:: FileNameBuf ;
101100use dupe:: Dupe ;
@@ -457,27 +456,6 @@ impl CellResolver {
457456
458457 CellResolver :: new ( instances, root_aliases) . unwrap ( )
459458 }
460-
461- pub ( crate ) fn resolve_path_crossing_cell_boundaries < ' a > (
462- & self ,
463- mut path : CellPathRef < ' a > ,
464- ) -> buck2_error:: Result < CellPathRef < ' a > > {
465- let mut rem: u32 = 1000 ;
466- loop {
467- // Sanity check. Should never happen.
468- rem = rem
469- . checked_sub ( 1 )
470- . buck_error_context ( "Overflow computing cell boundaries" ) ?;
471-
472- let nested_cells = self . get ( path. cell ( ) ) ?. nested_cells ( ) ;
473- match nested_cells. matches_checked ( path. path ( ) ) {
474- None => return Ok ( path) ,
475- Some ( ( _, new_cell_path) ) => {
476- path = new_cell_path;
477- }
478- }
479- }
480- }
481459}
482460
483461#[ cfg( test) ]
@@ -570,90 +548,4 @@ mod tests {
570548
571549 Ok ( ( ) )
572550 }
573-
574- #[ test]
575- fn test_resolve_path_crossing_cell_boundaries ( ) {
576- let cell_resolver = CellResolver :: testing_with_names_and_paths ( & [
577- (
578- CellName :: testing_new ( "fbsource" ) ,
579- CellRootPathBuf :: testing_new ( "" ) ,
580- ) ,
581- (
582- CellName :: testing_new ( "fbcode" ) ,
583- CellRootPathBuf :: testing_new ( "fbcode" ) ,
584- ) ,
585- (
586- CellName :: testing_new ( "fbcode_macros" ) ,
587- CellRootPathBuf :: testing_new ( "fbcode/something/macros" ) ,
588- ) ,
589- ] ) ;
590- // Test starting with `fbsource//`.
591- assert_eq ! (
592- CellPathRef :: testing_new( "fbsource//" ) ,
593- cell_resolver
594- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new( "fbsource//" ) )
595- . unwrap( )
596- ) ;
597- assert_eq ! (
598- CellPathRef :: testing_new( "fbcode//" ) ,
599- cell_resolver
600- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new( "fbsource//fbcode" ) )
601- . unwrap( )
602- ) ;
603- assert_eq ! (
604- CellPathRef :: testing_new( "fbcode//something" ) ,
605- cell_resolver
606- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new(
607- "fbsource//fbcode/something"
608- ) )
609- . unwrap( )
610- ) ;
611- assert_eq ! (
612- CellPathRef :: testing_new( "fbcode_macros//" ) ,
613- cell_resolver
614- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new(
615- "fbsource//fbcode/something/macros"
616- ) )
617- . unwrap( )
618- ) ;
619- assert_eq ! (
620- CellPathRef :: testing_new( "fbcode_macros//xx" ) ,
621- cell_resolver
622- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new(
623- "fbsource//fbcode/something/macros/xx"
624- ) )
625- . unwrap( )
626- ) ;
627- // Now test starting with `fbcode//`.
628- assert_eq ! (
629- CellPathRef :: testing_new( "fbcode//" ) ,
630- cell_resolver
631- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new( "fbcode//" ) )
632- . unwrap( )
633- ) ;
634- assert_eq ! (
635- CellPathRef :: testing_new( "fbcode//something" ) ,
636- cell_resolver
637- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new(
638- "fbcode//something"
639- ) )
640- . unwrap( )
641- ) ;
642- assert_eq ! (
643- CellPathRef :: testing_new( "fbcode_macros//" ) ,
644- cell_resolver
645- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new(
646- "fbcode//something/macros"
647- ) )
648- . unwrap( )
649- ) ;
650- assert_eq ! (
651- CellPathRef :: testing_new( "fbcode_macros//xx" ) ,
652- cell_resolver
653- . resolve_path_crossing_cell_boundaries( CellPathRef :: testing_new(
654- "fbcode//something/macros/xx"
655- ) )
656- . unwrap( )
657- ) ;
658- }
659551}
0 commit comments