From: bors Date: Mon, 5 Jun 2017 21:42:19 +0000 (+0000) Subject: Auto merge of #42452 - raphlinus:mx_job_default, r=alexcrichton X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ae7920153331f26f2bc144f62082e95e74c2ba31;hp=4e2a43f323a87e751b1cc1eaffe4e72eb200146f;p=rust.git Auto merge of #42452 - raphlinus:mx_job_default, r=alexcrichton [fuchsia] Track change of mx_job_default The implementation of mx_job_default changed from a macro which accessed the __magenta_job_default global variable to a proper function call. This patch tracks that change. --- diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 0de52b6696f..a662e4b1f4f 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -191,13 +191,16 @@ impl<'a, B: ?Sized> Cow<'a, B> /// # Examples /// /// ``` + /// use std::ascii::AsciiExt; /// use std::borrow::Cow; /// - /// let mut cow: Cow<[_]> = Cow::Owned(vec![1, 2, 3]); + /// let mut cow = Cow::Borrowed("foo"); + /// cow.to_mut().make_ascii_uppercase(); /// - /// let hello = cow.to_mut(); - /// - /// assert_eq!(hello, &[1, 2, 3]); + /// assert_eq!( + /// cow, + /// Cow::Owned(String::from("FOO")) as Cow + /// ); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn to_mut(&mut self) -> &mut ::Owned { @@ -219,14 +222,33 @@ pub fn to_mut(&mut self) -> &mut ::Owned { /// /// # Examples /// + /// Calling `into_owned` on a `Cow::Borrowed` clones the underlying data + /// and becomes a `Cow::Owned`: + /// /// ``` /// use std::borrow::Cow; /// - /// let cow: Cow<[_]> = Cow::Owned(vec![1, 2, 3]); + /// let s = "Hello world!"; + /// let cow = Cow::Borrowed(s); + /// + /// assert_eq!( + /// cow.into_owned(), + /// Cow::Owned(String::from(s)) + /// ); + /// ``` + /// + /// Calling `into_owned` on a `Cow::Owned` is a no-op: + /// + /// ``` + /// use std::borrow::Cow; /// - /// let hello = cow.into_owned(); + /// let s = "Hello world!"; + /// let cow: Cow = Cow::Owned(String::from(s)); /// - /// assert_eq!(vec![1, 2, 3], hello); + /// assert_eq!( + /// cow.into_owned(), + /// Cow::Owned(String::from(s)) + /// ); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn into_owned(self) -> ::Owned {