From 992dd205ddb4906e9445ba1746b877faad784437 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 24 Feb 2017 20:56:04 +0100 Subject: [PATCH 01/10] Add missing url in sync structs --- src/libstd/sys_common/poison.rs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs index bdc727f1dfcfe..d9d13240fcc3a 100644 --- a/src/libstd/sys_common/poison.rs +++ b/src/libstd/sys_common/poison.rs @@ -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 { guard: T, @@ -85,19 +88,26 @@ pub enum TryLockError { /// 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 = Result>; /// 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 = Result>; @@ -124,6 +134,11 @@ impl Error for PoisonError { impl 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")] pub fn new(guard: T) -> PoisonError { PoisonError { guard: guard } From 3c5001f0dd14c3d0afa539eaed9c9109de2aae59 Mon Sep 17 00:00:00 2001 From: Josef Brandl Date: Tue, 28 Feb 2017 11:28:54 +0100 Subject: [PATCH 02/10] Unit-like structs doc: Improve code sample --- src/doc/book/src/structs.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/book/src/structs.md b/src/doc/book/src/structs.md index 6b2a145c85e51..b5fe99d04868a 100644 --- a/src/doc/book/src/structs.md +++ b/src/doc/book/src/structs.md @@ -259,9 +259,10 @@ You can define a `struct` with no members at all: 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 From 9141b7be704dad33c42c846720c675c4851e526c Mon Sep 17 00:00:00 2001 From: topecongiro Date: Wed, 1 Mar 2017 13:04:13 +0900 Subject: [PATCH 03/10] Add compile fail test for abi_ptx --- src/test/compile-fail/feature-gate-abi.rs | 8 ++++++++ src/tools/tidy/src/features.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/compile-fail/feature-gate-abi.rs b/src/test/compile-fail/feature-gate-abi.rs index 517e37c3fa5a3..41efb92d450e8 100644 --- a/src/test/compile-fail/feature-gate-abi.rs +++ b/src/test/compile-fail/feature-gate-abi.rs @@ -11,6 +11,7 @@ // 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 @@ -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 "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 { @@ -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; @@ -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 @@ -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 @@ -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 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 @@ -67,5 +74,6 @@ 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() {} diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 8025477684931..3e951c85589f8 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -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", ]; From 74b6221209fd7ff4a9c1e07d2dd233c6b85b5722 Mon Sep 17 00:00:00 2001 From: Josef Brandl Date: Wed, 1 Mar 2017 09:56:52 +0100 Subject: [PATCH 04/10] String docs: Add "the" --- src/doc/book/src/strings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/src/strings.md b/src/doc/book/src/strings.md index ac41be11854b8..ffc9d2b697684 100644 --- a/src/doc/book/src/strings.md +++ b/src/doc/book/src/strings.md @@ -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"; From 9d99e126757ce4fd9f3278be98d87697cd5fcaeb Mon Sep 17 00:00:00 2001 From: Kevin Yap Date: Wed, 1 Mar 2017 01:01:37 -0800 Subject: [PATCH 05/10] Fix link in `if let` docs --- src/doc/book/src/if-let.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/src/if-let.md b/src/doc/book/src/if-let.md index 17bf13690009f..9eeac3d687ebf 100644 --- a/src/doc/book/src/if-let.md +++ b/src/doc/book/src/if-let.md @@ -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. From 8f1a0afee1fd34e667de11b706569d5d05573140 Mon Sep 17 00:00:00 2001 From: Josef Brandl Date: Wed, 1 Mar 2017 10:03:07 +0100 Subject: [PATCH 06/10] Unit-like structs doc: Add compile fail tag --- src/doc/book/src/structs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/src/structs.md b/src/doc/book/src/structs.md index b5fe99d04868a..9f61e5b66289b 100644 --- a/src/doc/book/src/structs.md +++ b/src/doc/book/src/structs.md @@ -255,7 +255,7 @@ 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. From 05aadd29334fa730b4860a8b51e8ffade8456266 Mon Sep 17 00:00:00 2001 From: er-1 Date: Wed, 1 Mar 2017 12:17:27 +0100 Subject: [PATCH 07/10] Add a reference to the dl library to the Makefile of the test issue-24445. It prevents the test to fail on ppc64el at least. Part of #39015 --- src/test/run-make/issue-24445/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/run-make/issue-24445/Makefile b/src/test/run-make/issue-24445/Makefile index 7a0cbfcf517b7..2ed971bf7d970 100644 --- a/src/test/run-make/issue-24445/Makefile +++ b/src/test/run-make/issue-24445/Makefile @@ -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: From 471e65571b11c5187449a83e9f8daacf6443e523 Mon Sep 17 00:00:00 2001 From: deso Date: Wed, 1 Mar 2017 05:44:50 -0800 Subject: [PATCH 08/10] doc: fix inconsistency in error output in guessing-game.md The line '.expect("failed to read line");' is partly started with a lower case 'f' and partly with an uppercase one, adding additional spurious changes to otherwise clean diffs if each sample is copy-and-pasted over the previous. This change starts the string with an uppercase everywhere which is in line with the style of the other strings. --- src/doc/book/src/guessing-game.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/doc/book/src/guessing-game.md b/src/doc/book/src/guessing-game.md index 7368d2184e5c2..4d81438b11dea 100644 --- a/src/doc/book/src/guessing-game.md +++ b/src/doc/book/src/guessing-game.md @@ -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 @@ -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); } @@ -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); @@ -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!"); @@ -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!"); @@ -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!"); @@ -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, @@ -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, From 898d0106920838d4ef8eb6be960d795d117ff05f Mon Sep 17 00:00:00 2001 From: Maik Riechert Date: Wed, 1 Mar 2017 23:06:40 +0000 Subject: [PATCH 09/10] fix wrong word used (static vs const) --- src/doc/book/src/const-and-static.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/src/const-and-static.md b/src/doc/book/src/const-and-static.md index 25b4bd94799e0..66a48566bd7c4 100644 --- a/src/doc/book/src/const-and-static.md +++ b/src/doc/book/src/const-and-static.md @@ -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"; From 0907b9d1211c501b3556c5ca2fa222890c3c7d18 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Thu, 2 Mar 2017 07:06:18 +0900 Subject: [PATCH 10/10] Add abi_x86_interrupt to the unstable book --- src/doc/unstable-book/src/SUMMARY.md | 1 + src/doc/unstable-book/src/abi-x86-interrupt.md | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 src/doc/unstable-book/src/abi-x86-interrupt.md diff --git a/src/doc/unstable-book/src/SUMMARY.md b/src/doc/unstable-book/src/SUMMARY.md index e876b4aac0dfa..5fb323d6ce909 100644 --- a/src/doc/unstable-book/src/SUMMARY.md +++ b/src/doc/unstable-book/src/SUMMARY.md @@ -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) diff --git a/src/doc/unstable-book/src/abi-x86-interrupt.md b/src/doc/unstable-book/src/abi-x86-interrupt.md new file mode 100644 index 0000000000000..c89d2ee2106c9 --- /dev/null +++ b/src/doc/unstable-book/src/abi-x86-interrupt.md @@ -0,0 +1,7 @@ +# `abi_x86_interrupt` + +The tracking issue for this feature is: [#40180] + +[#40180]: https://github.com/rust-lang/rust/issues/40180 + +------------------------