File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ trait BuildStd: Sized {
162162 fn build_std ( & mut self , setup : & Setup ) -> & mut Self ;
163163 fn build_std_arg ( & mut self , setup : & Setup , arg : & str ) -> & mut Self ;
164164 fn target_host ( & mut self ) -> & mut Self ;
165+ fn target ( & mut self , target : & str ) -> & mut Self ;
165166}
166167
167168impl BuildStd for Execs {
@@ -181,6 +182,11 @@ impl BuildStd for Execs {
181182 self . arg ( "--target" ) . arg ( rustc_host ( ) ) ;
182183 self
183184 }
185+
186+ fn target ( & mut self , target : & str ) -> & mut Self {
187+ self . arg ( "--target" ) . arg ( target) ;
188+ self
189+ }
184190}
185191
186192#[ cargo_test( build_std_mock) ]
@@ -321,6 +327,33 @@ fn check_core() {
321327 . run ( ) ;
322328}
323329
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+
324357#[ cargo_test( build_std_mock) ]
325358fn depend_same_as_std ( ) {
326359 let setup = setup ( ) ;
You can’t perform that action at this time.
0 commit comments