Skip to content

Commit 2d0058a

Browse files
committed
tweak wasm wording
1 parent 01cd6ed commit 2d0058a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/attributes/codegen.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ error to specify a feature for a target architecture that the crate is not
6363
being compiled for.
6464

6565
It is [undefined behavior] to call a function that is compiled with a feature
66-
that is not supported on the current platform the code is running on.
66+
that is not supported on the current platform the code is running on, *except*
67+
if the platform explicitly documents this to be safe.
6768

6869
Functions marked with `target_feature` are not inlined into a context that
6970
does not support the given features. The `#[inline(always)]` attribute may not
@@ -134,9 +135,12 @@ Feature | Implicitly Enables | Description
134135

135136
#### `wasm32` or `wasm64`
136137

137-
Executing code with unsupported features is allowed (i.e., is not UB) on this platform.
138-
Hence this platform allows `#[target_feature]` to be applied to both safe and
139-
[`unsafe` functions][unsafe function].
138+
`#[target_feature]` may be used with both safe and
139+
[`unsafe` functions][unsafe function] on Wasm platforms. It is impossible to
140+
cause undefined behavior via the `#[target_feature]` attribute because
141+
attempting to use instructions unsupported by the Wasm engine will fail at load
142+
time without the risk of being interpreted in a way different from what the
143+
compiler expected.
140144

141145
Feature | Description
142146
------------|-------------------

0 commit comments

Comments
 (0)