@@ -240,6 +240,11 @@ struct DebuggerCommands {
240
240
breakpoint_lines : Vec < usize > ,
241
241
}
242
242
243
+ enum ReadFrom {
244
+ Path ,
245
+ Stdin ,
246
+ }
247
+
243
248
impl < ' test > TestCx < ' test > {
244
249
/// Code executed for each revision in turn (or, if there are no
245
250
/// revisions, exactly once, with revision == None).
@@ -421,7 +426,10 @@ impl<'test> TestCx<'test> {
421
426
round, self . revision
422
427
) ,
423
428
) ;
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) ;
425
433
426
434
if !proc_res. status . success ( ) {
427
435
self . fatal_proc_rec (
@@ -477,7 +485,7 @@ impl<'test> TestCx<'test> {
477
485
}
478
486
479
487
// 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 ) ;
481
489
if !proc_res. status . success ( ) {
482
490
self . fatal_proc_rec ( "pretty-printing (expanded) failed" , & proc_res) ;
483
491
}
@@ -495,12 +503,16 @@ impl<'test> TestCx<'test> {
495
503
}
496
504
}
497
505
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 {
499
507
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
+ } ;
500
512
501
513
let mut rustc = Command :: new ( & self . config . rustc_path ) ;
502
514
rustc
503
- . arg ( "-" )
515
+ . arg ( input )
504
516
. args ( & [ "-Z" , & format ! ( "unpretty={}" , pretty_type) ] )
505
517
. args ( & [ "--target" , & self . config . target ] )
506
518
. arg ( "-L" )
0 commit comments