@@ -240,6 +240,11 @@ struct DebuggerCommands {
240240 breakpoint_lines : Vec < usize > ,
241241}
242242
243+ enum ReadFrom {
244+ Path ,
245+ Stdin ,
246+ }
247+
243248impl < ' test > TestCx < ' test > {
244249 /// Code executed for each revision in turn (or, if there are no
245250 /// revisions, exactly once, with revision == None).
@@ -421,7 +426,10 @@ impl<'test> TestCx<'test> {
421426 round, self . revision
422427 ) ,
423428 ) ;
424- let proc_res = self . print_source ( srcs[ round] . to_owned ( ) , & self . props . pretty_mode ) ;
429+ let read_from = if round == 0 { ReadFrom :: Path } else { ReadFrom :: Stdin } ;
430+ let proc_res = self . print_source ( srcs[ round] . to_owned ( ) ,
431+ & self . props . pretty_mode ,
432+ read_from) ;
425433
426434 if !proc_res. status . success ( ) {
427435 self . fatal_proc_rec (
@@ -477,7 +485,7 @@ impl<'test> TestCx<'test> {
477485 }
478486
479487 // additionally, run `--pretty expanded` and try to build it.
480- let proc_res = self . print_source ( srcs[ round] . clone ( ) , "expanded" ) ;
488+ let proc_res = self . print_source ( srcs[ round] . clone ( ) , "expanded" , ReadFrom :: Path ) ;
481489 if !proc_res. status . success ( ) {
482490 self . fatal_proc_rec ( "pretty-printing (expanded) failed" , & proc_res) ;
483491 }
@@ -495,12 +503,16 @@ impl<'test> TestCx<'test> {
495503 }
496504 }
497505
498- fn print_source ( & self , src : String , pretty_type : & str ) -> ProcRes {
506+ fn print_source ( & self , src : String , pretty_type : & str , read_from : ReadFrom ) -> ProcRes {
499507 let aux_dir = self . aux_output_dir_name ( ) ;
508+ let input: & str = match read_from {
509+ ReadFrom :: Stdin => "-" ,
510+ ReadFrom :: Path => self . testpaths . file . to_str ( ) . unwrap ( ) ,
511+ } ;
500512
501513 let mut rustc = Command :: new ( & self . config . rustc_path ) ;
502514 rustc
503- . arg ( "-" )
515+ . arg ( input )
504516 . args ( & [ "-Z" , & format ! ( "unpretty={}" , pretty_type) ] )
505517 . args ( & [ "--target" , & self . config . target ] )
506518 . arg ( "-L" )
0 commit comments