File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ trait BuildStd: Sized {
162
162
fn build_std ( & mut self , setup : & Setup ) -> & mut Self ;
163
163
fn build_std_arg ( & mut self , setup : & Setup , arg : & str ) -> & mut Self ;
164
164
fn target_host ( & mut self ) -> & mut Self ;
165
+ fn target ( & mut self , target : & str ) -> & mut Self ;
165
166
}
166
167
167
168
impl BuildStd for Execs {
@@ -181,6 +182,11 @@ impl BuildStd for Execs {
181
182
self . arg ( "--target" ) . arg ( rustc_host ( ) ) ;
182
183
self
183
184
}
185
+
186
+ fn target ( & mut self , target : & str ) -> & mut Self {
187
+ self . arg ( "--target" ) . arg ( target) ;
188
+ self
189
+ }
184
190
}
185
191
186
192
#[ cargo_test( build_std_mock) ]
@@ -321,6 +327,33 @@ fn check_core() {
321
327
. run ( ) ;
322
328
}
323
329
330
+ #[ cargo_test( build_std_mock) ]
331
+ fn test_std_on_unsupported_target ( ) {
332
+ let setup = setup ( ) ;
333
+
334
+ let p = project ( )
335
+ . file (
336
+ "src/main.rs" ,
337
+ r#"
338
+ fn main() {
339
+ println!("hello");
340
+ }
341
+ "# ,
342
+ )
343
+ . build ( ) ;
344
+
345
+ p. cargo ( "build" )
346
+ . build_std ( & setup)
347
+ . target ( "aarch64-unknown-none" )
348
+ . with_status ( 101 )
349
+ . with_stderr (
350
+ "\
351
+ error: building std is not supported on this target: [..]
352
+ " ,
353
+ )
354
+ . run ( ) ;
355
+ }
356
+
324
357
#[ cargo_test( build_std_mock) ]
325
358
fn depend_same_as_std ( ) {
326
359
let setup = setup ( ) ;
You can’t perform that action at this time.
0 commit comments