about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/mod.rs
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-07-02 11:12:54 +0200
committerFolkert de Vries <folkert@folkertdev.nl>2025-07-16 23:24:32 +0200
commit9c8ab891876b37aac458a7461d904fe593856745 (patch)
treec45dc07eff1a71859ab5e115649a80338c65355a /compiler/rustc_middle/src/query/mod.rs
parentec0ff720d1a89cb51edd90116c6e70051affa95f (diff)
downloadrust-9c8ab891876b37aac458a7461d904fe593856745.tar.gz
rust-9c8ab891876b37aac458a7461d904fe593856745.zip
use `codegen_instance_attrs` where an instance is (easily) available
Diffstat (limited to 'compiler/rustc_middle/src/query/mod.rs')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 842d118449a..ec9f6d918e2 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -1505,6 +1505,15 @@ rustc_queries! {
         separate_provide_extern
     }
 
+    /// Returns the `CodegenFnAttrs` for the item at `def_id`.
+    ///
+    /// If possible, use `tcx.codegen_instance_attrs` instead. That function takes the
+    /// instance kind into account.
+    ///
+    /// For example, the `#[naked]` attribute should be applied for `InstanceKind::Item`,
+    /// but should not be applied if the instance kind is `InstanceKind::ReifyShim`.
+    /// Using this query would include the attribute regardless of the actual instance
+    /// kind at the call site.
     query codegen_fn_attrs(def_id: DefId) -> &'tcx CodegenFnAttrs {
         desc { |tcx| "computing codegen attributes of `{}`", tcx.def_path_str(def_id) }
         arena_cache