This repository was archived by the owner on May 28, 2025. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 9 files changed +43
-104
lines changed 
tests/ui/target_modifiers Expand file tree Collapse file tree 9 files changed +43
-104
lines changed Original file line number Diff line number Diff line change 1- //@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort 
2- // Auxiliary build problems with aarch64-apple: 
3- // Shared library linking cc seems to convert "-m32" flag into -arch armv4t 
4- // Auxiliary build problems with i686-mingw: linker `cc` not found 
5- //@ only-x86 
6- //@ ignore-windows 
7- //@ ignore-apple 
1+ //@ no-prefer-dynamic 
2+ //@ compile-flags: --target i686-unknown-linux-gnu 
83//@ needs-llvm-components: x86 
4+ 
5+ #![ feature( no_core) ]  
96#![ crate_type = "rlib" ]  
107#![ no_core]  
11- #![ feature( no_core,  lang_items,  repr_simd) ]  
12- 
13- #[ lang = "sized" ]  
14- trait  Sized  { } 
15- #[ lang = "copy" ]  
16- trait  Copy  { } 
17- 
18- pub  fn  somefun ( )  { } 
19- 
20- pub  struct  S ; 
Original file line number Diff line number Diff line change 1- //@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Cpanic=abort 
2- // Auxiliary build problems with aarch64-apple: 
3- // Shared library linking cc seems to convert "-m32" flag into -arch armv4t 
4- // Auxiliary build problems with i686-mingw: linker `cc` not found 
5- //@ only-x86 
6- //@ ignore-windows 
7- //@ ignore-apple 
1+ //@ no-prefer-dynamic 
2+ //@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 
83//@ needs-llvm-components: x86 
4+ 
5+ #![ feature( no_core) ]  
96#![ crate_type = "rlib" ]  
107#![ no_core]  
11- #![ feature( no_core,  lang_items,  repr_simd) ]  
12- 
13- #[ lang = "sized" ]  
14- trait  Sized  { } 
15- #[ lang = "copy" ]  
16- trait  Copy  { } 
17- 
18- pub  fn  somefun ( )  { } 
19- 
20- pub  struct  S ; 
Original file line number Diff line number Diff line change 1- //@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true -Cpanic=abort 
2- // Auxiliary build problems with aarch64-apple: 
3- // Shared library linking cc seems to convert "-m32" flag into -arch armv4t 
4- // Auxiliary build problems with i686-mingw: linker `cc` not found 
5- //@ only-x86 
6- //@ ignore-windows 
7- //@ ignore-apple 
1+ //@ no-prefer-dynamic 
2+ //@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true 
83//@ needs-llvm-components: x86 
4+ 
5+ #![ feature( no_core) ]  
96#![ crate_type = "rlib" ]  
107#![ no_core]  
11- #![ feature( no_core,  lang_items,  repr_simd) ]  
12- 
13- #[ lang = "sized" ]  
14- trait  Sized  { } 
15- #[ lang = "copy" ]  
16- trait  Copy  { } 
17- 
18- pub  fn  somefun ( )  { } 
19- 
20- pub  struct  S ; 
Original file line number Diff line number Diff line change 11error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check`
2-   --> $DIR/defaults_check.rs:20 :1
2+   --> $DIR/defaults_check.rs:15 :1
33   |
4- LL | #![crate_type = "rlib" ]
4+ LL | #![feature(no_core) ]
55   | ^
66   |
77   = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
Original file line number Diff line number Diff line change 11// Tests that default unspecified target modifier value in dependency crate is ok linked 
22// with the same value, explicitly specified 
3- //@ aux-crate:default_reg_struct_return=default_reg_struct_return.rs 
3+ 
4+ //@ aux-build:default_reg_struct_return.rs 
45//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort 
5- //@ revisions:error ok ok_explicit 
6+ //@ needs-llvm-components: x86 
7+ 
8+ //@ revisions: ok ok_explicit error 
69//@[ok] compile-flags: 
710//@[ok_explicit] compile-flags: -Zreg-struct-return=false 
811//@[error] compile-flags: -Zreg-struct-return=true 
12+ //@[ok] check-pass 
13+ //@[ok_explicit] check-pass 
914
10- // Auxiliary build problems with aarch64-apple: 
11- // Shared library linking cc seems to convert "-m32" flag into -arch armv4t 
12- // Auxiliary build problems with i686-mingw: linker `cc` not found 
13- //@ only-x86 
14- //@ ignore-windows 
15- //@ ignore-apple 
16- //@ needs-llvm-components: x86 
17- //@[ok] build-pass 
18- //@[ok_explicit] build-pass 
19- 
20- #![ crate_type = "rlib" ]  
15+ #![ feature( no_core) ]  
2116//[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` 
17+ #![ crate_type = "rlib" ]  
2218#![ no_core]  
23- #![ feature( no_core,  lang_items,  repr_simd) ]  
2419
25- fn  foo ( )  { 
26-     default_reg_struct_return:: somefun ( ) ; 
27- } 
20+ extern  crate  default_reg_struct_return; 
Original file line number Diff line number Diff line change 11error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm`
2-   --> $DIR/incompatible_regparm.rs:16 :1
2+   --> $DIR/incompatible_regparm.rs:11 :1
33   |
4- LL | #![crate_type = "rlib" ]
4+ LL | #![feature(no_core) ]
55   | ^
66   |
77   = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
Original file line number Diff line number Diff line change 1- //@ aux-crate:wrong_regparm=wrong_regparm.rs 
2- //@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 -Cpanic=abort 
3- // Auxiliary build problems with aarch64-apple: 
4- // Shared library linking cc seems to convert "-m32" flag into -arch armv4t 
5- // Auxiliary build problems with i686-mingw: linker `cc` not found 
6- //@ only-x86 
7- //@ ignore-windows 
8- //@ ignore-apple 
1+ //@ aux-build:wrong_regparm.rs 
2+ //@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 
93//@ needs-llvm-components: x86 
10- //@ revisions:error_generated allow_regparm_mismatch allow_no_value 
114
5+ //@ revisions:allow_regparm_mismatch allow_no_value error_generated 
126//@[allow_regparm_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=regparm 
13- //@[allow_regparm_mismatch] build-pass 
147//@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch 
8+ //@[error_generated] compile-flags: 
9+ //@[allow_regparm_mismatch] check-pass 
1510
16- #![ crate_type =  "rlib" ]  
11+ #![ feature ( no_core ) ]  
1712//[error_generated]~^ ERROR mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` 
13+ #![ crate_type = "rlib" ]  
1814#![ no_core]  
19- #![ feature( no_core,  lang_items,  repr_simd) ]  
2015
21- fn  foo ( )  { 
22-     wrong_regparm:: somefun ( ) ; 
23- } 
16+ extern  crate  wrong_regparm; 
Original file line number Diff line number Diff line change 1- //@ aux-crate:wrong_regparm_and_ret=wrong_regparm_and_ret.rs 
2- //@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort 
3- // Auxiliary build problems with aarch64-apple: 
4- // Shared library linking cc seems to convert "-m32" flag into -arch armv4t 
5- // Auxiliary build problems with i686-mingw: linker `cc` not found 
6- //@ only-x86 
7- //@ ignore-windows 
8- //@ ignore-apple 
1+ //@ aux-build:wrong_regparm_and_ret.rs 
2+ //@ compile-flags: --target i686-unknown-linux-gnu 
93//@ needs-llvm-components: x86 
10- //@ revisions:two_allowed unknown_allowed 
114
5+ //@ revisions:two_allowed unknown_allowed 
126//@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return 
13- //@[two_allowed] build-pass 
147//@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true 
8+ //@[two_allowed] check-pass 
159
16- #![ crate_type =  "rlib" ]  
10+ #![ feature ( no_core ) ]  
1711//[unknown_allowed]~^ ERROR unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` 
12+ #![ crate_type = "rlib" ]  
1813#![ no_core]  
19- #![ feature( no_core,  lang_items,  repr_simd) ]  
2014
21- fn  foo ( )  { 
22-     wrong_regparm_and_ret:: somefun ( ) ; 
23- } 
15+ extern  crate  wrong_regparm_and_ret; 
Original file line number Diff line number Diff line change 11error: unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag`
2-   --> $DIR/two_flags.rs:16 :1
2+   --> $DIR/two_flags.rs:10 :1
33   |
4- LL | #![crate_type = "rlib" ]
4+ LL | #![feature(no_core) ]
55   | ^
66
77error: aborting due to 1 previous error
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments