Skip to content

Commit

Permalink
Auto merge of #57322 - Centril:stabilize-identity, r=SimonSapin
Browse files Browse the repository at this point in the history
Stabilize core::convert::identity

r? @SimonSapin

fixes #53500

This is waiting for FCP to complete but in the interim it would be good to review.
  • Loading branch information
bors committed Jan 14, 2019
2 parents 1d029c6 + e75dab7 commit 1a3a3df
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 1 addition & 4 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
/// Using `identity` to do nothing among other interesting functions:
///
/// ```rust
/// #![feature(convert_id)]
/// use std::convert::identity;
///
/// fn manipulation(x: u32) -> u32 {
Expand All @@ -69,7 +68,6 @@
/// Using `identity` to get a function that changes nothing in a conditional:
///
/// ```rust
/// #![feature(convert_id)]
/// use std::convert::identity;
///
/// # let condition = true;
Expand All @@ -86,14 +84,13 @@
/// Using `identity` to keep the `Some` variants of an iterator of `Option<T>`:
///
/// ```rust
/// #![feature(convert_id)]
/// use std::convert::identity;
///
/// let iter = vec![Some(1), None, Some(3)].into_iter();
/// let filtered = iter.filter_map(identity).collect::<Vec<_>>();
/// assert_eq!(vec![1, 3], filtered);
/// ```
#[unstable(feature = "convert_id", issue = "53500")]
#[stable(feature = "convert_id", since = "1.33.0")]
#[inline]
pub const fn identity<T>(x: T) -> T { x }

Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/rfc-2306/convert-id-const-with-gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

// compile-pass

#![feature(convert_id)]

fn main() {
const _FOO: u8 = ::std::convert::identity(42u8);
}

0 comments on commit 1a3a3df

Please sign in to comment.