207bc77e15
`rustc_codegen_llvm` and `rustc_codegen_gcc` duplicated logic for checking if tied target features were partially enabled. This commit consolidates these checks into `rustc_codegen_ssa` in the `codegen_fn_attrs` query, which also is run pre-monomorphisation for each function, which ensures that this check is run for unused functions, as would be expected.
38 lines
889 B
Rust
38 lines
889 B
Rust
//@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu
|
|
//@ needs-llvm-components: aarch64
|
|
#![feature(no_core, lang_items)]
|
|
#![no_core]
|
|
|
|
#[lang="sized"]
|
|
trait Sized {}
|
|
|
|
pub fn main() {
|
|
#[target_feature(enable = "pacg")]
|
|
//~^ ERROR must all be either enabled or disabled together
|
|
unsafe fn inner() {}
|
|
|
|
unsafe {
|
|
foo();
|
|
bar();
|
|
baz();
|
|
inner();
|
|
}
|
|
}
|
|
|
|
#[target_feature(enable = "paca")]
|
|
//~^ ERROR must all be either enabled or disabled together
|
|
unsafe fn foo() {}
|
|
|
|
#[target_feature(enable = "paca,pacg")]
|
|
unsafe fn bar() {}
|
|
|
|
#[target_feature(enable = "paca")]
|
|
#[target_feature(enable = "pacg")]
|
|
unsafe fn baz() {}
|
|
|
|
// Confirm that functions which do not end up collected for monomorphisation will still error.
|
|
|
|
#[target_feature(enable = "paca")]
|
|
//~^ ERROR must all be either enabled or disabled together
|
|
unsafe fn unused() {}
|