@@ -218,6 +218,9 @@ pub struct TestProps {
218218 pub filecheck_flags : Vec < String > ,
219219 /// Don't automatically insert any `--check-cfg` args
220220 pub no_auto_check_cfg : bool ,
221+ /// Build and use minicore as std/core stub for tests in cross-compilation scenarios that don't
222+ /// otherwise need `-Z build-std`.
223+ pub use_minicore : bool ,
221224}
222225
223226mod directives {
@@ -263,6 +266,7 @@ mod directives {
263266 pub const LLVM_COV_FLAGS : & ' static str = "llvm-cov-flags" ;
264267 pub const FILECHECK_FLAGS : & ' static str = "filecheck-flags" ;
265268 pub const NO_AUTO_CHECK_CFG : & ' static str = "no-auto-check-cfg" ;
269+ pub const USE_MINICORE : & ' static str = "use-minicore" ;
266270 // This isn't a real directive, just one that is probably mistyped often
267271 pub const INCORRECT_COMPILER_FLAGS : & ' static str = "compiler-flags" ;
268272}
@@ -322,6 +326,7 @@ impl TestProps {
322326 llvm_cov_flags : vec ! [ ] ,
323327 filecheck_flags : vec ! [ ] ,
324328 no_auto_check_cfg : false ,
329+ use_minicore : false ,
325330 }
326331 }
327332
@@ -597,6 +602,8 @@ impl TestProps {
597602 }
598603
599604 config. set_name_directive ( ln, NO_AUTO_CHECK_CFG , & mut self . no_auto_check_cfg ) ;
605+
606+ self . update_use_minicore ( ln, config) ;
600607 } ,
601608 ) ;
602609
@@ -710,6 +717,17 @@ impl TestProps {
710717 pub fn local_pass_mode ( & self ) -> Option < PassMode > {
711718 self . pass_mode
712719 }
720+
721+ pub fn update_use_minicore ( & mut self , ln : & str , config : & Config ) {
722+ let use_minicore = config. parse_name_directive ( ln, directives:: USE_MINICORE ) ;
723+ if use_minicore {
724+ if !matches ! ( config. mode, Mode :: Ui | Mode :: Codegen | Mode :: Assembly ) {
725+ panic ! ( "`use-minicore` is only supported for ui, codegen and assembly test modes" ) ;
726+ }
727+
728+ self . use_minicore = use_minicore;
729+ }
730+ }
713731}
714732
715733/// Extract an `(Option<line_revision>, directive)` directive from a line if comment is present.
0 commit comments