Auto merge of #40206 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 9 pull requests

- Successful merges: #40081, #40144, #40168, #40169, #40170, #40173, #40175, #40191, #40194
- Failed merges:
This commit is contained in:
bors 2017-03-02 14:38:12 +00:00
commit 8ae411e1b3
11 changed files with 55 additions and 23 deletions

View File

@ -32,7 +32,7 @@ static N: i32 = 5;
Unlike [`let`][let] bindings, you must annotate the type of a `static`. Unlike [`let`][let] bindings, you must annotate the type of a `static`.
Statics live for the entire lifetime of a program, and therefore any Statics live for the entire lifetime of a program, and therefore any
reference stored in a constant has a [`'static` lifetime][lifetimes]: reference stored in a static has a [`'static` lifetime][lifetimes]:
```rust ```rust
static NAME: &'static str = "Steve"; static NAME: &'static str = "Steve";

View File

@ -255,7 +255,7 @@ and other whitespace. This helps you split up long lines. We _could_ have
done: done:
```rust,ignore ```rust,ignore
io::stdin().read_line(&mut guess).expect("failed to read line"); io::stdin().read_line(&mut guess).expect("Failed to read line");
``` ```
But that gets hard to read. So weve split it up, two lines for two method But that gets hard to read. So weve split it up, two lines for two method
@ -473,7 +473,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
println!("You guessed: {}", guess); println!("You guessed: {}", guess);
} }
@ -563,7 +563,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
println!("You guessed: {}", guess); println!("You guessed: {}", guess);
@ -678,7 +678,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
let guess: u32 = guess.trim().parse() let guess: u32 = guess.trim().parse()
.expect("Please type a number!"); .expect("Please type a number!");
@ -780,7 +780,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
let guess: u32 = guess.trim().parse() let guess: u32 = guess.trim().parse()
.expect("Please type a number!"); .expect("Please type a number!");
@ -847,7 +847,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
let guess: u32 = guess.trim().parse() let guess: u32 = guess.trim().parse()
.expect("Please type a number!"); .expect("Please type a number!");
@ -892,7 +892,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
let guess: u32 = match guess.trim().parse() { let guess: u32 = match guess.trim().parse() {
Ok(num) => num, Ok(num) => num,
@ -981,7 +981,7 @@ fn main() {
let mut guess = String::new(); let mut guess = String::new();
io::stdin().read_line(&mut guess) io::stdin().read_line(&mut guess)
.expect("failed to read line"); .expect("Failed to read line");
let guess: u32 = match guess.trim().parse() { let guess: u32 = match guess.trim().parse() {
Ok(num) => num, Ok(num) => num,

View File

@ -1,6 +1,6 @@
# if let # if let
`if let` permits [patterns][pattern] matching within the condition of an [if][if] statement. `if let` permits [patterns][patterns] matching within the condition of an [if][if] statement.
This allows us to reduce the overhead of certain kinds of [pattern][patterns] matches This allows us to reduce the overhead of certain kinds of [pattern][patterns] matches
and express them in a more convenient way. and express them in a more convenient way.

View File

@ -145,7 +145,7 @@ This emphasizes that we have to walk from the beginning of the list of `chars`.
## Slicing ## Slicing
You can get a slice of a string with slicing syntax: You can get a slice of a string with the slicing syntax:
```rust ```rust
let dog = "hachiko"; let dog = "hachiko";

View File

@ -255,13 +255,14 @@ rather than positions.
You can define a `struct` with no members at all: You can define a `struct` with no members at all:
```rust ```rust,compile_fail,E0423
struct Electron {} // Use empty braces... struct Electron {} // Use empty braces...
struct Proton; // ...or just a semicolon. struct Proton; // ...or just a semicolon.
// Whether you declared the struct with braces or not, do the same when creating one. // Use the same notation when creating an instance.
let x = Electron {}; let x = Electron {};
let y = Proton; let y = Proton;
let z = Electron; // Error
``` ```
Such a `struct` is called unit-like because it resembles the empty Such a `struct` is called unit-like because it resembles the empty

View File

@ -5,6 +5,7 @@
- [abi_sysv64](abi-sysv64.md) - [abi_sysv64](abi-sysv64.md)
- [abi_unadjusted](abi-unadjusted.md) - [abi_unadjusted](abi-unadjusted.md)
- [abi_vectorcall](abi-vectorcall.md) - [abi_vectorcall](abi-vectorcall.md)
- [abi_x86_interrupt](abi-x86-interrupt.md)
- [advanced_slice_patterns](advanced-slice-patterns.md) - [advanced_slice_patterns](advanced-slice-patterns.md)
- [alloc_jemalloc](alloc-jemalloc.md) - [alloc_jemalloc](alloc-jemalloc.md)
- [alloc_system](alloc-system.md) - [alloc_system](alloc-system.md)

View File

@ -0,0 +1,7 @@
# `abi_x86_interrupt`
The tracking issue for this feature is: [#40180]
[#40180]: https://github.com/rust-lang/rust/issues/40180
------------------------

View File

@ -60,10 +60,13 @@ pub struct Guard {
/// A type of error which can be returned whenever a lock is acquired. /// A type of error which can be returned whenever a lock is acquired.
/// ///
/// Both Mutexes and RwLocks are poisoned whenever a thread fails while the lock /// Both [`Mutex`]es and [`RwLock`]s are poisoned whenever a thread fails while the lock
/// is held. The precise semantics for when a lock is poisoned is documented on /// is held. The precise semantics for when a lock is poisoned is documented on
/// each lock, but once a lock is poisoned then all future acquisitions will /// each lock, but once a lock is poisoned then all future acquisitions will
/// return this error. /// return this error.
///
/// [`Mutex`]: ../../std/sync/struct.Mutex.html
/// [`RwLock`]: ../../std/sync/struct.RwLock.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct PoisonError<T> { pub struct PoisonError<T> {
guard: T, guard: T,
@ -85,19 +88,26 @@ pub enum TryLockError<T> {
/// A type alias for the result of a lock method which can be poisoned. /// A type alias for the result of a lock method which can be poisoned.
/// ///
/// The `Ok` variant of this result indicates that the primitive was not /// The [`Ok`] variant of this result indicates that the primitive was not
/// poisoned, and the `Guard` is contained within. The `Err` variant indicates /// poisoned, and the `Guard` is contained within. The [`Err`] variant indicates
/// that the primitive was poisoned. Note that the `Err` variant *also* carries /// that the primitive was poisoned. Note that the [`Err`] variant *also* carries
/// the associated guard, and it can be acquired through the `into_inner` /// the associated guard, and it can be acquired through the [`into_inner`]
/// method. /// method.
///
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
/// [`into_inner`]: ../../std/sync/struct.Mutex.html#method.into_inner
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>; pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;
/// A type alias for the result of a nonblocking locking method. /// A type alias for the result of a nonblocking locking method.
/// ///
/// For more information, see `LockResult`. A `TryLockResult` doesn't /// For more information, see [`LockResult`]. A `TryLockResult` doesn't
/// necessarily hold the associated guard in the `Err` type as the lock may not /// necessarily hold the associated guard in the [`Err`] type as the lock may not
/// have been acquired for other reasons. /// have been acquired for other reasons.
///
/// [`LockResult`]: ../../std/sync/type.LockResult.html
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>; pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
@ -124,6 +134,11 @@ impl<T> Error for PoisonError<T> {
impl<T> PoisonError<T> { impl<T> PoisonError<T> {
/// Creates a `PoisonError`. /// Creates a `PoisonError`.
///
/// This is generally created by methods like [`Mutex::lock`] or [`RwLock::read`].
///
/// [`Mutex::lock`]: ../../std/sync/struct.Mutex.html#method.lock
/// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read
#[stable(feature = "sync_poison", since = "1.2.0")] #[stable(feature = "sync_poison", since = "1.2.0")]
pub fn new(guard: T) -> PoisonError<T> { pub fn new(guard: T) -> PoisonError<T> {
PoisonError { guard: guard } PoisonError { guard: guard }

View File

@ -11,6 +11,7 @@
// gate-test-intrinsics // gate-test-intrinsics
// gate-test-platform_intrinsics // gate-test-platform_intrinsics
// gate-test-abi_vectorcall // gate-test-abi_vectorcall
// gate-test-abi_ptx
// Functions // Functions
extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change
@ -18,6 +19,7 @@ extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experim
extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change
// Methods in trait definition // Methods in trait definition
trait Tr { trait Tr {
@ -26,12 +28,14 @@ trait Tr {
extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change
extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change
extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental
extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change
} }
struct S; struct S;
@ -43,6 +47,7 @@ impl Tr for S {
extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change
} }
// Methods in inherent impl // Methods in inherent impl
@ -52,6 +57,7 @@ impl S {
extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change
} }
// Function pointer types // Function pointer types
@ -60,6 +66,7 @@ type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics are ex
type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental and subject to change type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental and subject to change
type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to change type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to change
type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is experimental type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is experimental
type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change
// Foreign modules // Foreign modules
extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change
@ -67,5 +74,6 @@ extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experimental
extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" {} //~ ERROR rust-call ABI is subject to change extern "rust-call" {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change
fn main() {} fn main() {}

View File

@ -3,9 +3,9 @@
ifeq ($(UNAME),Linux) ifeq ($(UNAME),Linux)
all: all:
$(RUSTC) foo.rs $(RUSTC) foo.rs
$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -o $(TMPDIR)/foo $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo
$(call RUN,foo) $(call RUN,foo)
$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -pie -fPIC -o $(TMPDIR)/foo $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo
$(call RUN,foo) $(call RUN,foo)
else else
all: all:

View File

@ -167,7 +167,7 @@ pub fn check(path: &Path, bad: &mut bool) {
// FIXME get this whitelist empty. // FIXME get this whitelist empty.
let whitelist = vec![ let whitelist = vec![
"abi_ptx", "simd", "simd",
"stmt_expr_attributes", "stmt_expr_attributes",
"cfg_target_thread_local", "unwind_attributes", "cfg_target_thread_local", "unwind_attributes",
]; ];