From ac8892bdb227e135ed7e5c3f8bb34b6b031a4579 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 25 Apr 2017 16:08:14 +0200 Subject: [PATCH 01/15] Accept arbitrary filenames into URLs in build-manifest instead of combining the component and target into a URL. --- src/tools/build-manifest/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index a8cb30da43513..c6f6b2dbc0f21 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -293,7 +293,7 @@ impl Builder { pkg.target.insert(host.to_string(), Target { available: true, - url: Some(self.url("rust", host)), + url: Some(self.url(&filename)), hash: Some(digest), components: Some(components), extensions: Some(extensions), @@ -325,7 +325,7 @@ impl Builder { (name.to_string(), Target { available: true, - url: Some(self.url(pkgname, name)), + url: Some(self.url(&filename)), hash: Some(digest), components: None, extensions: None, @@ -338,11 +338,11 @@ impl Builder { }); } - fn url(&self, component: &str, target: &str) -> String { + fn url(&self, filename: &str) -> String { format!("{}/{}/{}", self.s3_address, self.date, - self.filename(component, target)) + filename) } fn filename(&self, component: &str, target: &str) -> String { From 5439c9b4ec975083cb1bc2000a5faa21f737997a Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 25 Apr 2017 16:11:18 +0200 Subject: [PATCH 02/15] Define the unavailable target just once and re-use it The same unavailable target value is used in two different places. Abstracting it makes it easier to update it and recognise its purpose. --- src/tools/build-manifest/src/main.rs | 30 +++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index c6f6b2dbc0f21..574af1246361d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -120,6 +120,18 @@ struct Target { extensions: Option>, } +impl Target { + fn unavailable() -> Target { + Target { + available: false, + url: None, + hash: None, + components: None, + extensions: None, + } + } +} + #[derive(RustcEncodable)] struct Component { pkg: String, @@ -242,13 +254,7 @@ impl Builder { let digest = match self.digests.remove(&filename) { Some(digest) => digest, None => { - pkg.target.insert(host.to_string(), Target { - available: false, - url: None, - hash: None, - components: None, - extensions: None, - }); + pkg.target.insert(host.to_string(), Target::unavailable()); continue } }; @@ -312,15 +318,7 @@ impl Builder { let filename = self.filename(pkgname, name); let digest = match self.digests.remove(&filename) { Some(digest) => digest, - None => { - return (name.to_string(), Target { - available: false, - url: None, - hash: None, - components: None, - extensions: None, - }) - } + None => return (name.to_string(), Target::unavailable()), }; (name.to_string(), Target { From 08514b4376eda86f2c05d91334333ebf8caad064 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Tue, 25 Apr 2017 17:22:34 -0500 Subject: [PATCH 03/15] rewrote the thread struct docs --- src/libstd/thread/mod.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index e37cc7e963e10..98452a396aae7 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -713,22 +713,27 @@ struct Inner { #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] -/// A handle to a thread. +/// A handle to a thread, its just an abstract reference and as such +/// it can be used to identify a thread (by name, for example). In most +/// usage cases, this struct is not used directly. /// /// # Examples /// /// ``` /// use std::thread; /// -/// let handler = thread::Builder::new() -/// .name("foo".into()) +/// for i in 0..5 { +/// let thread_name = format!("thread_{}", i); +/// thread::Builder::new() +/// .name(thread_name) // Now you can identify which thread panicked +/// // thanks to the handle's name /// .spawn(|| { -/// let thread = thread::current(); -/// println!("thread name: {}", thread.name().unwrap()); +/// if i == 3 { +/// panic!("I'm scared!!!"); +/// } /// }) /// .unwrap(); -/// -/// handler.join().unwrap(); +/// } /// ``` pub struct Thread { inner: Arc, From bdb6bb9684e5cc874d69d6cd65be3d9fb1e64401 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Wed, 26 Apr 2017 00:57:59 -0500 Subject: [PATCH 04/15] added move --- src/libstd/thread/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 98452a396aae7..aa7ef2da0aea8 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -727,7 +727,7 @@ struct Inner { /// thread::Builder::new() /// .name(thread_name) // Now you can identify which thread panicked /// // thanks to the handle's name -/// .spawn(|| { +/// .spawn(move || { /// if i == 3 { /// panic!("I'm scared!!!"); /// } From cf521211a13ccb7e8ea25af97d0efc3abe6d9070 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Wed, 26 Apr 2017 11:54:17 -0500 Subject: [PATCH 05/15] restructured docs for thread and added links --- src/libstd/thread/mod.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index aa7ef2da0aea8..4e49c485f109f 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -713,28 +713,34 @@ struct Inner { #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] -/// A handle to a thread, its just an abstract reference and as such -/// it can be used to identify a thread (by name, for example). In most -/// usage cases, this struct is not used directly. +/// A handle to a thread. +/// +/// You can use it to identify a thread (by name, for example). Most of the +/// time, there is no need to directly create a `Thread` struct using the +/// constructor, instead you should use a function like `spawn` to create +/// new threads, see the docs of [`Builder`] and [`spawn`] for more. /// /// # Examples /// /// ``` -/// use std::thread; +/// use std::thread::Builder; /// /// for i in 0..5 { /// let thread_name = format!("thread_{}", i); -/// thread::Builder::new() -/// .name(thread_name) // Now you can identify which thread panicked -/// // thanks to the handle's name -/// .spawn(move || { -/// if i == 3 { -/// panic!("I'm scared!!!"); -/// } -/// }) -/// .unwrap(); +/// Builder::new() +/// .name(thread_name) // Now you can identify which thread panicked +/// // thanks to the handle's name +/// .spawn(move || { +/// if i == 3 { +/// panic!("I'm scared!!!"); +/// } +/// }) +/// .unwrap(); /// } /// ``` +/// [`Builder`]: ../../std/thread/struct.Builder.html +/// [`spawn`]: ../../std/thread/fn.spawn.html + pub struct Thread { inner: Arc, } From b1ab145ec265aaa9b6cc9978ae1ef222cdf9e018 Mon Sep 17 00:00:00 2001 From: Martin Hafskjold Thoresen Date: Tue, 2 May 2017 21:12:27 +0200 Subject: [PATCH 06/15] Fix up @martinhath's mailmap entry --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index 4b4f343d15a9d..ee5b6f257b555 100644 --- a/.mailmap +++ b/.mailmap @@ -139,6 +139,7 @@ Margaret Meyerhofer Mark Sinclair Mark Sinclair =Mark Sinclair <=125axel125@gmail.com> Markus Westerlind Markus +Martin Hafskjold Thoresen Matej Lach Matej Ľach Matt Brubeck Matthew Auld From aa10fce346e1a19f4badb22a6bb8a240c1fd53db Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 2 May 2017 23:55:40 -0400 Subject: [PATCH 07/15] Update Duration::from_secs doc example to show underlying values. --- src/libstd/time/duration.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index af7eaeb3106b2..bd8c1fac2dba9 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -84,7 +84,10 @@ impl Duration { /// ``` /// use std::time::Duration; /// - /// let five_seconds = Duration::from_secs(5); + /// let duration = Duration::from_secs(5); + /// + /// assert_eq!(5, duration.as_secs()); + /// assert_eq!(0, duration.subsec_nanos()); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] From ee8ad8eb2e38092096d241f5c2a9df369029497c Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 2 May 2017 23:56:29 -0400 Subject: [PATCH 08/15] Update Duration::from_millis doc example to show underlying values. --- src/libstd/time/duration.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index bd8c1fac2dba9..268ce733fa314 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -102,7 +102,10 @@ impl Duration { /// ``` /// use std::time::Duration; /// - /// let five_seconds = Duration::from_millis(5000); + /// let duration = Duration::from_millis(2569); + /// + /// assert_eq!(2, duration.as_secs()); + /// assert_eq!(569000000, duration.subsec_nanos()); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] From bdd8e7ffe6cb1cdf100b9ca071e826f153371245 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 2 May 2017 23:58:39 -0400 Subject: [PATCH 09/15] Update Duration::as_secs doc example to demonstrate truncation. --- src/libstd/time/duration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 268ce733fa314..4f8f9c36ec76d 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -125,8 +125,8 @@ impl Duration { /// ``` /// use std::time::Duration; /// - /// let five_seconds = Duration::new(5, 0); - /// assert_eq!(five_seconds.as_secs(), 5); + /// let duration = Duration::new(5, 730023852); + /// assert_eq!(duration.as_secs(), 5); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] From a3e8f3622f62022d98c2df1f096f4ef88efb6386 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 3 May 2017 00:04:59 -0400 Subject: [PATCH 10/15] Add doc example for how to determine total number of secs in Duration. --- src/libstd/time/duration.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 4f8f9c36ec76d..55766ba3fed6a 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -128,6 +128,21 @@ impl Duration { /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_secs(), 5); /// ``` + /// + /// To determine the total number of seconds represented by the `Duration`, + /// use `as_secs` in combination with [`subsec_nanos`]: + /// + /// ``` + /// use std::time::Duration; + /// + /// let duration = Duration::new(5, 730023852); + /// + /// assert_eq!(5.730023852, + /// duration.as_secs() as f64 + /// + duration.subsec_nanos() as f64 * 1e-9); + /// ``` + /// + /// [`subsec_nanos`]: #method.subsec_nanos #[stable(feature = "duration", since = "1.3.0")] #[inline] pub fn as_secs(&self) -> u64 { self.secs } From 28a4f57dd0161d7602aed0005ebeddaa5e646367 Mon Sep 17 00:00:00 2001 From: Michael Gattozzi Date: Wed, 3 May 2017 01:13:18 -0400 Subject: [PATCH 11/15] Update ChildStdin/ChildStdout docs to be clearer --- src/libstd/process.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 23ebeb4b8e3fc..3896fc20a2dde 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -148,8 +148,9 @@ impl fmt::Debug for Child { } } -/// A handle to a child process's stdin. This struct is used in the [`stdin`] -/// field on [`Child`]. +/// A handle to a child process's stdin. +/// +/// This struct is used in the [`stdin`] field on [`Child`]. /// /// [`Child`]: struct.Child.html /// [`stdin`]: struct.Child.html#structfield.stdin @@ -190,8 +191,9 @@ impl fmt::Debug for ChildStdin { } } -/// A handle to a child process's stdout. This struct is used in the [`stdout`] -/// field on [`Child`]. +/// A handle to a child process's stdout. +/// +/// This struct is used in the [`stdout`] field on [`Child`]. /// /// [`Child`]: struct.Child.html /// [`stdout`]: struct.Child.html#structfield.stdout From 5dfa08ee1be4cf6485ed6ece0c2b08be394ab8c6 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 25 Apr 2017 16:14:28 +0200 Subject: [PATCH 12/15] Emit information about XZ packages in manifest --- src/rust-installer | 2 +- src/tools/build-manifest/src/main.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/rust-installer b/src/rust-installer index 4f994850808a5..4cf7397fb0566 160000 --- a/src/rust-installer +++ b/src/rust-installer @@ -1 +1 @@ -Subproject commit 4f994850808a572e2cc8d43f968893c8e942e9bf +Subproject commit 4cf7397fb0566e745f0bce4c5b009cfeb5d12c53 diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 574af1246361d..ba37863b1f62d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -116,6 +116,8 @@ struct Target { available: bool, url: Option, hash: Option, + xz_url: Option, + xz_hash: Option, components: Option>, extensions: Option>, } @@ -126,6 +128,8 @@ impl Target { available: false, url: None, hash: None, + xz_url: None, + xz_hash: None, components: None, extensions: None, } @@ -258,6 +262,8 @@ impl Builder { continue } }; + let xz_filename = filename.replace(".tar.gz", ".tar.xz"); + let xz_digest = self.digests.remove(&xz_filename); let mut components = Vec::new(); let mut extensions = Vec::new(); @@ -301,6 +307,8 @@ impl Builder { available: true, url: Some(self.url(&filename)), hash: Some(digest), + xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)), + xz_hash: xz_digest, components: Some(components), extensions: Some(extensions), }); @@ -320,11 +328,15 @@ impl Builder { Some(digest) => digest, None => return (name.to_string(), Target::unavailable()), }; + let xz_filename = filename.replace(".tar.gz", ".tar.xz"); + let xz_digest = self.digests.remove(&xz_filename); (name.to_string(), Target { available: true, url: Some(self.url(&filename)), hash: Some(digest), + xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)), + xz_hash: xz_digest, components: None, extensions: None, }) From 5e522d73a3664bbfd0ec5a9ad4efee4165c35d37 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 2 May 2017 01:42:30 +0200 Subject: [PATCH 13/15] Fix MacOSX build MacOSX does not ship `7z` nor `xz`. Let's use `xz`, just like on the other *nix systems. --- .travis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d56379dccebf..5c658f3a8b1b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,7 +95,9 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 os: osx osx_image: xcode7 - install: *osx_install_sccache + install: + - brew update && brew install xz + - *osx_install_sccache - env: > RUST_CHECK_TARGET=dist RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended" @@ -106,7 +108,9 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 os: osx osx_image: xcode7 - install: *osx_install_sccache + install: + - brew update && brew install xz + - *osx_install_sccache # "alternate" deployments, these are "nightlies" but don't have assertions # turned on, they're deployed to a different location primarily for projects @@ -123,7 +127,9 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 os: osx osx_image: xcode7 - install: *osx_install_sccache + install: + - brew update && brew install xz + - *osx_install_sccache env: global: From 7b05b88ce799fdba12caf6ba4e6419d3dc4702f6 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 2 May 2017 12:38:12 -0700 Subject: [PATCH 14/15] Document the reasoning for the Acquire/Release handshake when dropping Arcs. --- src/liballoc/arc.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 182a107e3f769..1df79074d3f4d 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -767,7 +767,18 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc { // > through this reference must obviously happened before), and an // > "acquire" operation before deleting the object. // + // In particular, while the contents of an Arc are usually immutable, it's + // possible to have interior writes to something like a Mutex. Since a + // Mutex is not acquired when it is deleted, we can't rely on its + // synchronization logic to make writes in thread A visible to a destructor + // running in thread B. + // + // Also note that the Acquire fence here could probably be replaced with an + // Acquire load, which could improve performance in highly-contended + // situations. See [2]. + // // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html) + // [2]: (https://github.com/rust-lang/rust/pull/41714) atomic::fence(Acquire); unsafe { From 98dd82c013b04af19eeb802562c1cf99c52010c5 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Wed, 3 May 2017 22:38:41 +0200 Subject: [PATCH 15/15] Retry `brew` commands upon failure Wrap the installation on macOS with `travis_retry`. --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c658f3a8b1b4..62e6280edd43f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,7 +96,8 @@ matrix: os: osx osx_image: xcode7 install: - - brew update && brew install xz + - travis_retry brew update + - travis_retry brew install xz - *osx_install_sccache - env: > RUST_CHECK_TARGET=dist @@ -109,7 +110,8 @@ matrix: os: osx osx_image: xcode7 install: - - brew update && brew install xz + - travis_retry brew update + - travis_retry brew install xz - *osx_install_sccache # "alternate" deployments, these are "nightlies" but don't have assertions @@ -128,7 +130,8 @@ matrix: os: osx osx_image: xcode7 install: - - brew update && brew install xz + - travis_retry brew update + - travis_retry brew install xz - *osx_install_sccache env: