未验证 提交 71187b7e 编写于 作者: M Mazdak Farrokhzad 提交者: GitHub

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

上级 c2217b7f
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册