1
- use std:: collections:: HashSet ;
1
+ use std:: collections:: { HashMap , HashSet } ;
2
2
use std:: env;
3
3
use std:: fs:: File ;
4
4
use std:: io:: BufReader ;
@@ -11,6 +11,7 @@ use tracing::*;
11
11
12
12
use crate :: common:: { Config , Debugger , FailMode , Mode , PassMode } ;
13
13
use crate :: debuggers:: { extract_cdb_version, extract_gdb_version} ;
14
+ use crate :: errors:: ErrorKind ;
14
15
use crate :: executor:: { CollectedTestDesc , ShouldPanic } ;
15
16
use crate :: header:: auxiliary:: { AuxProps , parse_and_update_aux} ;
16
17
use crate :: header:: needs:: CachedNeedsConditions ;
@@ -196,6 +197,8 @@ pub struct TestProps {
196
197
/// Build and use `minicore` as `core` stub for `no_core` tests in cross-compilation scenarios
197
198
/// that don't otherwise want/need `-Z build-std`.
198
199
pub add_core_stubs : bool ,
200
+ /// Whether line annotatins are required for the given error kind.
201
+ pub require_annotations : HashMap < ErrorKind , bool > ,
199
202
}
200
203
201
204
mod directives {
@@ -212,6 +215,7 @@ mod directives {
212
215
pub const CHECK_RUN_RESULTS : & ' static str = "check-run-results" ;
213
216
pub const DONT_CHECK_COMPILER_STDOUT : & ' static str = "dont-check-compiler-stdout" ;
214
217
pub const DONT_CHECK_COMPILER_STDERR : & ' static str = "dont-check-compiler-stderr" ;
218
+ pub const DONT_REQUIRE_ANNOTATIONS : & ' static str = "dont-require-annotations" ;
215
219
pub const NO_PREFER_DYNAMIC : & ' static str = "no-prefer-dynamic" ;
216
220
pub const PRETTY_MODE : & ' static str = "pretty-mode" ;
217
221
pub const PRETTY_COMPARE_ONLY : & ' static str = "pretty-compare-only" ;
@@ -297,6 +301,13 @@ impl TestProps {
297
301
no_auto_check_cfg : false ,
298
302
has_enzyme : false ,
299
303
add_core_stubs : false ,
304
+ require_annotations : HashMap :: from ( [
305
+ ( ErrorKind :: Help , true ) ,
306
+ ( ErrorKind :: Note , true ) ,
307
+ ( ErrorKind :: Error , true ) ,
308
+ ( ErrorKind :: Warning , true ) ,
309
+ ( ErrorKind :: Suggestion , false ) ,
310
+ ] ) ,
300
311
}
301
312
}
302
313
@@ -570,6 +581,13 @@ impl TestProps {
570
581
config. set_name_directive ( ln, NO_AUTO_CHECK_CFG , & mut self . no_auto_check_cfg ) ;
571
582
572
583
self . update_add_core_stubs ( ln, config) ;
584
+
585
+ if let Some ( err_kind) =
586
+ config. parse_name_value_directive ( ln, DONT_REQUIRE_ANNOTATIONS )
587
+ {
588
+ self . require_annotations
589
+ . insert ( ErrorKind :: expect_from_user_str ( & err_kind) , false ) ;
590
+ }
573
591
} ,
574
592
) ;
575
593
0 commit comments