Skip to content

Commit bfb0e8d

Browse files
committed
Fix broken inner_deref doc tests.
1 parent 5a8e915 commit bfb0e8d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/libcore/result.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,7 @@ impl<T: Deref, E> Result<T, E> {
11551155
/// # Examples
11561156
///
11571157
/// ```
1158+
/// #![feature(inner_deref)]
11581159
/// let x: Result<String, u32> = Ok("hello".to_string());
11591160
/// let y: Result<&str, &u32> = Ok("hello");
11601161
/// assert_eq!(x.as_deref(), y);
@@ -1189,12 +1190,15 @@ impl<T: DerefMut, E> Result<T, E> {
11891190
/// # Examples
11901191
///
11911192
/// ```
1193+
/// #![feature(inner_deref)]
1194+
/// let mut s = "HELLO".to_string();
11921195
/// let mut x: Result<String, u32> = Ok("hello".to_string());
1193-
/// let y: Result<&mut str, &mut u32> = Ok("HELLO");
1196+
/// let y: Result<&mut str, &mut u32> = Ok(&mut s);
11941197
/// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
11951198
///
1199+
/// let mut i = 42;
11961200
/// let mut x: Result<String, u32> = Err(42);
1197-
/// let y: Result<&mut str, &mut u32> = Err(&42);
1201+
/// let y: Result<&mut str, &mut u32> = Err(&mut i);
11981202
/// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
11991203
/// ```
12001204
pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> {

0 commit comments

Comments
 (0)