Skip to content

Commit b16c7a2

Browse files
committed
Auto merge of #41735 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests - Successful merges: #41543, #41600, #41715, #41720, #41721, #41730 - Failed merges:
2 parents 2d4ed8e + e20b282 commit b16c7a2

File tree

8 files changed

+108
-43
lines changed

8 files changed

+108
-43
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ Margaret Meyerhofer <[email protected]> <mmeyerho@andrew>
139139
Mark Sinclair <[email protected]>
140140
Mark Sinclair <[email protected]> =Mark Sinclair <[email protected]>
141141
Markus Westerlind <[email protected]> Markus <[email protected]>
142+
Martin Hafskjold Thoresen <[email protected]>
142143
Matej Lach <[email protected]> Matej Ľach <[email protected]>
143144
144145
Matthew Auld <[email protected]>

.travis.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ matrix:
9595
MACOSX_DEPLOYMENT_TARGET=10.7
9696
os: osx
9797
osx_image: xcode7
98-
install: *osx_install_sccache
98+
install:
99+
- travis_retry brew update
100+
- travis_retry brew install xz
101+
- *osx_install_sccache
99102
- env: >
100103
RUST_CHECK_TARGET=dist
101104
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers"
@@ -106,7 +109,10 @@ matrix:
106109
MACOSX_DEPLOYMENT_TARGET=10.7
107110
os: osx
108111
osx_image: xcode7
109-
install: *osx_install_sccache
112+
install:
113+
- travis_retry brew update
114+
- travis_retry brew install xz
115+
- *osx_install_sccache
110116
111117
# "alternate" deployments, these are "nightlies" but don't have assertions
112118
# turned on, they're deployed to a different location primarily for projects
@@ -123,7 +129,10 @@ matrix:
123129
MACOSX_DEPLOYMENT_TARGET=10.7
124130
os: osx
125131
osx_image: xcode7
126-
install: *osx_install_sccache
132+
install:
133+
- travis_retry brew update
134+
- travis_retry brew install xz
135+
- *osx_install_sccache
127136
128137
env:
129138
global:

src/liballoc/arc.rs

+11
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,18 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> {
767767
// > through this reference must obviously happened before), and an
768768
// > "acquire" operation before deleting the object.
769769
//
770+
// In particular, while the contents of an Arc are usually immutable, it's
771+
// possible to have interior writes to something like a Mutex<T>. Since a
772+
// Mutex is not acquired when it is deleted, we can't rely on its
773+
// synchronization logic to make writes in thread A visible to a destructor
774+
// running in thread B.
775+
//
776+
// Also note that the Acquire fence here could probably be replaced with an
777+
// Acquire load, which could improve performance in highly-contended
778+
// situations. See [2].
779+
//
770780
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
781+
// [2]: (https://github.com/rust-lang/rust/pull/41714)
771782
atomic::fence(Acquire);
772783

773784
unsafe {

src/libstd/process.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ impl fmt::Debug for Child {
148148
}
149149
}
150150

151-
/// A handle to a child process's stdin. This struct is used in the [`stdin`]
152-
/// field on [`Child`].
151+
/// A handle to a child process's stdin.
152+
///
153+
/// This struct is used in the [`stdin`] field on [`Child`].
153154
///
154155
/// [`Child`]: struct.Child.html
155156
/// [`stdin`]: struct.Child.html#structfield.stdin
@@ -190,8 +191,9 @@ impl fmt::Debug for ChildStdin {
190191
}
191192
}
192193

193-
/// A handle to a child process's stdout. This struct is used in the [`stdout`]
194-
/// field on [`Child`].
194+
/// A handle to a child process's stdout.
195+
///
196+
/// This struct is used in the [`stdout`] field on [`Child`].
195197
///
196198
/// [`Child`]: struct.Child.html
197199
/// [`stdout`]: struct.Child.html#structfield.stdout

src/libstd/thread/mod.rs

+22-11
Original file line numberDiff line numberDiff line change
@@ -715,21 +715,32 @@ struct Inner {
715715
#[stable(feature = "rust1", since = "1.0.0")]
716716
/// A handle to a thread.
717717
///
718+
/// You can use it to identify a thread (by name, for example). Most of the
719+
/// time, there is no need to directly create a `Thread` struct using the
720+
/// constructor, instead you should use a function like `spawn` to create
721+
/// new threads, see the docs of [`Builder`] and [`spawn`] for more.
722+
///
718723
/// # Examples
719724
///
720725
/// ```
721-
/// use std::thread;
722-
///
723-
/// let handler = thread::Builder::new()
724-
/// .name("foo".into())
725-
/// .spawn(|| {
726-
/// let thread = thread::current();
727-
/// println!("thread name: {}", thread.name().unwrap());
728-
/// })
729-
/// .unwrap();
730-
///
731-
/// handler.join().unwrap();
726+
/// use std::thread::Builder;
727+
///
728+
/// for i in 0..5 {
729+
/// let thread_name = format!("thread_{}", i);
730+
/// Builder::new()
731+
/// .name(thread_name) // Now you can identify which thread panicked
732+
/// // thanks to the handle's name
733+
/// .spawn(move || {
734+
/// if i == 3 {
735+
/// panic!("I'm scared!!!");
736+
/// }
737+
/// })
738+
/// .unwrap();
739+
/// }
732740
/// ```
741+
/// [`Builder`]: ../../std/thread/struct.Builder.html
742+
/// [`spawn`]: ../../std/thread/fn.spawn.html
743+
733744
pub struct Thread {
734745
inner: Arc<Inner>,
735746
}

src/libstd/time/duration.rs

+25-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ impl Duration {
8484
/// ```
8585
/// use std::time::Duration;
8686
///
87-
/// let five_seconds = Duration::from_secs(5);
87+
/// let duration = Duration::from_secs(5);
88+
///
89+
/// assert_eq!(5, duration.as_secs());
90+
/// assert_eq!(0, duration.subsec_nanos());
8891
/// ```
8992
#[stable(feature = "duration", since = "1.3.0")]
9093
#[inline]
@@ -99,7 +102,10 @@ impl Duration {
99102
/// ```
100103
/// use std::time::Duration;
101104
///
102-
/// let five_seconds = Duration::from_millis(5000);
105+
/// let duration = Duration::from_millis(2569);
106+
///
107+
/// assert_eq!(2, duration.as_secs());
108+
/// assert_eq!(569000000, duration.subsec_nanos());
103109
/// ```
104110
#[stable(feature = "duration", since = "1.3.0")]
105111
#[inline]
@@ -119,9 +125,24 @@ impl Duration {
119125
/// ```
120126
/// use std::time::Duration;
121127
///
122-
/// let five_seconds = Duration::new(5, 0);
123-
/// assert_eq!(five_seconds.as_secs(), 5);
128+
/// let duration = Duration::new(5, 730023852);
129+
/// assert_eq!(duration.as_secs(), 5);
130+
/// ```
131+
///
132+
/// To determine the total number of seconds represented by the `Duration`,
133+
/// use `as_secs` in combination with [`subsec_nanos`]:
134+
///
124135
/// ```
136+
/// use std::time::Duration;
137+
///
138+
/// let duration = Duration::new(5, 730023852);
139+
///
140+
/// assert_eq!(5.730023852,
141+
/// duration.as_secs() as f64
142+
/// + duration.subsec_nanos() as f64 * 1e-9);
143+
/// ```
144+
///
145+
/// [`subsec_nanos`]: #method.subsec_nanos
125146
#[stable(feature = "duration", since = "1.3.0")]
126147
#[inline]
127148
pub fn as_secs(&self) -> u64 { self.secs }

src/tools/build-manifest/src/main.rs

+30-20
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,26 @@ struct Target {
116116
available: bool,
117117
url: Option<String>,
118118
hash: Option<String>,
119+
xz_url: Option<String>,
120+
xz_hash: Option<String>,
119121
components: Option<Vec<Component>>,
120122
extensions: Option<Vec<Component>>,
121123
}
122124

125+
impl Target {
126+
fn unavailable() -> Target {
127+
Target {
128+
available: false,
129+
url: None,
130+
hash: None,
131+
xz_url: None,
132+
xz_hash: None,
133+
components: None,
134+
extensions: None,
135+
}
136+
}
137+
}
138+
123139
#[derive(RustcEncodable)]
124140
struct Component {
125141
pkg: String,
@@ -242,16 +258,12 @@ impl Builder {
242258
let digest = match self.digests.remove(&filename) {
243259
Some(digest) => digest,
244260
None => {
245-
pkg.target.insert(host.to_string(), Target {
246-
available: false,
247-
url: None,
248-
hash: None,
249-
components: None,
250-
extensions: None,
251-
});
261+
pkg.target.insert(host.to_string(), Target::unavailable());
252262
continue
253263
}
254264
};
265+
let xz_filename = filename.replace(".tar.gz", ".tar.xz");
266+
let xz_digest = self.digests.remove(&xz_filename);
255267
let mut components = Vec::new();
256268
let mut extensions = Vec::new();
257269

@@ -293,8 +305,10 @@ impl Builder {
293305

294306
pkg.target.insert(host.to_string(), Target {
295307
available: true,
296-
url: Some(self.url("rust", host)),
308+
url: Some(self.url(&filename)),
297309
hash: Some(digest),
310+
xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)),
311+
xz_hash: xz_digest,
298312
components: Some(components),
299313
extensions: Some(extensions),
300314
});
@@ -312,21 +326,17 @@ impl Builder {
312326
let filename = self.filename(pkgname, name);
313327
let digest = match self.digests.remove(&filename) {
314328
Some(digest) => digest,
315-
None => {
316-
return (name.to_string(), Target {
317-
available: false,
318-
url: None,
319-
hash: None,
320-
components: None,
321-
extensions: None,
322-
})
323-
}
329+
None => return (name.to_string(), Target::unavailable()),
324330
};
331+
let xz_filename = filename.replace(".tar.gz", ".tar.xz");
332+
let xz_digest = self.digests.remove(&xz_filename);
325333

326334
(name.to_string(), Target {
327335
available: true,
328-
url: Some(self.url(pkgname, name)),
336+
url: Some(self.url(&filename)),
329337
hash: Some(digest),
338+
xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)),
339+
xz_hash: xz_digest,
330340
components: None,
331341
extensions: None,
332342
})
@@ -338,11 +348,11 @@ impl Builder {
338348
});
339349
}
340350

341-
fn url(&self, component: &str, target: &str) -> String {
351+
fn url(&self, filename: &str) -> String {
342352
format!("{}/{}/{}",
343353
self.s3_address,
344354
self.date,
345-
self.filename(component, target))
355+
filename)
346356
}
347357

348358
fn filename(&self, component: &str, target: &str) -> String {

0 commit comments

Comments
 (0)