@@ -1102,7 +1102,6 @@ impl<T: Default> Option<T> {
1102
1102
}
1103
1103
}
1104
1104
1105
- #[ unstable( feature = "inner_deref" , reason = "newly added" , issue = "50264" ) ]
1106
1105
impl < T : Deref > Option < T > {
1107
1106
/// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.
1108
1107
///
@@ -1114,20 +1113,18 @@ impl<T: Deref> Option<T> {
1114
1113
/// # Examples
1115
1114
///
1116
1115
/// ```
1117
- /// #![feature(inner_deref)]
1118
- ///
1119
1116
/// let x: Option<String> = Some("hey".to_owned());
1120
1117
/// assert_eq!(x.as_deref(), Some("hey"));
1121
1118
///
1122
1119
/// let x: Option<String> = None;
1123
1120
/// assert_eq!(x.as_deref(), None);
1124
1121
/// ```
1122
+ #[ stable( feature = "option_deref" , since = "1.40.0" ) ]
1125
1123
pub fn as_deref ( & self ) -> Option < & T :: Target > {
1126
1124
self . as_ref ( ) . map ( |t| t. deref ( ) )
1127
1125
}
1128
1126
}
1129
1127
1130
- #[ unstable( feature = "inner_deref" , reason = "newly added" , issue = "50264" ) ]
1131
1128
impl < T : DerefMut > Option < T > {
1132
1129
/// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.
1133
1130
///
@@ -1137,14 +1134,13 @@ impl<T: DerefMut> Option<T> {
1137
1134
/// # Examples
1138
1135
///
1139
1136
/// ```
1140
- /// #![feature(inner_deref)]
1141
- ///
1142
1137
/// let mut x: Option<String> = Some("hey".to_owned());
1143
1138
/// assert_eq!(x.as_deref_mut().map(|x| {
1144
1139
/// x.make_ascii_uppercase();
1145
1140
/// x
1146
1141
/// }), Some("HEY".to_owned().as_mut_str()));
1147
1142
/// ```
1143
+ #[ stable( feature = "option_deref" , since = "1.40.0" ) ]
1148
1144
pub fn as_deref_mut ( & mut self ) -> Option < & mut T :: Target > {
1149
1145
self . as_mut ( ) . map ( |t| t. deref_mut ( ) )
1150
1146
}
0 commit comments