@@ -231,6 +231,11 @@ fn run_test(
231
231
}
232
232
let output = miri. output ( ) . expect ( "could not execute miri" ) ;
233
233
let mut errors = config. mode . ok ( output. status ) ;
234
+ // Always remove annotation comments from stderr.
235
+ let annotations = Regex :: new ( r"\s*//~.*" ) . unwrap ( ) ;
236
+ let stderr = std:: str:: from_utf8 ( & output. stderr ) . unwrap ( ) ;
237
+ let stderr = annotations. replace_all ( stderr, "" ) ;
238
+ let stdout = std:: str:: from_utf8 ( & output. stdout ) . unwrap ( ) ;
234
239
// Check output files (if any)
235
240
let revised = |extension : & str | {
236
241
if revision. is_empty ( ) {
@@ -241,7 +246,7 @@ fn run_test(
241
246
} ;
242
247
// Check output files against actual output
243
248
check_output (
244
- & output . stderr ,
249
+ & stderr,
245
250
path,
246
251
& mut errors,
247
252
revised ( "stderr" ) ,
@@ -251,7 +256,7 @@ fn run_test(
251
256
comments,
252
257
) ;
253
258
check_output (
254
- & output . stdout ,
259
+ & stdout,
255
260
path,
256
261
& mut errors,
257
262
revised ( "stdout" ) ,
@@ -261,21 +266,17 @@ fn run_test(
261
266
comments,
262
267
) ;
263
268
// Check error annotations in the source against output
264
- check_annotations ( & output . stderr , & mut errors, config, revision, comments) ;
269
+ check_annotations ( & stderr, & mut errors, config, revision, comments) ;
265
270
( miri, errors)
266
271
}
267
272
268
273
fn check_annotations (
269
- unnormalized_stderr : & [ u8 ] ,
274
+ unnormalized_stderr : & str ,
270
275
errors : & mut Errors ,
271
276
config : & Config ,
272
277
revision : & str ,
273
278
comments : & Comments ,
274
279
) {
275
- let unnormalized_stderr = std:: str:: from_utf8 ( unnormalized_stderr) . unwrap ( ) ;
276
- // erase annotations from the stderr so they don't match themselves
277
- let annotations = Regex :: new ( r"\s*//~.*" ) . unwrap ( ) ;
278
- let unnormalized_stderr = annotations. replace ( unnormalized_stderr, "" ) ;
279
280
let mut found_annotation = false ;
280
281
if let Some ( ( ref error_pattern, definition_line) ) = comments. error_pattern {
281
282
if !unnormalized_stderr. contains ( error_pattern) {
@@ -313,7 +314,7 @@ fn check_annotations(
313
314
}
314
315
315
316
fn check_output (
316
- output : & [ u8 ] ,
317
+ output : & str ,
317
318
path : & Path ,
318
319
errors : & mut Errors ,
319
320
kind : String ,
@@ -322,7 +323,6 @@ fn check_output(
322
323
config : & Config ,
323
324
comments : & Comments ,
324
325
) {
325
- let output = std:: str:: from_utf8 ( & output) . unwrap ( ) ;
326
326
let output = normalize ( path, output, filters, comments) ;
327
327
let path = output_path ( path, comments, kind, target) ;
328
328
match config. output_conflict_handling {
0 commit comments