@@ -197,6 +197,10 @@ pub struct TestProps {
197197 /// Build and use `minicore` as `core` stub for `no_core` tests in cross-compilation scenarios
198198 /// that don't otherwise want/need `-Z build-std`.
199199 pub add_core_stubs : bool ,
200+ /// Whether to show std library source code in error messages and backtraces.
201+ /// When false (default), std source paths are remapped to "/rustc/FAKE_PREFIX".
202+ /// When true, actual std source paths are shown.
203+ pub show_std_source : bool ,
200204 /// Whether line annotatins are required for the given error kind.
201205 pub dont_require_annotations : HashSet < ErrorKind > ,
202206}
@@ -245,6 +249,7 @@ mod directives {
245249 pub const FILECHECK_FLAGS : & ' static str = "filecheck-flags" ;
246250 pub const NO_AUTO_CHECK_CFG : & ' static str = "no-auto-check-cfg" ;
247251 pub const ADD_CORE_STUBS : & ' static str = "add-core-stubs" ;
252+ pub const SHOW_STD_SOURCE : & ' static str = "show-std-source" ;
248253 // This isn't a real directive, just one that is probably mistyped often
249254 pub const INCORRECT_COMPILER_FLAGS : & ' static str = "compiler-flags" ;
250255}
@@ -301,6 +306,7 @@ impl TestProps {
301306 no_auto_check_cfg : false ,
302307 has_enzyme : false ,
303308 add_core_stubs : false ,
309+ show_std_source : false ,
304310 dont_require_annotations : Default :: default ( ) ,
305311 }
306312 }
@@ -588,6 +594,8 @@ impl TestProps {
588594
589595 self . update_add_core_stubs ( ln, config) ;
590596
597+ config. set_name_directive ( ln, SHOW_STD_SOURCE , & mut self . show_std_source ) ;
598+
591599 if let Some ( err_kind) =
592600 config. parse_name_value_directive ( ln, DONT_REQUIRE_ANNOTATIONS )
593601 {
@@ -1027,6 +1035,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
10271035 "rustfix-only-machine-applicable" ,
10281036 "should-fail" ,
10291037 "should-ice" ,
1038+ "show-std-source" ,
10301039 "stderr-per-bitwidth" ,
10311040 "test-mir-pass" ,
10321041 "unique-doc-out-dir" ,
0 commit comments