File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,48 @@ fn custom_build_env_var_rustc_linker_host_target_env() {
280280 }
281281}
282282
283+ #[ cargo_test]
284+ fn custom_build_invalid_host_config_feature_flag ( ) {
285+ let target = rustc_host ( ) ;
286+ let p = project ( )
287+ . file (
288+ ".cargo/config" ,
289+ & format ! (
290+ r#"
291+ [target.{}]
292+ linker = "/path/to/linker"
293+ "# ,
294+ target
295+ ) ,
296+ )
297+ . file (
298+ "build.rs" ,
299+ r#"
300+ use std::env;
301+
302+ fn main() {
303+ assert!(env::var("RUSTC_LINKER").unwrap().ends_with("/path/to/linker"));
304+ }
305+ "# ,
306+ )
307+ . file ( "src/lib.rs" , "" )
308+ . build ( ) ;
309+
310+ // build.rs should fail due to -Zhost-config being set without -Ztarget-applies-to-host
311+ if cargo_test_support:: is_nightly ( ) {
312+ p. cargo ( "build -Z host-config --target" )
313+ . arg ( & target)
314+ . masquerade_as_nightly_cargo ( )
315+ . with_status ( 101 )
316+ . with_stderr_contains (
317+ "\
318+ error: the -Zhost-config flag requires the -Ztarget-applies-to-host flag to be set
319+ " ,
320+ )
321+ . run ( ) ;
322+ }
323+ }
324+
283325#[ cargo_test]
284326fn custom_build_env_var_rustc_linker_host_target_with_bad_host_config ( ) {
285327 let target = rustc_host ( ) ;
You can’t perform that action at this time.
0 commit comments