Skip to content

Commit

Permalink
Auto merge of #68011 - JohnTitor:rollup-44s8twu, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - #67774 (Try statx for all linux-gnu target.)
 - #67781 (Move `is_min_const_fn` query to librustc_mir.)
 - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs)
 - #67849 (Add a check for swapped words when we can't find an identifier)
 - #67875 (Distinguish between private items and hidden items in rustdoc)
 - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`)
 - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates)
 - #67977 (Updates for VxWorks)
 - #67985 (Remove insignificant notes from CStr documentation)
 - #68003 (ci: fix wrong shared.sh import for publish_toolstate)

Failed merges:

 - #67820 (Parse the syntax described in RFC 2632)
 - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup)

r? @ghost
  • Loading branch information
bors committed Jan 8, 2020
2 parents ed6468d + 844530e commit caa231d
Show file tree
Hide file tree
Showing 47 changed files with 537 additions and 385 deletions.
2 changes: 1 addition & 1 deletion src/ci/publish_toolstate.sh
Expand Up @@ -3,7 +3,7 @@
set -euo pipefail
IFS=$'\n\t'

source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
source "$(cd "$(dirname "$0")" && pwd)/shared.sh"

# The following lines are also found in src/bootstrap/toolstate.rs,
# so if updating here, please also update that file.
Expand Down
6 changes: 6 additions & 0 deletions src/libcore/option.rs
Expand Up @@ -341,6 +341,7 @@ impl<T> Option<T> {
/// x.expect("the world is ending"); // panics with `the world is ending`
/// ```
#[inline]
#[track_caller]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn expect(self, msg: &str) -> T {
match self {
Expand Down Expand Up @@ -374,6 +375,7 @@ impl<T> Option<T> {
/// assert_eq!(x.unwrap(), "air"); // fails
/// ```
#[inline]
#[track_caller]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap(self) -> T {
match self {
Expand Down Expand Up @@ -1015,6 +1017,7 @@ impl<T: fmt::Debug> Option<T> {
/// }
/// ```
#[inline]
#[track_caller]
#[unstable(feature = "option_expect_none", reason = "newly added", issue = "62633")]
pub fn expect_none(self, msg: &str) {
if let Some(val) = self {
Expand Down Expand Up @@ -1057,6 +1060,7 @@ impl<T: fmt::Debug> Option<T> {
/// }
/// ```
#[inline]
#[track_caller]
#[unstable(feature = "option_unwrap_none", reason = "newly added", issue = "62633")]
pub fn unwrap_none(self) {
if let Some(val) = self {
Expand Down Expand Up @@ -1184,13 +1188,15 @@ impl<T, E> Option<Result<T, E>> {
// This is a separate function to reduce the code size of .expect() itself.
#[inline(never)]
#[cold]
#[track_caller]
fn expect_failed(msg: &str) -> ! {
panic!("{}", msg)
}

// This is a separate function to reduce the code size of .expect_none() itself.
#[inline(never)]
#[cold]
#[track_caller]
fn expect_none_failed(msg: &str, value: &dyn fmt::Debug) -> ! {
panic!("{}: {:?}", msg, value)
}
Expand Down
5 changes: 5 additions & 0 deletions src/libcore/result.rs
Expand Up @@ -957,6 +957,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
/// x.unwrap(); // panics with `emergency failure`
/// ```
#[inline]
#[track_caller]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap(self) -> T {
match self {
Expand Down Expand Up @@ -984,6 +985,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
/// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
/// ```
#[inline]
#[track_caller]
#[stable(feature = "result_expect", since = "1.4.0")]
pub fn expect(self, msg: &str) -> T {
match self {
Expand Down Expand Up @@ -1017,6 +1019,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
/// assert_eq!(x.unwrap_err(), "emergency failure");
/// ```
#[inline]
#[track_caller]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_err(self) -> E {
match self {
Expand Down Expand Up @@ -1044,6 +1047,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
/// x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
/// ```
#[inline]
#[track_caller]
#[stable(feature = "result_expect_err", since = "1.17.0")]
pub fn expect_err(self, msg: &str) -> E {
match self {
Expand Down Expand Up @@ -1188,6 +1192,7 @@ impl<T, E> Result<Option<T>, E> {
// This is a separate function to reduce the code size of the methods
#[inline(never)]
#[cold]
#[track_caller]
fn unwrap_failed(msg: &str, error: &dyn fmt::Debug) -> ! {
panic!("{}: {:?}", msg, error)
}
Expand Down
14 changes: 4 additions & 10 deletions src/libcore/sync/atomic.rs
Expand Up @@ -134,16 +134,10 @@ use crate::hint::spin_loop;
/// This function is different from [`std::thread::yield_now`] which directly yields to the
/// system's scheduler, whereas `spin_loop_hint` does not interact with the operating system.
///
/// Spin locks can be very efficient for short lock durations because they do not involve context
/// switches or interaction with the operating system. For long lock durations they become wasteful
/// however because they use CPU cycles for the entire lock duration, and using a
/// [`std::sync::Mutex`] is likely the better approach. If actively spinning for a long time is
/// required, e.g. because code polls a non-blocking API, calling [`std::thread::yield_now`]
/// or [`std::thread::sleep`] may be the best option.
///
/// **Note**: Spin locks are based on the underlying assumption that another thread will release
/// the lock 'soon'. In order for this to work, that other thread must run on a different CPU or
/// core (at least potentially). Spin locks do not work efficiently on single CPU / core platforms.
/// A common use case for `spin_loop_hint` is implementing bounded optimistic spinning in a CAS
/// loop in synchronization primitives. To avoid problems like priority inversion, it is strongly
/// recommended that the spin loop is terminated after a finite amount of iterations and an
/// appropriate blocking syscall is made.
///
/// **Note**: On platforms that do not support receiving spin-loop hints this function does not
/// do anything at all.
Expand Down
156 changes: 0 additions & 156 deletions src/librustc/ty/constness.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/librustc/ty/mod.rs
Expand Up @@ -97,7 +97,6 @@ pub mod cast;
#[macro_use]
pub mod codec;
pub mod _match;
mod constness;
mod erase_regions;
pub mod error;
pub mod fast_reject;
Expand Down Expand Up @@ -3318,7 +3317,6 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
context::provide(providers);
erase_regions::provide(providers);
layout::provide(providers);
constness::provide(providers);
*providers = ty::query::Providers {
asyncness,
associated_item,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_mir/const_eval.rs
Expand Up @@ -9,10 +9,12 @@ use crate::interpret::{intern_const_alloc_recursive, ConstValue, InterpCx};

mod error;
mod eval_queries;
mod fn_queries;
mod machine;

pub use error::*;
pub use eval_queries::*;
pub use fn_queries::*;
pub use machine::*;

/// Extracts a field of a (variant of a) const.
Expand Down

0 comments on commit caa231d

Please sign in to comment.