File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ trait BuildStd: Sized {
164164 fn build_std ( & mut self , setup : & Setup ) -> & mut Self ;
165165 fn build_std_arg ( & mut self , setup : & Setup , arg : & str ) -> & mut Self ;
166166 fn target_host ( & mut self ) -> & mut Self ;
167+ fn target ( & mut self , target : & str ) -> & mut Self ;
167168}
168169
169170impl BuildStd for Execs {
@@ -183,6 +184,11 @@ impl BuildStd for Execs {
183184 self . arg ( "--target" ) . arg ( rustc_host ( ) ) ;
184185 self
185186 }
187+
188+ fn target ( & mut self , target : & str ) -> & mut Self {
189+ self . arg ( "--target" ) . arg ( target) ;
190+ self
191+ }
186192}
187193
188194#[ cargo_test( build_std_mock) ]
@@ -323,6 +329,33 @@ fn check_core() {
323329 . run ( ) ;
324330}
325331
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+
326359#[ cargo_test( build_std_mock) ]
327360fn depend_same_as_std ( ) {
328361 let setup = setup ( ) ;
You can’t perform that action at this time.
0 commit comments