mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Make core::convert::identity a const fn.
This commit is contained in:
committed by
GitHub
parent
c2217b7fb7
commit
71187b7e18
@@ -104,8 +104,9 @@
|
||||
/// assert_eq!(vec![1, 3], filtered);
|
||||
/// ```
|
||||
#[unstable(feature = "convert_id", issue = "0")]
|
||||
#[rustc_const_unstable(feature = "const_convert_id")]
|
||||
#[inline]
|
||||
pub fn identity<T>(x: T) -> T { x }
|
||||
pub const fn identity<T>(x: T) -> T { x }
|
||||
|
||||
/// A cheap reference-to-reference conversion. Used to convert a value to a
|
||||
/// reference value within generic code.
|
||||
|
||||
Reference in New Issue
Block a user