Skip to content

Commit 41cbeb0

Browse files
authored
Address review comments
1 parent 20221fb commit 41cbeb0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/items/functions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,26 @@ If a `const fn` is called outside a "const context", it is indistinguishable fro
170170

171171
Exhaustive list of permitted structures in `const fn`:
172172

173-
1. type parameters where the parameters have any of the following as part of their bounds (either on `where` or directly on the parameters):
173+
1. type parameters where the parameters only have any of the following as part of their bounds (either on `where` or directly on the parameters):
174174
1. lifetimes
175175
2. `Sized`
176176

177-
This means that `<T: 'a + ?Sized>` and `<T: 'b + Sized>` + `<T>` are all permitted.
177+
This means that `<T: 'a + ?Sized>`, `<T: 'b + Sized>` and `<T>` are all permitted.
178178
Note that `?Sized` is the absence of a constraint when bounds have been fully elaborated
179179
which includes adding implicit `Sized` bounds.
180180
This entails that permitting `Sized` + lifetimes allows the above examples.
181181

182182
This rule also applies to type parameters of items that contain `const fn`s.
183183

184-
2. arithmetic operators on integers
185-
3. boolean operators (except for `&&` and `||` which are banned since they are short-circuiting).
184+
2. arithmetic and comparison operators on integers
185+
3. all boolean operators except for `&&` and `||` which are banned since they are short-circuiting.
186186
4. any kind of aggregate constructor (array, `struct`, `enum`, tuple, ...)
187187
5. calls to other *safe* `const fn`s (methods and functions)
188188
6. index operations on arrays and slices
189189
7. field accesses on structs and tuples
190190
8. reading from constants (but not statics, not even taking a reference to a static)
191191
9. `&` and `*` (only dereferencing of references, not raw pointers)
192-
10. casts except for raw pointer to `usize` casts
192+
10. casts except for raw pointer to integer casts
193193
11. `const unsafe fn` is allowed, but the body must consist of safe operations only and you won't be able to call the `const unsafe fn` from within another `const fn` even if you use `unsafe`
194194

195195
[IDENTIFIER]: identifiers.html

0 commit comments

Comments
 (0)