@@ -169,21 +169,21 @@ of the compilation target and not the host. So `usize` is `32` bits if you are
169
169
compiling against a ` 32 ` bit system, irrelevant of whether you are building on
170
170
a ` 64 ` bit or a ` 32 ` bit system.
171
171
172
- If a ` const fn ` is called outside a "const context", it is indistinguishable
173
- from any other function. You can freely do anything with a ` const fn ` that
172
+ If a const function is called outside a "const context", it is indistinguishable
173
+ from any other function. You can freely do anything with a const function that
174
174
you can do with a regular function.
175
175
176
- ` const fn ` s have various restrictions to makes sure that you cannot define a
177
- ` const fn ` that can't be evaluated at compile-time. It is, for example, not
178
- possible to write a random number generator as a const fn . Calling a
179
- const fn at compile-time will always yield the same result as calling it at
176
+ const functions have various restrictions to makes sure that you cannot define a
177
+ const function that can't be evaluated at compile-time. It is, for example, not
178
+ possible to write a random number generator as a const function . Calling a
179
+ const function at compile-time will always yield the same result as calling it at
180
180
runtime, even when called multiple times. There's one exception to this rule:
181
181
if you are doing complex floating point operations in extreme situations,
182
182
then you might get (very slightly) different results.
183
183
It is adviseable to not make array lengths and enum discriminants depend
184
184
on floating point computations.
185
185
186
- Exhaustive list of permitted structures in ` const fn ` :
186
+ Exhaustive list of permitted structures in const functions :
187
187
188
188
> ** Note** : this list is more restrictive than what you can write in
189
189
> regular constants
@@ -197,21 +197,21 @@ Exhaustive list of permitted structures in `const fn`:
197
197
are all permitted.
198
198
199
199
This rule also applies to type parameters of impl blocks that
200
- contain ` const fn ` methods
200
+ contain const methods
201
201
202
202
* arithmetic and comparison operators on integers
203
203
* all boolean operators except for ` && ` and ` || ` which are banned since
204
204
they are short-circuiting.
205
205
* any kind of aggregate constructor (array, ` struct ` , ` enum ` , tuple, ...)
206
- * calls to other * safe* ` const fn ` s (whether by function call or method call)
206
+ * calls to other * safe* const functions (whether by function call or method call)
207
207
* index expressions on arrays and slices
208
208
* field accesses on structs and tuples
209
209
* reading from constants (but not statics, not even taking a reference to a static)
210
210
* ` & ` and ` * ` (only dereferencing of references, not raw pointers)
211
211
* casts except for raw pointer to integer casts
212
212
* ` const unsafe fn ` is allowed, but the body must consist of safe operations
213
213
only and you won't be able to call the ` const unsafe fn ` from within another
214
- ` const fn ` even if you use ` unsafe `
214
+ const function even if you use ` unsafe `
215
215
216
216
[ IDENTIFIER ] : identifiers.html
217
217
[ RAW_STRING_LITERAL ] : tokens.html#raw-string-literals
0 commit comments