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:
This commit is contained in:
commit
bae454edc5
10 changed files with 63 additions and 58 deletions
|
@ -1,9 +1,11 @@
|
||||||
Version 1.15.1 (2017-02-08)
|
Version 1.15.1 (2017-02-09)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
* [Fix IntoIter::as_mut_slice's signature][39466]
|
* [Fix IntoIter::as_mut_slice's signature][39466]
|
||||||
|
* [Compile compiler builtins with `-fPIC` on 32-bit platforms][39523]
|
||||||
|
|
||||||
[39466]: https://github.com/rust-lang/rust/pull/39466
|
[39466]: https://github.com/rust-lang/rust/pull/39466
|
||||||
|
[39523]: https://github.com/rust-lang/rust/pull/39523
|
||||||
|
|
||||||
|
|
||||||
Version 1.15.0 (2017-02-02)
|
Version 1.15.0 (2017-02-02)
|
||||||
|
|
|
@ -6,10 +6,13 @@ process, see ‘[Stability as a deliverable][stability]’.
|
||||||
|
|
||||||
[stability]: http://blog.rust-lang.org/2014/10/30/Stability.html
|
[stability]: http://blog.rust-lang.org/2014/10/30/Stability.html
|
||||||
|
|
||||||
To install nightly Rust, you can use `rustup.sh`:
|
To install nightly Rust, you can use [rustup.rs][rustup]:
|
||||||
|
|
||||||
|
[rustup]: https://rustup.rs
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
|
$ curl https://sh.rustup.rs -sSf | sh
|
||||||
|
$ rustup install nightly
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're concerned about the [potential insecurity][insecurity] of using `curl
|
If you're concerned about the [potential insecurity][insecurity] of using `curl
|
||||||
|
@ -17,31 +20,28 @@ If you're concerned about the [potential insecurity][insecurity] of using `curl
|
||||||
use a two-step version of the installation and examine our installation script:
|
use a two-step version of the installation and examine our installation script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
|
$ curl https://sh.rustup.rs -sSf -o rustup.sh
|
||||||
$ sh rustup.sh --channel=nightly
|
$ sh rustup.sh
|
||||||
|
$ rustup install nightly
|
||||||
```
|
```
|
||||||
|
|
||||||
[insecurity]: http://curlpipesh.tumblr.com
|
[insecurity]: http://curlpipesh.tumblr.com
|
||||||
|
|
||||||
If you're on Windows, please download either the [32-bit installer][win32] or
|
If you're on Windows, please download the [rustup installer][installer]
|
||||||
the [64-bit installer][win64] and run it.
|
and run it.
|
||||||
|
|
||||||
[win32]: https://static.rust-lang.org/dist/rust-nightly-i686-pc-windows-gnu.msi
|
[installer]: https://win.rustup.rs
|
||||||
[win64]: https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-gnu.msi
|
|
||||||
|
|
||||||
## Uninstalling
|
## Uninstalling
|
||||||
|
|
||||||
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
|
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
|
||||||
Not every programming language is great for everyone. Just run the uninstall
|
Not every programming language is great for everyone. Just run the uninstall
|
||||||
script:
|
command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo /usr/local/lib/rustlib/uninstall.sh
|
$ rustup self uninstall
|
||||||
```
|
```
|
||||||
|
|
||||||
If you used the Windows installer, re-run the `.msi` and it will give you
|
|
||||||
an uninstall option.
|
|
||||||
|
|
||||||
Some people, and somewhat rightfully so, get very upset when we tell you to
|
Some people, and somewhat rightfully so, get very upset when we tell you to
|
||||||
`curl | sh`. Basically, when you do this, you are trusting that the good
|
`curl | sh`. Basically, when you do this, you are trusting that the good
|
||||||
people who maintain Rust aren't going to hack your computer and do bad things.
|
people who maintain Rust aren't going to hack your computer and do bad things.
|
||||||
|
|
|
@ -437,7 +437,9 @@ impl<T> Vec<T> {
|
||||||
|
|
||||||
/// Reserves capacity for at least `additional` more elements to be inserted
|
/// Reserves capacity for at least `additional` more elements to be inserted
|
||||||
/// in the given `Vec<T>`. The collection may reserve more space to avoid
|
/// in the given `Vec<T>`. The collection may reserve more space to avoid
|
||||||
/// frequent reallocations.
|
/// frequent reallocations. After calling `reserve`, capacity will be
|
||||||
|
/// greater than or equal to `self.len() + additional`. Does nothing if
|
||||||
|
/// capacity is already sufficient.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
|
@ -456,8 +458,9 @@ impl<T> Vec<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reserves the minimum capacity for exactly `additional` more elements to
|
/// Reserves the minimum capacity for exactly `additional` more elements to
|
||||||
/// be inserted in the given `Vec<T>`. Does nothing if the capacity is already
|
/// be inserted in the given `Vec<T>`. After calling `reserve_exact`,
|
||||||
/// sufficient.
|
/// capacity will be greater than or equal to `self.len() + additional`.
|
||||||
|
/// Does nothing if the capacity is already sufficient.
|
||||||
///
|
///
|
||||||
/// Note that the allocator may give the collection more space than it
|
/// Note that the allocator may give the collection more space than it
|
||||||
/// requests. Therefore capacity can not be relied upon to be precisely
|
/// requests. Therefore capacity can not be relied upon to be precisely
|
||||||
|
|
|
@ -209,11 +209,14 @@ pub trait Iterator {
|
||||||
|
|
||||||
/// Returns the `n`th element of the iterator.
|
/// Returns the `n`th element of the iterator.
|
||||||
///
|
///
|
||||||
/// Note that all preceding elements will be consumed (i.e. discarded).
|
|
||||||
///
|
|
||||||
/// Like most indexing operations, the count starts from zero, so `nth(0)`
|
/// Like most indexing operations, the count starts from zero, so `nth(0)`
|
||||||
/// returns the first value, `nth(1)` the second, and so on.
|
/// returns the first value, `nth(1)` the second, and so on.
|
||||||
///
|
///
|
||||||
|
/// Note that all preceding elements, as well as the returned element, will be
|
||||||
|
/// consumed from the iterator. That means that the preceding elements will be
|
||||||
|
/// discarded, and also that calling `nth(0)` multiple times on the same iterator
|
||||||
|
/// will return different elements.
|
||||||
|
///
|
||||||
/// `nth()` will return [`None`] if `n` is greater than or equal to the length of the
|
/// `nth()` will return [`None`] if `n` is greater than or equal to the length of the
|
||||||
/// iterator.
|
/// iterator.
|
||||||
///
|
///
|
||||||
|
|
|
@ -27,7 +27,7 @@ mod imp {
|
||||||
use std::io;
|
use std::io;
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
mod os {
|
mod os {
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,7 @@
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(unique)]
|
#![feature(unique)]
|
||||||
|
#![feature(untagged_unions)]
|
||||||
#![feature(unwind_attributes)]
|
#![feature(unwind_attributes)]
|
||||||
#![feature(vec_push_all)]
|
#![feature(vec_push_all)]
|
||||||
#![feature(zero_one)]
|
#![feature(zero_one)]
|
||||||
|
|
|
@ -389,28 +389,23 @@ pub use realstd::rt::update_panic_count;
|
||||||
|
|
||||||
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
|
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
|
||||||
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
|
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
|
||||||
struct Data<F, R> {
|
#[allow(unions_with_drop_fields)]
|
||||||
|
union Data<F, R> {
|
||||||
f: F,
|
f: F,
|
||||||
r: R,
|
r: R,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do some sketchy operations with ownership here for the sake of
|
// We do some sketchy operations with ownership here for the sake of
|
||||||
// performance. The `Data` structure is never actually fully valid, but
|
// performance. We can only pass pointers down to
|
||||||
// instead it always contains at least one uninitialized field. We can only
|
// `__rust_maybe_catch_panic` (can't pass objects by value), so we do all
|
||||||
// pass pointers down to `__rust_maybe_catch_panic` (can't pass objects by
|
// the ownership tracking here manually using a union.
|
||||||
// value), so we do all the ownership tracking here manully.
|
|
||||||
//
|
//
|
||||||
// Note that this is all invalid if any of these functions unwind, but the
|
// We go through a transition where:
|
||||||
// whole point of this function is to prevent that! As a result we go
|
|
||||||
// through a transition where:
|
|
||||||
//
|
//
|
||||||
// * First, only the closure we're going to call is initialized. The return
|
// * First, we set the data to be the closure that we're going to call.
|
||||||
// value is uninitialized.
|
|
||||||
// * When we make the function call, the `do_call` function below, we take
|
// * When we make the function call, the `do_call` function below, we take
|
||||||
// ownership of the function pointer, replacing it with uninitialized
|
// ownership of the function pointer. At this point the `Data` union is
|
||||||
// data. At this point the `Data` structure is entirely uninitialized, but
|
// entirely uninitialized.
|
||||||
// it won't drop due to an unwind because it's owned on the other side of
|
|
||||||
// the catch panic.
|
|
||||||
// * If the closure successfully returns, we write the return value into the
|
// * If the closure successfully returns, we write the return value into the
|
||||||
// data's return slot. Note that `ptr::write` is used as it's overwriting
|
// data's return slot. Note that `ptr::write` is used as it's overwriting
|
||||||
// uninitialized data.
|
// uninitialized data.
|
||||||
|
@ -418,11 +413,10 @@ pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
|
||||||
// in one of two states:
|
// in one of two states:
|
||||||
//
|
//
|
||||||
// 1. The closure didn't panic, in which case the return value was
|
// 1. The closure didn't panic, in which case the return value was
|
||||||
// filled in. We have to be careful to `forget` the closure,
|
// filled in. We move it out of `data` and return it.
|
||||||
// however, as ownership was passed to the `do_call` function.
|
|
||||||
// 2. The closure panicked, in which case the return value wasn't
|
// 2. The closure panicked, in which case the return value wasn't
|
||||||
// filled in. In this case the entire `data` structure is invalid,
|
// filled in. In this case the entire `data` union is invalid, so
|
||||||
// so we forget the entire thing.
|
// there is no need to drop anything.
|
||||||
//
|
//
|
||||||
// Once we stack all that together we should have the "most efficient'
|
// Once we stack all that together we should have the "most efficient'
|
||||||
// method of calling a catch panic whilst juggling ownership.
|
// method of calling a catch panic whilst juggling ownership.
|
||||||
|
@ -430,7 +424,6 @@ pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
|
||||||
let mut any_vtable = 0;
|
let mut any_vtable = 0;
|
||||||
let mut data = Data {
|
let mut data = Data {
|
||||||
f: f,
|
f: f,
|
||||||
r: mem::uninitialized(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let r = __rust_maybe_catch_panic(do_call::<F, R>,
|
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>> {
|
||||||
&mut any_vtable);
|
&mut any_vtable);
|
||||||
|
|
||||||
return if r == 0 {
|
return if r == 0 {
|
||||||
let Data { f, r } = data;
|
|
||||||
mem::forget(f);
|
|
||||||
debug_assert!(update_panic_count(0) == 0);
|
debug_assert!(update_panic_count(0) == 0);
|
||||||
Ok(r)
|
Ok(data.r)
|
||||||
} else {
|
} else {
|
||||||
mem::forget(data);
|
|
||||||
update_panic_count(-1);
|
update_panic_count(-1);
|
||||||
debug_assert!(update_panic_count(0) == 0);
|
debug_assert!(update_panic_count(0) == 0);
|
||||||
Err(mem::transmute(raw::TraitObject {
|
Err(mem::transmute(raw::TraitObject {
|
||||||
|
|
17
src/test/run-pass/catch-unwind-bang.rs
Normal file
17
src/test/run-pass/catch-unwind-bang.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
fn worker() -> ! {
|
||||||
|
panic!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
std::panic::catch_unwind(worker).unwrap_err();
|
||||||
|
}
|
|
@ -25,12 +25,6 @@ struct Baz<T: ?Sized> {
|
||||||
a: T
|
a: T
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(packed)]
|
|
||||||
struct Packed<T: ?Sized> {
|
|
||||||
a: u8,
|
|
||||||
b: T
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HasDrop<T: ?Sized> {
|
struct HasDrop<T: ?Sized> {
|
||||||
ptr: Box<usize>,
|
ptr: Box<usize>,
|
||||||
data: T
|
data: T
|
||||||
|
@ -55,12 +49,6 @@ fn main() {
|
||||||
// The pointers should be the same
|
// The pointers should be the same
|
||||||
assert_eq!(ptr1, ptr2);
|
assert_eq!(ptr1, ptr2);
|
||||||
|
|
||||||
// Test that packed structs are handled correctly
|
|
||||||
let p : Packed<usize> = Packed { a: 0, b: 13 };
|
|
||||||
assert_eq!(p.b.get(), 13);
|
|
||||||
let p : &Packed<Bar> = &p;
|
|
||||||
assert_eq!(p.b.get(), 13);
|
|
||||||
|
|
||||||
// Test that nested DSTs work properly
|
// Test that nested DSTs work properly
|
||||||
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
|
let f : Foo<Foo<usize>> = Foo { a: 0, b: Foo { a: 1, b: 17 }};
|
||||||
assert_eq!(f.b.b.get(), 17);
|
assert_eq!(f.b.b.get(), 17);
|
||||||
|
|
|
@ -179,8 +179,8 @@ impl Builder {
|
||||||
// and wrap it up in a `Value::Table`.
|
// and wrap it up in a `Value::Table`.
|
||||||
let mut manifest = BTreeMap::new();
|
let mut manifest = BTreeMap::new();
|
||||||
manifest.insert("manifest-version".to_string(),
|
manifest.insert("manifest-version".to_string(),
|
||||||
toml::encode(&manifest_version));
|
toml::Value::String(manifest_version));
|
||||||
manifest.insert("date".to_string(), toml::encode(&date));
|
manifest.insert("date".to_string(), toml::Value::String(date));
|
||||||
manifest.insert("pkg".to_string(), toml::encode(&pkg));
|
manifest.insert("pkg".to_string(), toml::encode(&pkg));
|
||||||
let manifest = toml::Value::Table(manifest).to_string();
|
let manifest = toml::Value::Table(manifest).to_string();
|
||||||
|
|
||||||
|
@ -362,7 +362,8 @@ impl Builder {
|
||||||
fn hash(&self, path: &Path) -> String {
|
fn hash(&self, path: &Path) -> String {
|
||||||
let sha = t!(Command::new("shasum")
|
let sha = t!(Command::new("shasum")
|
||||||
.arg("-a").arg("256")
|
.arg("-a").arg("256")
|
||||||
.arg(path)
|
.arg(path.file_name().unwrap())
|
||||||
|
.current_dir(path.parent().unwrap())
|
||||||
.output());
|
.output());
|
||||||
assert!(sha.status.success());
|
assert!(sha.status.success());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue