diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-04-13 23:57:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-13 23:57:40 -0400 |
| commit | 4a1d0cd1bd1d551e615e63b2e27a4aac46af8da8 (patch) | |
| tree | 540a8f792cf2a3731ee09149c6287ad82e8d148d /tests/codegen | |
| parent | c0ad72ef6ac8d78e777765967be1f7b07d7fb663 (diff) | |
| parent | f472cc8cd4c57687aac38fe3589818f1cc7956ba (diff) | |
| download | rust-4a1d0cd1bd1d551e615e63b2e27a4aac46af8da8.tar.gz rust-4a1d0cd1bd1d551e615e63b2e27a4aac46af8da8.zip | |
Rollup merge of #139718 - folkertdev:unsafe-attributes-earlier-editions, r=fmease
enforce unsafe attributes in pre-2024 editions by default New unsafe attributes should emit an error when used without the `unsafe(...)` in all editions. The `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions. The only attributes for which this change is relevant right now are `#[ffi_const]` and `#[ffi_pure]`. This change is required for making `#[unsafe(naked)]` sound in pre-2024 editions.
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/cffi/ffi-const.rs | 2 | ||||
| -rw-r--r-- | tests/codegen/cffi/ffi-pure.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/codegen/cffi/ffi-const.rs b/tests/codegen/cffi/ffi-const.rs index 6c90902e89f..3ea9d517ec2 100644 --- a/tests/codegen/cffi/ffi-const.rs +++ b/tests/codegen/cffi/ffi-const.rs @@ -10,6 +10,6 @@ extern "C" { // CHECK-LABEL: declare{{.*}}void @foo() // CHECK-SAME: [[ATTRS:#[0-9]+]] // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}memory(none){{.*}} } - #[ffi_const] + #[unsafe(ffi_const)] pub fn foo(); } diff --git a/tests/codegen/cffi/ffi-pure.rs b/tests/codegen/cffi/ffi-pure.rs index 2c5d5f5b4b1..a61e80ecf65 100644 --- a/tests/codegen/cffi/ffi-pure.rs +++ b/tests/codegen/cffi/ffi-pure.rs @@ -10,6 +10,6 @@ extern "C" { // CHECK-LABEL: declare{{.*}}void @foo() // CHECK-SAME: [[ATTRS:#[0-9]+]] // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}memory(read){{.*}} } - #[ffi_pure] + #[unsafe(ffi_pure)] pub fn foo(); } |
