@@ -63,7 +63,8 @@ error to specify a feature for a target architecture that the crate is not
63
63
being compiled for.
64
64
65
65
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.
67
68
68
69
Functions marked with ` target_feature ` are not inlined into a context that
69
70
does not support the given features. The ` #[inline(always)] ` attribute may not
@@ -75,7 +76,8 @@ The following is a list of the available feature names.
75
76
76
77
#### ` x86 ` or ` x86_64 `
77
78
78
- This platform requires that ` #[target_feature] ` is only applied to [ ` unsafe `
79
+ Executing code with unsupported features is undefined behavior on this platform.
80
+ Hence this platform requires that ` #[target_feature] ` is only applied to [ ` unsafe `
79
81
functions] [ unsafe function ] .
80
82
81
83
Feature | Implicitly Enables | Description
@@ -133,8 +135,12 @@ Feature | Implicitly Enables | Description
133
135
134
136
#### ` wasm32 ` or ` wasm64 `
135
137
136
- This platform allows ` #[target_feature] ` to be applied to both safe and
137
- [ ` 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.
138
144
139
145
Feature | Description
140
146
------------|-------------------
0 commit comments