Skip to content

Commit 593c516

Browse files
committed
Stabilize as_deref and as_deref on Result
1 parent 0bbc558 commit 593c516

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

core/src/result.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ impl<T, E: Into<!>> Result<T, E> {
11451145
}
11461146
}
11471147

1148-
#[unstable(feature = "inner_deref", issue = "50264")]
11491148
impl<T: Deref, E> Result<T, E> {
11501149
/// Converts from `Result<T, E>` (or `&Result<T, E>`) to `Result<&<T as Deref>::Target, &E>`.
11511150
///
@@ -1155,7 +1154,6 @@ impl<T: Deref, E> Result<T, E> {
11551154
/// # Examples
11561155
///
11571156
/// ```
1158-
/// #![feature(inner_deref)]
11591157
/// let x: Result<String, u32> = Ok("hello".to_string());
11601158
/// let y: Result<&str, &u32> = Ok("hello");
11611159
/// assert_eq!(x.as_deref(), y);
@@ -1164,13 +1162,12 @@ impl<T: Deref, E> Result<T, E> {
11641162
/// let y: Result<&str, &u32> = Err(&42);
11651163
/// assert_eq!(x.as_deref(), y);
11661164
/// ```
1165+
#[stable(feature = "inner_deref", since = "1.47.0")]
11671166
pub fn as_deref(&self) -> Result<&T::Target, &E> {
11681167
self.as_ref().map(|t| t.deref())
11691168
}
11701169
}
11711170

1172-
1173-
#[unstable(feature = "inner_deref", issue = "50264")]
11741171
impl<T: DerefMut, E> Result<T, E> {
11751172
/// Converts from `Result<T, E>` (or `&mut Result<T, E>`) to `Result<&mut <T as DerefMut>::Target, &mut E>`.
11761173
///
@@ -1180,7 +1177,6 @@ impl<T: DerefMut, E> Result<T, E> {
11801177
/// # Examples
11811178
///
11821179
/// ```
1183-
/// #![feature(inner_deref)]
11841180
/// let mut s = "HELLO".to_string();
11851181
/// let mut x: Result<String, u32> = Ok("hello".to_string());
11861182
/// let y: Result<&mut str, &mut u32> = Ok(&mut s);
@@ -1191,6 +1187,7 @@ impl<T: DerefMut, E> Result<T, E> {
11911187
/// let y: Result<&mut str, &mut u32> = Err(&mut i);
11921188
/// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
11931189
/// ```
1190+
#[stable(feature = "inner_deref", since = "1.47.0")]
11941191
pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> {
11951192
self.as_mut().map(|t| t.deref_mut())
11961193
}

core/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#![feature(test)]
2727
#![feature(trusted_len)]
2828
#![feature(try_trait)]
29-
#![feature(inner_deref)]
3029
#![feature(slice_internals)]
3130
#![feature(slice_partition_dedup)]
3231
#![feature(int_error_matching)]

proc_macro/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(decl_macro)]
2525
#![feature(extern_types)]
2626
#![feature(in_band_lifetimes)]
27-
#![feature(inner_deref)]
2827
#![feature(negative_impls)]
2928
#![feature(optin_builtin_traits)]
3029
#![feature(restricted_std)]

0 commit comments

Comments
 (0)