diff options
| author | Matthew Maurer <matthew.r.maurer@gmail.com> | 2023-12-12 13:37:04 -0800 |
|---|---|---|
| committer | Florian Schmiderer <florian.schmiderer@posteo.net> | 2024-06-25 18:23:41 +0200 |
| commit | 9b0ae75ecc485d668232c9c85f0090fb85668312 (patch) | |
| tree | 2ad4a6f802fb5eef10f7d15d6fe948a7499b72f8 /tests/codegen/patchable-function-entry.rs | |
| parent | ac7595fdb1ee2aafecdd99cd8a3e56192639ada6 (diff) | |
| download | rust-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 'tests/codegen/patchable-function-entry.rs')
| -rw-r--r-- | tests/codegen/patchable-function-entry.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/codegen/patchable-function-entry.rs b/tests/codegen/patchable-function-entry.rs index f06739303d2..dc20c0a2c6d 100644 --- a/tests/codegen/patchable-function-entry.rs +++ b/tests/codegen/patchable-function-entry.rs @@ -1,8 +1,28 @@ +#![feature(patchable_function_entry)] // compile-flags: -Z patchable-function-entry=15,10 #![crate_type = "lib"] +// This should have the default, as set by the compile flags #[no_mangle] pub fn foo() {} + +// The attribute should override the compile flags +#[no_mangle] +#[patchable_function_entry(prefix(1), entry(2))] +pub fn bar() {} + +// If we override an attribute to 0 or unset, the attribute should go away +#[no_mangle] +#[patchable_function_entry(entry(0))] +pub fn baz() {} + // CHECK: @foo() unnamed_addr #0 +// CHECK: @bar() unnamed_addr #1 +// CHECK: @baz() unnamed_addr #2 + // CHECK: attributes #0 = { {{.*}}"patchable-function-entry"="5"{{.*}}"patchable-function-prefix"="10" {{.*}} } +// CHECK: attributes #1 = { {{.*}}"patchable-function-entry"="2"{{.*}}"patchable-function-prefix"="1" {{.*}} } +// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-entry{{.*}} } +// CHECK-NOT: attributes #2 = { {{.*}}patchable-function-prefix{{.*}} } +// CHECK: attributes #2 = { {{.*}} } |
