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