diff options
| author | Predrag Gruevski <obi1kenobi82@gmail.com> | 2025-07-07 00:56:29 +0000 |
|---|---|---|
| committer | Predrag Gruevski <obi1kenobi82@gmail.com> | 2025-07-08 02:02:56 +0000 |
| commit | 717041232ae0ae0ae445a2a302510aab3375ea47 (patch) | |
| tree | 2ab5874b3da52231952b75637b0ffe69f36d1551 /tests/rustdoc-json | |
| parent | a84ab0ce6c4557a2f01a3a6c3fdb0f92098db78d (diff) | |
| download | rust-717041232ae0ae0ae445a2a302510aab3375ea47.tar.gz rust-717041232ae0ae0ae445a2a302510aab3375ea47.zip | |
Don't mark `#[target_feature]` safe fns as unsafe in rustdoc JSON.
Diffstat (limited to 'tests/rustdoc-json')
| -rw-r--r-- | tests/rustdoc-json/attrs/target_feature.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/rustdoc-json/attrs/target_feature.rs b/tests/rustdoc-json/attrs/target_feature.rs index ee2b3235f72..80262d8e332 100644 --- a/tests/rustdoc-json/attrs/target_feature.rs +++ b/tests/rustdoc-json/attrs/target_feature.rs @@ -1,17 +1,40 @@ //@ only-x86_64 //@ is "$.index[?(@.name=='test1')].attrs" '["#[target_feature(enable=\"avx\")]"]' +//@ is "$.index[?(@.name=='test1')].inner.function.header.is_unsafe" false #[target_feature(enable = "avx")] pub fn test1() {} //@ is "$.index[?(@.name=='test2')].attrs" '["#[target_feature(enable=\"avx\", enable=\"avx2\")]"]' +//@ is "$.index[?(@.name=='test1')].inner.function.header.is_unsafe" false #[target_feature(enable = "avx,avx2")] pub fn test2() {} //@ is "$.index[?(@.name=='test3')].attrs" '["#[target_feature(enable=\"avx\", enable=\"avx2\")]"]' +//@ is "$.index[?(@.name=='test1')].inner.function.header.is_unsafe" false #[target_feature(enable = "avx", enable = "avx2")] pub fn test3() {} //@ is "$.index[?(@.name=='test4')].attrs" '["#[target_feature(enable=\"avx\", enable=\"avx2\", enable=\"avx512f\")]"]' +//@ is "$.index[?(@.name=='test1')].inner.function.header.is_unsafe" false #[target_feature(enable = "avx", enable = "avx2,avx512f")] pub fn test4() {} + +//@ is "$.index[?(@.name=='test_unsafe_fn')].attrs" '["#[target_feature(enable=\"avx\")]"]' +//@ is "$.index[?(@.name=='test_unsafe_fn')].inner.function.header.is_unsafe" true +#[target_feature(enable = "avx")] +pub unsafe fn test_unsafe_fn() {} + +pub struct Example; + +impl Example { + //@ is "$.index[?(@.name=='safe_assoc_fn')].attrs" '["#[target_feature(enable=\"avx\")]"]' + //@ is "$.index[?(@.name=='safe_assoc_fn')].inner.function.header.is_unsafe" false + #[target_feature(enable = "avx")] + pub fn safe_assoc_fn() {} + + //@ is "$.index[?(@.name=='unsafe_assoc_fn')].attrs" '["#[target_feature(enable=\"avx\")]"]' + //@ is "$.index[?(@.name=='unsafe_assoc_fn')].inner.function.header.is_unsafe" true + #[target_feature(enable = "avx")] + pub unsafe fn unsafe_assoc_fn() {} +} |
