@@ -298,7 +298,7 @@ pub(crate) struct RenderOptions {
298
298
pub ( crate ) write_rendered_cci : bool ,
299
299
/// The location of the doc directory for externally located crates.
300
300
/// Absolute path ending in doc/.
301
- pub ( crate ) parts_paths : FxHashMap < String , PathToParts > ,
301
+ pub ( crate ) parts_paths : Vec < PathToParts > ,
302
302
/// Where to write the cross-crate information parts
303
303
pub ( crate ) parts_out_dir : Option < PathToParts > ,
304
304
}
@@ -505,10 +505,9 @@ impl Options {
505
505
Err ( err) => dcx. fatal ( err) ,
506
506
} ;
507
507
508
- let parts_paths = match parse_include_info_json ( matches) {
509
- Ok ( ex) => ex,
510
- Err ( err) => dcx. fatal ( err) ,
511
- } ;
508
+ let parts_paths = matches. opt_strs ( "include-info-json" ) . iter ( )
509
+ . map ( |path| PathToParts :: from_path_to_crate_info ( PathBuf :: from ( path) ) )
510
+ . collect ( ) ;
512
511
513
512
let default_settings: Vec < Vec < ( String , String ) > > = vec ! [
514
513
matches
@@ -754,7 +753,7 @@ impl Options {
754
753
Ok ( result) => result,
755
754
Err ( e) => dcx. fatal ( format ! ( "could not parse --merge: {e}" ) ) ,
756
755
} ;
757
- let parts_out_dir = matches. opt_str ( "write-info-json" ) . map ( |p| PathToParts :: from_doc_root ( PathBuf :: from ( p) ) ) ;
756
+ let parts_out_dir = matches. opt_str ( "write-info-json" ) . map ( |p| PathToParts :: from_path_to_crate_info ( PathBuf :: from ( p) ) ) ;
758
757
759
758
if generate_link_to_definition && ( show_coverage || output_format != OutputFormat :: Html ) {
760
759
dcx. fatal (
@@ -924,35 +923,20 @@ fn parse_extern_html_roots(
924
923
925
924
/// Absolute path to cci root, including doc.parts, but not the crate name
926
925
///
927
- /// For example, `/home/user/project/target/doc.parts/`.
926
+ /// For example, `/home/user/project/target/doc.parts/<crate>/crate-info.json `.
928
927
#[ derive( Clone , Debug ) ]
929
928
pub ( crate ) struct PathToParts ( PathBuf ) ;
930
929
931
930
impl PathToParts {
932
931
/// Absolute path to cci root, including doc.parts, but not the crate name
933
- fn from_doc_root ( doc_root : PathBuf ) -> Self {
932
+ fn from_path_to_crate_info ( doc_root : PathBuf ) -> Self {
934
933
PathToParts ( doc_root)
935
934
}
936
935
937
936
/// Gets the final path at which to place the cci part
938
- pub ( crate ) fn crate_info_path ( & self , crate_name : & str ) -> PathBuf {
939
- PathBuf :: from_iter ( [ & self . 0 , Path :: new ( crate_name) , Path :: new ( "crate-info.json" ) ] )
940
- }
941
- }
942
-
943
- /// Extracts `--include-info-json` arguments from `matches` and returns a map of crate names to
944
- /// the given locations. If an `--include-info-json` argument was ill-formed, returns an error
945
- /// describing the issue.
946
- fn parse_include_info_json (
947
- matches : & getopts:: Matches ,
948
- ) -> Result < FxHashMap < String , PathToParts > , & ' static str > {
949
- let mut externs = FxHashMap :: default ( ) ;
950
- for arg in & matches. opt_strs ( "include-info-json" ) {
951
- let ( name, path) =
952
- arg. split_once ( '=' ) . ok_or ( "--include-info-json must be of the form NAME=PATH" ) ?;
953
- externs. insert ( name. to_string ( ) , PathToParts :: from_doc_root ( PathBuf :: from ( path) ) ) ;
937
+ pub ( crate ) fn path ( & self ) -> & Path {
938
+ & self . 0
954
939
}
955
- Ok ( externs)
956
940
}
957
941
958
942
struct MergeResult {
0 commit comments