diff options
| author | bors <bors@rust-lang.org> | 2024-11-10 02:52:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-10 02:52:25 +0000 |
| commit | 7660aed73d5233fdd1ff2651fc8a6acab1b61691 (patch) | |
| tree | bb105208b620d54c194a677cf434122f89d28a4f /compiler/rustc_middle/src/query/mod.rs | |
| parent | 303fc0527aea5c7e9bbef97da926639e1ade3399 (diff) | |
| parent | c8b76bcf58298cced4ef3ca9dd823eb318fc11f5 (diff) | |
| download | rust-7660aed73d5233fdd1ff2651fc8a6acab1b61691.tar.gz rust-7660aed73d5233fdd1ff2651fc8a6acab1b61691.zip | |
Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errors
Emit warning when calling/declaring functions with unavailable vectors. On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558 r? RalfJung
Diffstat (limited to 'compiler/rustc_middle/src/query/mod.rs')
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 8ae89ea6e2c..54ead9a7a75 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2325,6 +2325,14 @@ rustc_queries! { desc { "whether the item should be made inlinable across crates" } separate_provide_extern } + + /// Check the signature of this function as well as all the call expressions inside of it + /// to ensure that any target features required by the ABI are enabled. + /// Should be called on a fully monomorphized instance. + query check_feature_dependent_abi(key: ty::Instance<'tcx>) { + desc { "check for feature-dependent ABI" } + cache_on_disk_if { true } + } } rustc_query_append! { define_callbacks! } |
