@@ -218,6 +218,9 @@ pub struct TestProps {
218
218
pub filecheck_flags : Vec < String > ,
219
219
/// Don't automatically insert any `--check-cfg` args
220
220
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 ,
221
224
}
222
225
223
226
mod directives {
@@ -263,6 +266,7 @@ mod directives {
263
266
pub const LLVM_COV_FLAGS : & ' static str = "llvm-cov-flags" ;
264
267
pub const FILECHECK_FLAGS : & ' static str = "filecheck-flags" ;
265
268
pub const NO_AUTO_CHECK_CFG : & ' static str = "no-auto-check-cfg" ;
269
+ pub const USE_MINICORE : & ' static str = "use-minicore" ;
266
270
// This isn't a real directive, just one that is probably mistyped often
267
271
pub const INCORRECT_COMPILER_FLAGS : & ' static str = "compiler-flags" ;
268
272
}
@@ -322,6 +326,7 @@ impl TestProps {
322
326
llvm_cov_flags : vec ! [ ] ,
323
327
filecheck_flags : vec ! [ ] ,
324
328
no_auto_check_cfg : false ,
329
+ use_minicore : false ,
325
330
}
326
331
}
327
332
@@ -597,6 +602,8 @@ impl TestProps {
597
602
}
598
603
599
604
config. set_name_directive ( ln, NO_AUTO_CHECK_CFG , & mut self . no_auto_check_cfg ) ;
605
+
606
+ self . update_use_minicore ( ln, config) ;
600
607
} ,
601
608
) ;
602
609
@@ -710,6 +717,17 @@ impl TestProps {
710
717
pub fn local_pass_mode ( & self ) -> Option < PassMode > {
711
718
self . pass_mode
712
719
}
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
+ }
713
731
}
714
732
715
733
/// Extract an `(Option<line_revision>, directive)` directive from a line if comment is present.
0 commit comments