Skip to content

Commit bae454e

Browse files
committed
Auto merge of #39736 - frewsxcv:rollup, r=frewsxcv
Rollup of 9 pull requests - Successful merges: #39174, #39660, #39676, #39692, #39701, #39710, #39721, #39724, #39725 - Failed merges:
2 parents f140a6c + 56275f8 commit bae454e

File tree

10 files changed

+63
-58
lines changed

10 files changed

+63
-58
lines changed

RELEASES.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
Version 1.15.1 (2017-02-08)
1+
Version 1.15.1 (2017-02-09)
22
===========================
33

44
* [Fix IntoIter::as_mut_slice's signature][39466]
5+
* [Compile compiler builtins with `-fPIC` on 32-bit platforms][39523]
56

67
[39466]: https://github.com/rust-lang/rust/pull/39466
8+
[39523]: https://github.com/rust-lang/rust/pull/39523
79

810

911
Version 1.15.0 (2017-02-02)

src/doc/book/nightly-rust.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,42 @@ process, see ‘[Stability as a deliverable][stability]’.
66

77
[stability]: http://blog.rust-lang.org/2014/10/30/Stability.html
88

9-
To install nightly Rust, you can use `rustup.sh`:
9+
To install nightly Rust, you can use [rustup.rs][rustup]:
10+
11+
[rustup]: https://rustup.rs
1012

1113
```bash
12-
$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
14+
$ curl https://sh.rustup.rs -sSf | sh
15+
$ rustup install nightly
1316
```
1417

1518
If you're concerned about the [potential insecurity][insecurity] of using `curl
1619
| sh`, please keep reading and see our disclaimer below. And feel free to
1720
use a two-step version of the installation and examine our installation script:
1821

1922
```bash
20-
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
21-
$ sh rustup.sh --channel=nightly
23+
$ curl https://sh.rustup.rs -sSf -o rustup.sh
24+
$ sh rustup.sh
25+
$ rustup install nightly
2226
```
2327

2428
[insecurity]: http://curlpipesh.tumblr.com
2529

26-
If you're on Windows, please download either the [32-bit installer][win32] or
27-
the [64-bit installer][win64] and run it.
30+
If you're on Windows, please download the [rustup installer][installer]
31+
and run it.
2832

29-
[win32]: https://static.rust-lang.org/dist/rust-nightly-i686-pc-windows-gnu.msi
30-
[win64]: https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-gnu.msi
33+
[installer]: https://win.rustup.rs
3134

3235
## Uninstalling
3336

3437
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
3538
Not every programming language is great for everyone. Just run the uninstall
36-
script:
39+
command:
3740

3841
```bash
39-
$ sudo /usr/local/lib/rustlib/uninstall.sh
42+
$ rustup self uninstall
4043
```
4144

42-
If you used the Windows installer, re-run the `.msi` and it will give you
43-
an uninstall option.
44-
4545
Some people, and somewhat rightfully so, get very upset when we tell you to
4646
`curl | sh`. Basically, when you do this, you are trusting that the good
4747
people who maintain Rust aren't going to hack your computer and do bad things.

src/libcollections/vec.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,9 @@ impl<T> Vec<T> {
437437

438438
/// Reserves capacity for at least `additional` more elements to be inserted
439439
/// in the given `Vec<T>`. The collection may reserve more space to avoid
440-
/// frequent reallocations.
440+
/// frequent reallocations. After calling `reserve`, capacity will be
441+
/// greater than or equal to `self.len() + additional`. Does nothing if
442+
/// capacity is already sufficient.
441443
///
442444
/// # Panics
443445
///
@@ -456,8 +458,9 @@ impl<T> Vec<T> {
456458
}
457459

458460
/// Reserves the minimum capacity for exactly `additional` more elements to
459-
/// be inserted in the given `Vec<T>`. Does nothing if the capacity is already
460-
/// sufficient.
461+
/// be inserted in the given `Vec<T>`. After calling `reserve_exact`,
462+
/// capacity will be greater than or equal to `self.len() + additional`.
463+
/// Does nothing if the capacity is already sufficient.
461464
///
462465
/// Note that the allocator may give the collection more space than it
463466
/// requests. Therefore capacity can not be relied upon to be precisely

src/libcore/iter/iterator.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,14 @@ pub trait Iterator {
209209

210210
/// Returns the `n`th element of the iterator.
211211
///
212-
/// Note that all preceding elements will be consumed (i.e. discarded).
213-
///
214212
/// Like most indexing operations, the count starts from zero, so `nth(0)`
215213
/// returns the first value, `nth(1)` the second, and so on.
216214
///
215+
/// Note that all preceding elements, as well as the returned element, will be
216+
/// consumed from the iterator. That means that the preceding elements will be
217+
/// discarded, and also that calling `nth(0)` multiple times on the same iterator
218+
/// will return different elements.
219+
///
217220
/// `nth()` will return [`None`] if `n` is greater than or equal to the length of the
218221
/// iterator.
219222
///

src/librustc_data_structures/flock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod imp {
2727
use std::io;
2828
use libc;
2929

30-
#[cfg(target_os = "linux")]
30+
#[cfg(any(target_os = "linux", target_os = "android"))]
3131
mod os {
3232
use libc;
3333

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@
303303
#![feature(unboxed_closures)]
304304
#![feature(unicode)]
305305
#![feature(unique)]
306+
#![feature(untagged_unions)]
306307
#![feature(unwind_attributes)]
307308
#![feature(vec_push_all)]
308309
#![feature(zero_one)]

src/libstd/panicking.rs

+13-23
Original file line numberDiff line numberDiff line change
@@ -389,48 +389,41 @@ pub use realstd::rt::update_panic_count;
389389

390390
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
391391
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
392-
struct Data<F, R> {
392+
#[allow(unions_with_drop_fields)]
393+
union Data<F, R> {
393394
f: F,
394395
r: R,
395396
}
396397

397398
// We do some sketchy operations with ownership here for the sake of
398-
// performance. The `Data` structure is never actually fully valid, but
399-
// instead it always contains at least one uninitialized field. We can only
400-
// pass pointers down to `__rust_maybe_catch_panic` (can't pass objects by
401-
// value), so we do all the ownership tracking here manully.
399+
// performance. We can only pass pointers down to
400+
// `__rust_maybe_catch_panic` (can't pass objects by value), so we do all
401+
// the ownership tracking here manually using a union.
402402
//
403-
// Note that this is all invalid if any of these functions unwind, but the
404-
// whole point of this function is to prevent that! As a result we go
405-
// through a transition where:
403+
// We go through a transition where:
406404
//
407-
// * First, only the closure we're going to call is initialized. The return
408-
// value is uninitialized.
405+
// * First, we set the data to be the closure that we're going to call.
409406
// * When we make the function call, the `do_call` function below, we take
410-
// ownership of the function pointer, replacing it with uninitialized
411-
// data. At this point the `Data` structure is entirely uninitialized, but
412-
// it won't drop due to an unwind because it's owned on the other side of
413-
// the catch panic.
407+
// ownership of the function pointer. At this point the `Data` union is
408+
// entirely uninitialized.
414409
// * If the closure successfully returns, we write the return value into the
415410
// data's return slot. Note that `ptr::write` is used as it's overwriting
416411
// uninitialized data.
417412
// * Finally, when we come back out of the `__rust_maybe_catch_panic` we're
418413
// in one of two states:
419414
//
420415
// 1. The closure didn't panic, in which case the return value was
421-
// filled in. We have to be careful to `forget` the closure,
422-
// however, as ownership was passed to the `do_call` function.
416+
// filled in. We move it out of `data` and return it.
423417
// 2. The closure panicked, in which case the return value wasn't
424-
// filled in. In this case the entire `data` structure is invalid,
425-
// so we forget the entire thing.
418+
// filled in. In this case the entire `data` union is invalid, so
419+
// there is no need to drop anything.
426420
//
427421
// Once we stack all that together we should have the "most efficient'
428422
// method of calling a catch panic whilst juggling ownership.
429423
let mut any_data = 0;
430424
let mut any_vtable = 0;
431425
let mut data = Data {
432426
f: f,
433-
r: mem::uninitialized(),
434427
};
435428

436429
let r = __rust_maybe_catch_panic(do_call::<F, R>,
@@ -439,12 +432,9 @@ pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
439432
&mut any_vtable);
440433

441434
return if r == 0 {
442-
let Data { f, r } = data;
443-
mem::forget(f);
444435
debug_assert!(update_panic_count(0) == 0);
445-
Ok(r)
436+
Ok(data.r)
446437
} else {
447-
mem::forget(data);
448438
update_panic_count(-1);
449439
debug_assert!(update_panic_count(0) == 0);
450440
Err(mem::transmute(raw::TraitObject {
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn worker() -> ! {
12+
panic!()
13+
}
14+
15+
fn main() {
16+
std::panic::catch_unwind(worker).unwrap_err();
17+
}

src/test/run-pass/dst-field-align.rs

-12
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ struct Baz<T: ?Sized> {
2525
a: T
2626
}
2727

28-
#[repr(packed)]
29-
struct Packed<T: ?Sized> {
30-
a: u8,
31-
b: T
32-
}
33-
3428
struct HasDrop<T: ?Sized> {
3529
ptr: Box<usize>,
3630
data: T
@@ -55,12 +49,6 @@ fn main() {
5549
// The pointers should be the same
5650
assert_eq!(ptr1, ptr2);
5751

58-
// Test that packed structs are handled correctly
59-
let p : Packed<usize> = Packed { a: 0, b: 13 };
60-
assert_eq!(p.b.get(), 13);
61-
let p : &Packed<Bar> = &p;
62-
assert_eq!(p.b.get(), 13);
63-
6452
// Test that nested DSTs work properly
6553
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
6654
assert_eq!(f.b.b.get(), 17);

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ impl Builder {
179179
// and wrap it up in a `Value::Table`.
180180
let mut manifest = BTreeMap::new();
181181
manifest.insert("manifest-version".to_string(),
182-
toml::encode(&manifest_version));
183-
manifest.insert("date".to_string(), toml::encode(&date));
182+
toml::Value::String(manifest_version));
183+
manifest.insert("date".to_string(), toml::Value::String(date));
184184
manifest.insert("pkg".to_string(), toml::encode(&pkg));
185185
let manifest = toml::Value::Table(manifest).to_string();
186186

@@ -362,7 +362,8 @@ impl Builder {
362362
fn hash(&self, path: &Path) -> String {
363363
let sha = t!(Command::new("shasum")
364364
.arg("-a").arg("256")
365-
.arg(path)
365+
.arg(path.file_name().unwrap())
366+
.current_dir(path.parent().unwrap())
366367
.output());
367368
assert!(sha.status.success());
368369

0 commit comments

Comments
 (0)