Skip to content

Rollup of 8 pull requests #59682

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

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1cfed0d
be more direct about borrow requirenments
matklad Apr 3, 2019
ab3b657
Updated the documentation of core::hints::spin_loop and core::sync::s…
Apr 3, 2019
becee90
Updated the reference in core::hint::spin_loop to the correct relativ…
Apr 3, 2019
7e37b46
Updated the environment description in rustc.
Apr 3, 2019
5b292ec
Revert rust-lld place changes.
o01eg Apr 3, 2019
c796b1f
Add tests for internal lints
flip1995 Dec 6, 2018
5c06567
Add internal lints default_hash_types and usage_of_ty_tykind
flip1995 Dec 6, 2018
4c9fb93
Uplift match_def_path from Clippy
flip1995 Dec 6, 2018
a2a8c44
Add register_internals function to `rustc_lint`
flip1995 Dec 6, 2018
157e797
Fix rebase fallout
flip1995 Feb 24, 2019
16acf7d
use check_path instead of check_expr
flip1995 Feb 28, 2019
9b2bf70
Make internal lints allow-by-default
flip1995 Mar 16, 2019
5a788f0
Fix bug in TyKind lint
flip1995 Mar 19, 2019
e536037
Deduplicate code in TyKind lint
flip1995 Mar 21, 2019
28a5c41
Check for unstable-options flag before register internals
flip1995 Mar 21, 2019
2045dfe
Update tests
flip1995 Mar 21, 2019
dfcd1ef
Add unstable-options flag to stage!=0
flip1995 Mar 31, 2019
69f74df
Deny internal lints in librustc
flip1995 Mar 31, 2019
d3f0cb9
Deny internal lints on non conflicting crates
flip1995 Mar 31, 2019
818d300
Deny internal lints on librustc_interface
flip1995 Mar 31, 2019
d2bc991
Deny internal lints on librustc_lint
flip1995 Mar 31, 2019
e4b87f5
Deny internal lints on librustc_mir
flip1995 Mar 31, 2019
4d2a3bb
Deny internal lints on librustc_typeck
flip1995 Mar 31, 2019
dd7483c
Remove TyKind arg from report_bin_hex_error function
flip1995 Apr 2, 2019
51a792d
Add trait_object_dummy_self to CommonTypes
flip1995 Apr 3, 2019
076abfa
Deny internal lints on two more crates
flip1995 Apr 3, 2019
c81ce06
Compare `Ty`s directly instead of their `TyKind`s
flip1995 Apr 3, 2019
4ef32a4
std: Avoid usage of `Once` in `Instant`
alexcrichton Apr 3, 2019
da99f46
rustfix coverage: Skip UI tests with non-json error-format
phansch Apr 3, 2019
fba110c
reduce repetition in librustc(_lint) wrt. impl LintPass
Centril Apr 3, 2019
714f282
Rollup merge of #59316 - flip1995:internal_lints_take_2, r=oli-obk
Centril Apr 3, 2019
b3fa795
Rollup merge of #59663 - matklad:borrow, r=dtolnay
Centril Apr 3, 2019
8fbba80
Rollup merge of #59664 - DevQps:improve-yield-spinlock-docs, r=alexcr…
Centril Apr 3, 2019
e598853
Rollup merge of #59666 - DevQps:update-rustc-environment-descriptions…
Centril Apr 3, 2019
79e1dd9
Rollup merge of #59669 - Centril:lint-pass-macro, r=oli-obk
Centril Apr 3, 2019
fa2dfda
Rollup merge of #59672 - o01eg:fix-59661, r=oli-obk
Centril Apr 3, 2019
ae5038f
Rollup merge of #59676 - alexcrichton:osx-deadlock, r=sfackler
Centril Apr 3, 2019
f5f8547
Rollup merge of #59677 - phansch:rustfix_coverage_handle_other_error_…
Centril Apr 3, 2019
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
Prev Previous commit
Next Next commit
Updated the documentation of core::hints::spin_loop and core::sync::s…
…pin_loop_hint
  • Loading branch information
Christian committed Apr 3, 2019
commit ab3b65737380d2c2a15a868452026df49c58131a
27 changes: 20 additions & 7 deletions src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,28 @@ pub unsafe fn unreachable_unchecked() -> ! {
intrinsics::unreachable()
}

/// Save power or switch hyperthreads in a busy-wait spin-loop.
/// Signals the processor that it is entering a busy-wait spin-loop.
///
/// This function is deliberately more primitive than
/// [`std::thread::yield_now`](../../std/thread/fn.yield_now.html) and
/// does not directly yield to the system's scheduler.
/// In some cases it might be useful to use a combination of both functions.
/// Careful benchmarking is advised.
/// Upon receiving spin-loop signal the processor can optimize its behavior by, for example, saving
/// power or switching hyper-threads.
///
/// On some platforms this function may not do anything at all.
/// This function is different than [`std::thread::yield_now`] which directly yields to the
/// system's scheduler, whereas `spin_loop` only signals the processor that it is entering a
/// busy-wait spin-loop without yielding control to the system's scheduler.
///
/// Using a busy-wait spin-loop with `spin_loop` is ideally used in situations where a
/// contended lock is held by another thread executed on a different CPU and where the waiting
/// times are relatively small. Because entering busy-wait spin-loop does not trigger the system's
/// scheduler, no overhead for switching threads occurs. However, if the thread holding the
/// contended lock is running on the same CPU, the spin-loop is likely to occupy an entire CPU slice
/// before switching to the thread that holds the lock. If the contending lock is held by a thread
/// on the same CPU or if the waiting times for acquiring the lock are longer, it is often better to
/// use [`std::thread::yield_now`].
///
/// **Note**: On platforms that do not support receiving spin-loop hints this function does not
/// do anything at all.
///
/// [`std::thread::yield_now`]: ../../../std/thread/fn.yield_now.html
#[inline]
#[unstable(feature = "renamed_spin_loop", issue = "55002")]
pub fn spin_loop() {
Expand Down
27 changes: 20 additions & 7 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,28 @@ use fmt;

use hint::spin_loop;

/// Save power or switch hyperthreads in a busy-wait spin-loop.
/// Signals the processor that it is entering a busy-wait spin-loop.
///
/// This function is deliberately more primitive than
/// [`std::thread::yield_now`](../../../std/thread/fn.yield_now.html) and
/// does not directly yield to the system's scheduler.
/// In some cases it might be useful to use a combination of both functions.
/// Careful benchmarking is advised.
/// Upon receiving spin-loop signal the processor can optimize its behavior by, for example, saving
/// power or switching hyper-threads.
///
/// On some platforms this function may not do anything at all.
/// This function is different than [`std::thread::yield_now`] which directly yields to the
/// system's scheduler, whereas `spin_loop_hint` only signals the processor that it is entering a
/// busy-wait spin-loop without yielding control to the system's scheduler.
///
/// Using a busy-wait spin-loop with `spin_loop_hint` is ideally used in situations where a
/// contended lock is held by another thread executed on a different CPU and where the waiting
/// times are relatively small. Because entering busy-wait spin-loop does not trigger the system's
/// scheduler, no overhead for switching threads occurs. However, if the thread holding the
/// contended lock is running on the same CPU, the spin-loop is likely to occupy an entire CPU slice
/// before switching to the thread that holds the lock. If the contending lock is held by a thread
/// on the same CPU or if the waiting times for acquiring the lock are longer, it is often better to
/// use [`std::thread::yield_now`].
///
/// **Note**: On platforms that do not support receiving spin-loop hints this function does not
/// do anything at all.
///
/// [`std::thread::yield_now`]: ../../../std/thread/fn.yield_now.html
#[inline]
#[stable(feature = "spin_loop_hint", since = "1.24.0")]
pub fn spin_loop_hint() {
Expand Down