File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,14 @@ impl<T> MaybeUninit<T> {
246246 /// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
247247 /// It is your responsibility to make sure `T` gets dropped if it got initialized.
248248 ///
249+ /// # Example
250+ ///
251+ /// ```
252+ /// use std::mem::MaybeUninit;
253+ ///
254+ /// let v: MaybeUninit<Vec<u8>> = MaybeUninit::new(vec![42]);
255+ /// ```
256+ ///
249257 /// [`assume_init`]: MaybeUninit::assume_init
250258 #[ stable( feature = "maybe_uninit" , since = "1.36.0" ) ]
251259 #[ rustc_const_stable( feature = "const_maybe_uninit" , since = "1.36.0" ) ]
@@ -259,9 +267,15 @@ impl<T> MaybeUninit<T> {
259267 /// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
260268 /// It is your responsibility to make sure `T` gets dropped if it got initialized.
261269 ///
262- /// See the [type-level documentation][type ] for some examples.
270+ /// See the [type-level documentation][MaybeUninit ] for some examples.
263271 ///
264- /// [type]: union.MaybeUninit.html
272+ /// # Example
273+ ///
274+ /// ```
275+ /// use std::mem::MaybeUninit;
276+ ///
277+ /// let v: MaybeUninit<String> = MaybeUninit::uninit();
278+ /// ```
265279 #[ stable( feature = "maybe_uninit" , since = "1.36.0" ) ]
266280 #[ rustc_const_stable( feature = "const_maybe_uninit" , since = "1.36.0" ) ]
267281 #[ inline( always) ]
You can’t perform that action at this time.
0 commit comments