Skip to content

Rollup of 9 pull requests #40206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
992dd20
Add missing url in sync structs
GuillaumeGomez Feb 24, 2017
3c5001f
Unit-like structs doc: Improve code sample
MajorBreakfast Feb 28, 2017
9141b7b
Add compile fail test for abi_ptx
topecongiro Mar 1, 2017
74b6221
String docs: Add "the"
MajorBreakfast Mar 1, 2017
9d99e12
Fix link in `if let` docs
iKevinY Mar 1, 2017
8f1a0af
Unit-like structs doc: Add compile fail tag
MajorBreakfast Mar 1, 2017
05aadd2
Add a reference to the dl library to the Makefile of the test issue-2…
er-1 Mar 1, 2017
471e655
doc: fix inconsistency in error output in guessing-game.md
d-e-s-o Mar 1, 2017
898d010
fix wrong word used (static vs const)
letmaik Mar 1, 2017
0907b9d
Add abi_x86_interrupt to the unstable book
topecongiro Mar 1, 2017
5d08775
Rollup merge of #40081 - GuillaumeGomez:poison-docs, r=frewsxcv
GuillaumeGomez Mar 2, 2017
b1bd60b
Rollup merge of #40144 - MajorBreakfast:patch-7, r=frewsxcv
GuillaumeGomez Mar 2, 2017
418a776
Rollup merge of #40168 - topecongiro:compile-fail-test-abi-ptx, r=pet…
GuillaumeGomez Mar 2, 2017
216a0ea
Rollup merge of #40169 - MajorBreakfast:patch-8, r=steveklabnik
GuillaumeGomez Mar 2, 2017
e583b6a
Rollup merge of #40170 - iKevinY:if-let-typo, r=frewsxcv
GuillaumeGomez Mar 2, 2017
4cf072d
Rollup merge of #40173 - er-1:master, r=alexcrichton
GuillaumeGomez Mar 2, 2017
f10adcc
Rollup merge of #40175 - d-e-s-o:fix-inconsistency-in-guessing-game-r…
GuillaumeGomez Mar 2, 2017
a7126e1
Rollup merge of #40191 - topecongiro:x86-interrupt, r=steveklabnik
GuillaumeGomez Mar 2, 2017
ad0a356
Rollup merge of #40194 - letmaik:patch-1, r=steveklabnik
GuillaumeGomez Mar 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doc/book/src/const-and-static.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static N: i32 = 5;
Unlike [`let`][let] bindings, you must annotate the type of a `static`.

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
static NAME: &'static str = "Steve";
Expand Down
16 changes: 8 additions & 8 deletions src/doc/book/src/guessing-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ and other whitespace. This helps you split up long lines. We _could_ have
done:

```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 we’ve split it up, two lines for two method
Expand Down Expand Up @@ -473,7 +473,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

println!("You guessed: {}", guess);
}
Expand Down Expand Up @@ -563,7 +563,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

println!("You guessed: {}", guess);

Expand Down Expand Up @@ -678,7 +678,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

let guess: u32 = guess.trim().parse()
.expect("Please type a number!");
Expand Down Expand Up @@ -780,7 +780,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

let guess: u32 = guess.trim().parse()
.expect("Please type a number!");
Expand Down Expand Up @@ -847,7 +847,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

let guess: u32 = guess.trim().parse()
.expect("Please type a number!");
Expand Down Expand Up @@ -892,7 +892,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

let guess: u32 = match guess.trim().parse() {
Ok(num) => num,
Expand Down Expand Up @@ -981,7 +981,7 @@ fn main() {
let mut guess = String::new();

io::stdin().read_line(&mut guess)
.expect("failed to read line");
.expect("Failed to read line");

let guess: u32 = match guess.trim().parse() {
Ok(num) => num,
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/src/if-let.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
and express them in a more convenient way.

Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/src/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ This emphasizes that we have to walk from the beginning of the list of `chars`.

## 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
let dog = "hachiko";
Expand Down
5 changes: 3 additions & 2 deletions src/doc/book/src/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,14 @@ rather than positions.

You can define a `struct` with no members at all:

```rust
```rust,compile_fail,E0423
struct Electron {} // Use empty braces...
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 y = Proton;
let z = Electron; // Error
```

Such a `struct` is called ‘unit-like’ because it resembles the empty
Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [abi_sysv64](abi-sysv64.md)
- [abi_unadjusted](abi-unadjusted.md)
- [abi_vectorcall](abi-vectorcall.md)
- [abi_x86_interrupt](abi-x86-interrupt.md)
- [advanced_slice_patterns](advanced-slice-patterns.md)
- [alloc_jemalloc](alloc-jemalloc.md)
- [alloc_system](alloc-system.md)
Expand Down
7 changes: 7 additions & 0 deletions src/doc/unstable-book/src/abi-x86-interrupt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `abi_x86_interrupt`

The tracking issue for this feature is: [#40180]

[#40180]: https://github.com/rust-lang/rust/issues/40180

------------------------
29 changes: 22 additions & 7 deletions src/libstd/sys_common/poison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ pub struct Guard {

/// 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
/// each lock, but once a lock is poisoned then all future acquisitions will
/// return this error.
///
/// [`Mutex`]: ../../std/sync/struct.Mutex.html
/// [`RwLock`]: ../../std/sync/struct.RwLock.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct PoisonError<T> {
guard: T,
Expand All @@ -85,19 +88,26 @@ pub enum TryLockError<T> {

/// 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
/// poisoned, and the `Guard` is contained within. The `Err` variant indicates
/// 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 [`Ok`] variant of this result indicates that the primitive was not
/// poisoned, and the `Guard` is contained within. The [`Err`] variant indicates
/// that the primitive was poisoned. Note that the [`Err`] variant *also* carries
/// the associated guard, and it can be acquired through the [`into_inner`]
/// 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")]
pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;

/// A type alias for the result of a nonblocking locking method.
///
/// For more information, see `LockResult`. A `TryLockResult` doesn't
/// necessarily hold the associated guard in the `Err` type as the lock may not
/// For more information, see [`LockResult`]. A `TryLockResult` doesn't
/// necessarily hold the associated guard in the [`Err`] type as the lock may not
/// 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")]
pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;

Expand All @@ -124,6 +134,11 @@ impl<T> Error for PoisonError<T> {

impl<T> PoisonError<T> {
/// 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")]
pub fn new(guard: T) -> PoisonError<T> {
PoisonError { guard: guard }
Expand Down
8 changes: 8 additions & 0 deletions src/test/compile-fail/feature-gate-abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
// gate-test-intrinsics
// gate-test-platform_intrinsics
// gate-test-abi_vectorcall
// gate-test-abi_ptx

// Functions
extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change
extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experimental
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 "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
trait Tr {
Expand All @@ -26,12 +28,14 @@ trait Tr {
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 "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 "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental
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 "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;
Expand All @@ -43,6 +47,7 @@ impl Tr for S {
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 "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
Expand All @@ -52,6 +57,7 @@ impl S {
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 "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
Expand All @@ -60,12 +66,14 @@ 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 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 A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change

// Foreign modules
extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change
extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experimental
extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change
extern "rust-call" {} //~ ERROR rust-call ABI is subject to change
extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change

fn main() {}
4 changes: 2 additions & 2 deletions src/test/run-make/issue-24445/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
ifeq ($(UNAME),Linux)
all:
$(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)
$(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)
else
all:
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub fn check(path: &Path, bad: &mut bool) {

// FIXME get this whitelist empty.
let whitelist = vec![
"abi_ptx", "simd",
"simd",
"stmt_expr_attributes",
"cfg_target_thread_local", "unwind_attributes",
];
Expand Down