Skip to content

Commit 1c8c20c

Browse files
committed
rfc, convert_id: made the function const as it should be.
1 parent 1cfc8fd commit 1c8c20c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

text/0000-convert-id.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Summary
77
[summary]: #summary
88

9-
Adds an identity function `pub fn identity<T>(x: T) -> T { x }` as
9+
Adds an identity function `pub const fn identity<T>(x: T) -> T { x }` as
1010
`core::convert::identity`. The function is also re-exported to
1111
`std::convert::identity` as well as the prelude of
1212
both libcore and libstd.
@@ -148,7 +148,7 @@ all `Sized` types in Rust into libcore at the module `core::convert` and
148148
defines it as:
149149

150150
```rust
151-
pub fn identity<T>(x: T) -> T { x }
151+
pub const fn identity<T>(x: T) -> T { x }
152152
```
153153

154154
This function is also re-exported to `std::convert::identity` as well as
@@ -160,8 +160,8 @@ moved since Rust uses move semantics by default.
160160
# Reference-level explanation
161161
[reference-level-explanation]: #reference-level-explanation
162162

163-
An identity function defined as `pub fn identity<T>(x: T) -> T { x }` exists as
164-
`core::convert::identity`. The function is also re-exported as
163+
An identity function defined as `pub const fn identity<T>(x: T) -> T { x }`
164+
exists as `core::convert::identity`. The function is also re-exported as
165165
`std::convert::identity` as well as the prelude of both libcore and libstd.
166166

167167
Note that the identity function is not always equivalent to a closure

0 commit comments

Comments
 (0)