@@ -27,7 +27,7 @@ use lint;
2727use  middle:: cstore; 
2828
2929use  syntax:: ast:: { self ,  IntTy ,  UintTy } ; 
30- use  syntax:: codemap:: FilePathMapping ; 
30+ use  syntax:: codemap:: { FilePathMapping ,   FileName } ; 
3131use  syntax:: parse:: token; 
3232use  syntax:: parse; 
3333use  syntax:: symbol:: Symbol ; 
@@ -440,7 +440,7 @@ pub enum Input {
440440File ( PathBuf ) , 
441441    Str  { 
442442        /// String that is shown in place of a filename 
443- name :  String , 
443+ name :  FileName , 
444444        /// Anonymous source string 
445445input :  String , 
446446    } , 
@@ -733,7 +733,9 @@ macro_rules! options {
733733            Some ( "one of: `y`, `yes`, `on`, `n`, `no`, or `off`" ) ; 
734734        pub  const  parse_string:  Option <& ' static  str > = Some ( "a string" ) ; 
735735        pub  const  parse_string_push:  Option <& ' static  str > = Some ( "a string" ) ; 
736+         pub  const  parse_pathbuf_push:  Option <& ' static  str > = Some ( "a path" ) ; 
736737        pub  const  parse_opt_string:  Option <& ' static  str > = Some ( "a string" ) ; 
738+         pub  const  parse_opt_pathbuf:  Option <& ' static  str > = Some ( "a path" ) ; 
737739        pub  const  parse_list:  Option <& ' static  str > = Some ( "a space-separated list of strings" ) ; 
738740        pub  const  parse_opt_list:  Option <& ' static  str > = Some ( "a space-separated list of strings" ) ; 
739741        pub  const  parse_uint:  Option <& ' static  str > = Some ( "a number" ) ; 
@@ -757,6 +759,7 @@ macro_rules! options {
757759    mod  $mod_set { 
758760        use  super :: { $struct_name,  Passes ,  SomePasses ,  AllPasses ,  Sanitizer } ; 
759761        use  rustc_back:: { LinkerFlavor ,  PanicStrategy ,  RelroLevel } ; 
762+         use  std:: path:: PathBuf ; 
760763
761764        $( 
762765            pub  fn  $opt( cg:  & mut  $struct_name,  v:  Option <& str >)  -> bool  { 
@@ -797,6 +800,13 @@ macro_rules! options {
797800            } 
798801        } 
799802
803+         fn  parse_opt_pathbuf( slot:  & mut  Option <PathBuf >,  v:  Option <& str >)  -> bool  { 
804+             match  v { 
805+                 Some ( s)  => {  * slot = Some ( PathBuf :: from( s) ) ;  true  } , 
806+                 None  => false , 
807+             } 
808+         } 
809+ 
800810        fn  parse_string( slot:  & mut  String ,  v:  Option <& str >)  -> bool  { 
801811            match  v { 
802812                Some ( s)  => {  * slot = s. to_string( ) ;  true  } , 
@@ -811,6 +821,13 @@ macro_rules! options {
811821            } 
812822        } 
813823
824+         fn  parse_pathbuf_push( slot:  & mut  Vec <PathBuf >,  v:  Option <& str >)  -> bool  { 
825+             match  v { 
826+                 Some ( s)  => {  slot. push( PathBuf :: from( s) ) ;  true  } , 
827+                 None  => false , 
828+             } 
829+         } 
830+ 
814831        fn  parse_list( slot:  & mut  Vec <String >,  v:  Option <& str >) 
815832                      -> bool  { 
816833            match  v { 
@@ -931,7 +948,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
931948         CG_OPTIONS ,  cg_type_desc,  cgsetters, 
932949    ar:  Option <String > = ( None ,  parse_opt_string,  [ UNTRACKED ] , 
933950        "this option is deprecated and does nothing" ) , 
934-     linker:  Option <String > = ( None ,  parse_opt_string ,  [ UNTRACKED ] , 
951+     linker:  Option <PathBuf > = ( None ,  parse_opt_pathbuf ,  [ UNTRACKED ] , 
935952        "system linker to link outputs with" ) , 
936953    link_arg:  Vec <String > = ( vec![ ] ,  parse_string_push,  [ UNTRACKED ] , 
937954        "a single extra argument to append to the linker invocation (can be used several times)" ) , 
@@ -1151,9 +1168,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
11511168        "set the optimization fuel quota for a crate" ) , 
11521169    print_fuel:  Option <String > = ( None ,  parse_opt_string,  [ TRACKED ] , 
11531170        "make Rustc print the total optimization fuel used by a crate" ) , 
1154-     remap_path_prefix_from:  Vec <String > = ( vec![ ] ,  parse_string_push ,  [ TRACKED ] , 
1171+     remap_path_prefix_from:  Vec <PathBuf > = ( vec![ ] ,  parse_pathbuf_push ,  [ TRACKED ] , 
11551172        "add a source pattern to the file path remapping config" ) , 
1156-     remap_path_prefix_to:  Vec <String > = ( vec![ ] ,  parse_string_push ,  [ TRACKED ] , 
1173+     remap_path_prefix_to:  Vec <PathBuf > = ( vec![ ] ,  parse_pathbuf_push ,  [ TRACKED ] , 
11571174        "add a mapping target to the file path remapping config" ) , 
11581175    force_unstable_if_unmarked:  bool  = ( false ,  parse_bool,  [ TRACKED ] , 
11591176        "force all crates to be `rustc_private` unstable" ) , 
@@ -1472,7 +1489,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
14721489    cfgspecs. into_iter ( ) . map ( |s| { 
14731490        let  sess = parse:: ParseSess :: new ( FilePathMapping :: empty ( ) ) ; 
14741491        let  mut  parser =
1475-             parse:: new_parser_from_source_str ( & sess,  "cfgspec" . to_string ( ) ,  s. to_string ( ) ) ; 
1492+             parse:: new_parser_from_source_str ( & sess,  FileName :: CfgSpec ,  s. to_string ( ) ) ; 
14761493
14771494        let  meta_item = panictry ! ( parser. parse_meta_item( ) ) ; 
14781495
@@ -1594,13 +1611,13 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
15941611        for  source in  & debugging_opts. remap_path_prefix_from [ remap_path_prefix_targets..]  { 
15951612            early_error ( error_format, 
15961613                & format ! ( "option `-Zremap-path-prefix-from='{}'` does not have \  
1597- ,  source) ) 
1614+ ,  source. display ( ) ) ) 
15981615        } 
15991616    }  else  if  remap_path_prefix_targets > remap_path_prefix_sources { 
16001617        for  target in  & debugging_opts. remap_path_prefix_to [ remap_path_prefix_sources..]  { 
16011618            early_error ( error_format, 
16021619                & format ! ( "option `-Zremap-path-prefix-to='{}'` does not have \  
1603- ,  target) ) 
1620+ ,  target. display ( ) ) ) 
16041621        } 
16051622    } 
16061623
@@ -2001,6 +2018,7 @@ mod dep_tracking {
20012018    impl_dep_tracking_hash_via_hash ! ( usize ) ; 
20022019    impl_dep_tracking_hash_via_hash ! ( u64 ) ; 
20032020    impl_dep_tracking_hash_via_hash ! ( String ) ; 
2021+     impl_dep_tracking_hash_via_hash ! ( PathBuf ) ; 
20042022    impl_dep_tracking_hash_via_hash ! ( lint:: Level ) ; 
20052023    impl_dep_tracking_hash_via_hash ! ( Option <bool >) ; 
20062024    impl_dep_tracking_hash_via_hash ! ( Option <usize >) ; 
@@ -2025,6 +2043,7 @@ mod dep_tracking {
20252043    impl_dep_tracking_hash_via_hash ! ( Option <Sanitizer >) ; 
20262044
20272045    impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ; 
2046+     impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ; 
20282047    impl_dep_tracking_hash_for_sortable_vec_of ! ( CrateType ) ; 
20292048    impl_dep_tracking_hash_for_sortable_vec_of ! ( ( String ,  lint:: Level ) ) ; 
20302049    impl_dep_tracking_hash_for_sortable_vec_of ! ( ( String ,  Option <String >, 
@@ -2533,7 +2552,7 @@ mod tests {
25332552        opts. cg . ar  = Some ( String :: from ( "abc" ) ) ; 
25342553        assert_eq ! ( reference. dep_tracking_hash( ) ,  opts. dep_tracking_hash( ) ) ; 
25352554
2536-         opts. cg . linker  = Some ( String :: from ( "linker" ) ) ; 
2555+         opts. cg . linker  = Some ( PathBuf :: from ( "linker" ) ) ; 
25372556        assert_eq ! ( reference. dep_tracking_hash( ) ,  opts. dep_tracking_hash( ) ) ; 
25382557
25392558        opts. cg . link_args  = Some ( vec ! [ String :: from( "abc" ) ,  String :: from( "def" ) ] ) ; 
0 commit comments