about summary refs log tree commit diff
path: root/compiler/rustc_feature/src
diff options
context:
space:
mode:
authorMatthew Maurer <matthew.r.maurer@gmail.com>2023-12-12 13:37:04 -0800
committerFlorian Schmiderer <florian.schmiderer@posteo.net>2024-06-25 18:23:41 +0200
commit9b0ae75ecc485d668232c9c85f0090fb85668312 (patch)
tree2ad4a6f802fb5eef10f7d15d6fe948a7499b72f8 /compiler/rustc_feature/src
parentac7595fdb1ee2aafecdd99cd8a3e56192639ada6 (diff)
downloadrust-9b0ae75ecc485d668232c9c85f0090fb85668312.tar.gz
rust-9b0ae75ecc485d668232c9c85f0090fb85668312.zip
Support `#[patchable_function_entries]`
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered)

TODO before submission:
* Needs an RFC
* Improve error reporting for malformed attributes
Diffstat (limited to 'compiler/rustc_feature/src')
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs7
-rw-r--r--compiler/rustc_feature/src/unstable.rs3
2 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index c53bf965139..b5f9f2c715f 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -584,6 +584,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
         pointee, Normal, template!(Word), ErrorFollowing,
         EncodeCrossCrate::No, derive_smart_pointer, experimental!(pointee)
     ),
+    
+    // FIXME RFC
+    // `#[patchable_function_entry(prefix(n), entry(n))]`
+    gated!(
+        patchable_function_entry, Normal, template!(List: "prefix(n), entry(n)"), ErrorPreceding,
+        experimental!(patchable_function_entry)
+    ),
 
     // ==========================================================================
     // Internal attributes: Stability, deprecation, and unsafe:
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index 2dfaac8f6e7..796475e766f 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -565,6 +565,9 @@ declare_features! (
     (unstable, offset_of_slice, "CURRENT_RUSTC_VERSION", Some(126151)),
     /// Allows using `#[optimize(X)]`.
     (unstable, optimize_attribute, "1.34.0", Some(54882)),
+    /// Allows specifying nop padding on functions for dynamic patching.
+    // FIXME this needs an RFC #
+    (unstable, patchable_function_entry, "CURRENT_RUSTC_VERSION", Some(9999)),
     /// Allows postfix match `expr.match { ... }`
     (unstable, postfix_match, "1.79.0", Some(121618)),
     /// Allows `use<'a, 'b, A, B>` in `impl Trait + use<...>` for precise capture of generic args.