@@ -88,7 +88,7 @@ pub fn run(input: &str,
88
88
config:: build_configuration ( & sess, config:: parse_cfgspecs ( cfgs. clone ( ) ) ) ;
89
89
90
90
let krate = panictry ! ( driver:: phase_1_parse_input( & sess, & input) ) ;
91
- let driver:: ExpansionResult { defs , mut hir_forest, .. } = {
91
+ let driver:: ExpansionResult { hir_forest, .. } = {
92
92
phase_2_configure_and_expand (
93
93
& sess, & cstore, krate, None , "rustdoc-test" , None , MakeGlobMap :: No , |_| Ok ( ( ) )
94
94
) . expect ( "phase_2_configure_and_expand aborted in rustdoc!" )
@@ -183,8 +183,6 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
183
183
name : driver:: anon_src ( ) ,
184
184
input : test. to_owned ( ) ,
185
185
} ;
186
- let test = format ! ( "Error in \" {}\" at line {}.\n " ,
187
- filename, line_number) ;
188
186
let outputs = OutputTypes :: new ( & [ ( OutputType :: Exe , None ) ] ) ;
189
187
190
188
let sessopts = config:: Options {
@@ -265,22 +263,22 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
265
263
if count > 0 && !compile_fail {
266
264
sess. fatal ( "aborting due to previous error(s)" )
267
265
} else if count == 0 && compile_fail {
268
- panic ! ( "test compiled while it wasn't supposed to: \n \n {} \n " , test )
266
+ panic ! ( "test compiled while it wasn't supposed to" )
269
267
}
270
268
if count > 0 && error_codes. len ( ) > 0 {
271
269
let out = String :: from_utf8 ( data. lock ( ) . unwrap ( ) . to_vec ( ) ) . unwrap ( ) ;
272
270
error_codes. retain ( |err| !out. contains ( err) ) ;
273
271
}
274
272
}
275
273
Ok ( ( ) ) if compile_fail => {
276
- panic ! ( "test compiled while it wasn't supposed to: \n \n {} \n " , test )
274
+ panic ! ( "test compiled while it wasn't supposed to" )
277
275
}
278
276
_ => { }
279
277
}
280
278
}
281
279
Err ( _) => {
282
280
if !compile_fail {
283
- panic ! ( "couldn't compile the test: \n \n {} \n " , test ) ;
281
+ panic ! ( "couldn't compile the test" ) ;
284
282
}
285
283
if error_codes. len ( ) > 0 {
286
284
let out = String :: from_utf8 ( data. lock ( ) . unwrap ( ) . to_vec ( ) ) . unwrap ( ) ;
@@ -290,7 +288,7 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
290
288
}
291
289
292
290
if error_codes. len ( ) > 0 {
293
- panic ! ( "Some expected error codes were not found: {:?}\n \n {} \n " , error_codes, test ) ;
291
+ panic ! ( "Some expected error codes were not found: {:?}" , error_codes) ;
294
292
}
295
293
296
294
if no_run { return }
@@ -312,18 +310,17 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
312
310
cmd. env ( var, & newpath) ;
313
311
314
312
match cmd. output ( ) {
315
- Err ( e) => panic ! ( "couldn't run the test: {}{}\n \n {} \n " , e,
313
+ Err ( e) => panic ! ( "couldn't run the test: {}{}" , e,
316
314
if e. kind( ) == io:: ErrorKind :: PermissionDenied {
317
315
" - maybe your tempdir is mounted with noexec?"
318
- } else { "" } , test ) ,
316
+ } else { "" } ) ,
319
317
Ok ( out) => {
320
318
if should_panic && out. status . success ( ) {
321
- panic ! ( "test executable succeeded when it should have failed\n \n {} \n " , test ) ;
319
+ panic ! ( "test executable succeeded when it should have failed" ) ;
322
320
} else if !should_panic && !out. status . success ( ) {
323
- panic ! ( "test executable failed:\n {}\n {}\n \n {} \n " ,
321
+ panic ! ( "test executable failed:\n {}\n {}\n " ,
324
322
str :: from_utf8( & out. stdout) . unwrap_or( "" ) ,
325
- str :: from_utf8( & out. stderr) . unwrap_or( "" ) ,
326
- test) ;
323
+ str :: from_utf8( & out. stderr) . unwrap_or( "" ) ) ;
327
324
}
328
325
}
329
326
}
@@ -458,12 +455,8 @@ impl Collector {
458
455
should_panic : bool , no_run : bool , should_ignore : bool ,
459
456
as_test_harness : bool , compile_fail : bool , error_codes : Vec < String > ,
460
457
original : String ) {
461
- let name = if self . use_headers {
462
- let s = self . current_header . as_ref ( ) . map ( |s| & * * s) . unwrap_or ( "" ) ;
463
- format ! ( "{}_{}" , s, self . cnt)
464
- } else {
465
- format ! ( "{}_{}" , self . names. join( "::" ) , self . cnt)
466
- } ;
458
+ let line_number = self . get_line_from_key ( & format ! ( "{}\n {}\n " , original, test) ) ;
459
+ let name = format ! ( "{} - line {}" , self . filename, line_number) ;
467
460
self . cnt += 1 ;
468
461
let cfgs = self . cfgs . clone ( ) ;
469
462
let libs = self . libs . clone ( ) ;
@@ -472,8 +465,6 @@ impl Collector {
472
465
let opts = self . opts . clone ( ) ;
473
466
let maybe_sysroot = self . maybe_sysroot . clone ( ) ;
474
467
debug ! ( "Creating test {}: {}" , name, test) ;
475
- let line_number = self . get_line_from_key ( & format ! ( "{}\n {}\n " , original, test) ) ;
476
- let filename = self . filename . clone ( ) ;
477
468
self . tests . push ( testing:: TestDescAndFn {
478
469
desc : testing:: TestDesc {
479
470
name : testing:: DynTestName ( name) ,
0 commit comments