Make core::convert::identity a const fn.

This commit is contained in:
Mazdak Farrokhzad
2018-08-19 18:49:31 +02:00
committed by GitHub
parent c2217b7fb7
commit 71187b7e18
+2 -1
View File
@@ -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.