-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Target modifiers (special marked options) are recorded in metainfo #133138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+666
−24
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort | ||
// Auxiliary build problems with aarch64-apple: | ||
// Shared library linking cc seems to convert "-m32" flag into -arch armv4t | ||
// Auxiliary build problems with i686-mingw: linker `cc` not found | ||
//@ only-x86 | ||
//@ ignore-windows | ||
//@ ignore-apple | ||
//@ needs-llvm-components: x86 | ||
#![crate_type = "rlib"] | ||
#![no_core] | ||
#![feature(no_core, lang_items, repr_simd)] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
pub fn somefun() {} | ||
|
||
pub struct S; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Cpanic=abort | ||
// Auxiliary build problems with aarch64-apple: | ||
// Shared library linking cc seems to convert "-m32" flag into -arch armv4t | ||
// Auxiliary build problems with i686-mingw: linker `cc` not found | ||
//@ only-x86 | ||
//@ ignore-windows | ||
//@ ignore-apple | ||
//@ needs-llvm-components: x86 | ||
#![crate_type = "rlib"] | ||
#![no_core] | ||
#![feature(no_core, lang_items, repr_simd)] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
pub fn somefun() {} | ||
|
||
pub struct S; |
20 changes: 20 additions & 0 deletions
20
tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true -Cpanic=abort | ||
// Auxiliary build problems with aarch64-apple: | ||
// Shared library linking cc seems to convert "-m32" flag into -arch armv4t | ||
// Auxiliary build problems with i686-mingw: linker `cc` not found | ||
//@ only-x86 | ||
//@ ignore-windows | ||
//@ ignore-apple | ||
//@ needs-llvm-components: x86 | ||
#![crate_type = "rlib"] | ||
#![no_core] | ||
#![feature(no_core, lang_items, repr_simd)] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
pub fn somefun() {} | ||
|
||
pub struct S; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` | ||
--> $DIR/defaults_check.rs:20:1 | ||
| | ||
LL | #![crate_type = "rlib"] | ||
| ^ | ||
| | ||
= help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely | ||
= note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return=` in dependency `default_reg_struct_return` | ||
= help: set `-Zreg-struct-return=` in this crate or `-Zreg-struct-return=true` in `default_reg_struct_return` | ||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Tests that default unspecified target modifier value in dependency crate is ok linked | ||
// with the same value, explicitly specified | ||
//@ aux-crate:default_reg_struct_return=default_reg_struct_return.rs | ||
//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort | ||
jieyouxu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//@ revisions:error ok ok_explicit | ||
//@[ok] compile-flags: | ||
//@[ok_explicit] compile-flags: -Zreg-struct-return=false | ||
//@[error] compile-flags: -Zreg-struct-return=true | ||
|
||
// Auxiliary build problems with aarch64-apple: | ||
// Shared library linking cc seems to convert "-m32" flag into -arch armv4t | ||
// Auxiliary build problems with i686-mingw: linker `cc` not found | ||
//@ only-x86 | ||
//@ ignore-windows | ||
//@ ignore-apple | ||
//@ needs-llvm-components: x86 | ||
//@[ok] build-pass | ||
//@[ok_explicit] build-pass | ||
|
||
#![crate_type = "rlib"] | ||
//[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` | ||
#![no_core] | ||
#![feature(no_core, lang_items, repr_simd)] | ||
|
||
fn foo() { | ||
default_reg_struct_return::somefun(); | ||
} |
2 changes: 2 additions & 0 deletions
2
tests/ui/target_modifiers/incompatible_regparm.allow_no_value.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
error: codegen option `unsafe-allow-abi-mismatch` requires a comma-separated list of strings (C unsafe-allow-abi-mismatch=<value>) | ||
|
13 changes: 13 additions & 0 deletions
13
tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` | ||
--> $DIR/incompatible_regparm.rs:16:1 | ||
| | ||
LL | #![crate_type = "rlib"] | ||
| ^ | ||
| | ||
= help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely | ||
= note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm` | ||
= help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm` | ||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ aux-crate:wrong_regparm=wrong_regparm.rs | ||
//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 -Cpanic=abort | ||
// Auxiliary build problems with aarch64-apple: | ||
// Shared library linking cc seems to convert "-m32" flag into -arch armv4t | ||
// Auxiliary build problems with i686-mingw: linker `cc` not found | ||
//@ only-x86 | ||
//@ ignore-windows | ||
//@ ignore-apple | ||
//@ needs-llvm-components: x86 | ||
//@ revisions:error_generated allow_regparm_mismatch allow_no_value | ||
|
||
//@[allow_regparm_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=regparm | ||
jieyouxu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//@[allow_regparm_mismatch] build-pass | ||
//@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch | ||
|
||
#![crate_type = "rlib"] | ||
//[error_generated]~^ ERROR mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` | ||
#![no_core] | ||
#![feature(no_core, lang_items, repr_simd)] | ||
|
||
fn foo() { | ||
wrong_regparm::somefun(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ aux-crate:wrong_regparm_and_ret=wrong_regparm_and_ret.rs | ||
//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort | ||
// Auxiliary build problems with aarch64-apple: | ||
// Shared library linking cc seems to convert "-m32" flag into -arch armv4t | ||
// Auxiliary build problems with i686-mingw: linker `cc` not found | ||
//@ only-x86 | ||
//@ ignore-windows | ||
//@ ignore-apple | ||
//@ needs-llvm-components: x86 | ||
//@ revisions:two_allowed unknown_allowed | ||
|
||
//@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return | ||
//@[two_allowed] build-pass | ||
//@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true | ||
|
||
#![crate_type = "rlib"] | ||
//[unknown_allowed]~^ ERROR unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` | ||
#![no_core] | ||
#![feature(no_core, lang_items, repr_simd)] | ||
|
||
fn foo() { | ||
wrong_regparm_and_ret::somefun(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` | ||
--> $DIR/two_flags.rs:16:1 | ||
| | ||
LL | #![crate_type = "rlib"] | ||
| ^ | ||
|
||
error: aborting due to 1 previous error | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.