From aba85ff82077f80b6406cbaaf6a54afe6df98332 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 3 Jun 2021 18:56:31 -0700 Subject: Enable rustdoc to document safe wasm intrinsics This commit fixes an issue not found during #84988 where rustdoc is used to document cross-platform intrinsics but it was requiring that functions which use `#[target_feature]` are `unsafe` erroneously, even if they're WebAssembly specific. Rustdoc today, for example, already has a special case where it enables annotations like `#[target_feature(enable = "simd128")]` on platforms other than WebAssembly. The purpose of this commit is to relax the "require all `#[target_feature]` functions are `unsafe`" requirement for all targets whenever rustdoc is running, enabling all targets to fully document other targets, such as WebAssembly, where intrinsics functions aren't always `unsafe`. --- src/test/rustdoc-ui/wasm-safe.rs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/test/rustdoc-ui/wasm-safe.rs (limited to 'src') diff --git a/src/test/rustdoc-ui/wasm-safe.rs b/src/test/rustdoc-ui/wasm-safe.rs new file mode 100644 index 00000000000..80b15ace0ee --- /dev/null +++ b/src/test/rustdoc-ui/wasm-safe.rs @@ -0,0 +1,7 @@ +// check-pass + +#![feature(wasm_target_feature)] + +#[cfg(any(target_arch = "wasm32", doc))] +#[target_feature(enable = "simd128")] +pub fn foo() {} -- cgit 1.4.1-3-g733a5