Auto merge of #57765 - Mark-Simulacrum:bootstrap-bump, r=alexcrichton

Bump bootstrap compiler to 1.33 beta

r? @alexcrichton or @pietroalbini

cc @rust-lang/release
This commit is contained in:
bors 2019-01-27 18:18:17 +00:00
commit 8611577360
58 changed files with 182 additions and 243 deletions

View File

@ -204,7 +204,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cargo"
version = "0.34.0"
version = "0.35.0"
dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -212,7 +212,7 @@ dependencies = [
"bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crates-io 0.22.0",
"crates-io 0.23.0",
"crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
@ -496,7 +496,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "crates-io"
version = "0.22.0"
version = "0.23.0"
dependencies = [
"curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2113,7 +2113,7 @@ dependencies = [
name = "rls"
version = "1.31.6"
dependencies = [
"cargo 0.34.0",
"cargo 0.35.0",
"cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy_lints 0.0.212",
"crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -21,7 +21,7 @@ use crate::install;
use crate::native;
use crate::test;
use crate::tool;
use crate::util::{add_lib_path, exe, libdir};
use crate::util::{self, add_lib_path, exe, libdir};
use crate::{Build, DocTests, Mode, GitRepo};
pub use crate::Compiler;
@ -791,6 +791,13 @@ impl<'a> Builder<'a> {
.env("CARGO_TARGET_DIR", out_dir)
.arg(cmd);
// See comment in librustc_llvm/build.rs for why this is necessary, largely llvm-config
// needs to not accidentally link to libLLVM in stage0/lib.
cargo.env("REAL_LIBRARY_PATH_VAR", &util::dylib_path_var());
if let Some(e) = env::var_os(util::dylib_path_var()) {
cargo.env("REAL_LIBRARY_PATH", e);
}
if cmd != "install" {
cargo.arg("--target")
.arg(target);

View File

@ -14,7 +14,7 @@ use crate::Build;
use crate::config::Config;
// The version number
pub const CFG_RELEASE_NUM: &str = "1.33.0";
pub const CFG_RELEASE_NUM: &str = "1.34.0";
pub struct GitInfo {
inner: Option<Info>,

View File

@ -712,6 +712,7 @@ pub fn build_codegen_backend(builder: &Builder,
if builder.is_rust_llvm(target) && backend != "emscripten" {
cargo.env("LLVM_RUSTLLVM", "1");
}
cargo.env("LLVM_CONFIG", &llvm_config);
if backend != "emscripten" {
let target_config = builder.config.target_config.get(&target);

View File

@ -226,7 +226,7 @@ fn make_win_dist(
let trim_chars: &[_] = &[' ', '='];
let value =
line[(idx + 1)..]
.trim_left_matches(trim_chars)
.trim_start_matches(trim_chars)
.split(';')
.map(PathBuf::from);

View File

@ -423,7 +423,7 @@ impl Build {
Command::new(&build.initial_rustc).arg("--version").arg("--verbose"));
let local_release = local_version_verbose
.lines().filter(|x| x.starts_with("release:"))
.next().unwrap().trim_left_matches("release:").trim();
.next().unwrap().trim_start_matches("release:").trim();
let my_version = channel::CFG_RELEASE_NUM;
if local_release.split('.').take(2).eq(my_version.split('.').take(2)) {
build.verbose(&format!("auto-detected local-rebuild {}", local_release));

View File

@ -70,7 +70,11 @@ pub fn dylib_path_var() -> &'static str {
/// Parses the `dylib_path_var()` environment variable, returning a list of
/// paths that are members of this lookup path.
pub fn dylib_path() -> Vec<PathBuf> {
env::split_paths(&env::var_os(dylib_path_var()).unwrap_or_default()).collect()
let var = match env::var_os(dylib_path_var()) {
Some(v) => v,
None => return vec![],
};
env::split_paths(&var).collect()
}
/// `push` all components to `buf`. On windows, append `.exe` to the last component.

View File

@ -23,6 +23,25 @@ macro_rules! t {
};
}
// Because Cargo adds the compiler's dylib path to our library search path, llvm-config may
// break: the dylib path for the compiler, as of this writing, contains a copy of the LLVM
// shared library, which means that when our freshly built llvm-config goes to load it's
// associated LLVM, it actually loads the compiler's LLVM. In particular when building the first
// compiler (i.e., in stage 0) that's a problem, as the compiler's LLVM is likely different from
// the one we want to use. As such, we restore the environment to what bootstrap saw. This isn't
// perfect -- we might actually want to see something from Cargo's added library paths -- but
// for now it works.
pub fn restore_library_path() {
println!("cargo:rerun-if-env-changed=REAL_LIBRARY_PATH_VAR");
println!("cargo:rerun-if-env-changed=REAL_LIBRARY_PATH");
let key = env::var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
if let Some(env) = env::var_os("REAL_LIBRARY_PATH") {
env::set_var(&key, &env);
} else {
env::remove_var(&key);
}
}
pub fn run(cmd: &mut Command) {
println!("running: {:?}", cmd);
run_silent(cmd);

View File

@ -1,4 +1,3 @@
#![cfg_attr(stage0, feature(duration_as_u128))]
use std::{collections::VecDeque, time::Instant};
const VECDEQUE_LEN: i32 = 100000;

View File

@ -2,7 +2,7 @@ use std::cmp;
use std::collections::BinaryHeap;
use std::collections::binary_heap::{Drain, PeekMut};
use std::panic::{self, AssertUnwindSafe};
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
use rand::{thread_rng, seq::SliceRandom};
@ -283,7 +283,7 @@ fn assert_covariance() {
// Destructors must be called exactly once per element.
#[test]
fn panic_safe() {
static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
#[derive(Eq, PartialEq, Ord, Clone, Debug)]
struct PanicOrd<T>(T, bool);

View File

@ -5,7 +5,7 @@ use std::mem;
use std::panic;
use std::rc::Rc;
use std::sync::atomic::Ordering::Relaxed;
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize};
use std::sync::atomic::AtomicUsize;
use std::thread;
use rand::{Rng, RngCore, thread_rng, seq::SliceRandom};
@ -1500,7 +1500,7 @@ static DROP_COUNTS: [AtomicUsize; MAX_LEN] = [
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
];
static VERSIONS: AtomicUsize = ATOMIC_USIZE_INIT;
static VERSIONS: AtomicUsize = AtomicUsize::new(0);
#[derive(Clone, Eq)]
struct DropCounter {

View File

@ -692,7 +692,6 @@ extern "rust-intrinsic" {
/// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited:
/// This will statically either panic, or do nothing.
#[cfg(not(stage0))]
pub fn panic_if_uninhabited<T>();
/// Creates a value initialized to zero.

View File

@ -71,7 +71,6 @@
#![feature(cfg_target_has_atomic)]
#![feature(concat_idents)]
#![feature(const_fn)]
#![cfg_attr(stage0, feature(const_int_ops))]
#![feature(const_fn_union)]
#![feature(custom_attribute)]
#![feature(doc_cfg)]
@ -112,19 +111,17 @@
#![feature(aarch64_target_feature)]
#![feature(wasm_target_feature)]
#![feature(avx512_target_feature)]
#![cfg_attr(not(stage0), feature(cmpxchg16b_target_feature))]
#![feature(cmpxchg16b_target_feature)]
#![feature(const_slice_len)]
#![feature(const_str_as_bytes)]
#![feature(const_str_len)]
#![cfg_attr(stage0, feature(const_let))]
#![cfg_attr(stage0, feature(const_int_rotate))]
#![feature(const_int_conversion)]
#![feature(const_transmute)]
#![feature(reverse_bits)]
#![feature(non_exhaustive)]
#![feature(structural_match)]
#![feature(abi_unadjusted)]
#![cfg_attr(not(stage0), feature(adx_target_feature))]
#![feature(adx_target_feature)]
#[prelude_import]
#[allow(unused)]

View File

@ -491,7 +491,6 @@ pub const fn needs_drop<T>() -> bool {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn zeroed<T>() -> T {
#[cfg(not(stage0))]
intrinsics::panic_if_uninhabited::<T>();
intrinsics::init()
}
@ -625,7 +624,6 @@ pub unsafe fn zeroed<T>() -> T {
#[rustc_deprecated(since = "2.0.0", reason = "use `mem::MaybeUninit::uninitialized` instead")]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn uninitialized<T>() -> T {
#[cfg(not(stage0))]
intrinsics::panic_if_uninhabited::<T>();
intrinsics::uninit()
}
@ -1104,7 +1102,6 @@ impl<T> MaybeUninit<T> {
#[unstable(feature = "maybe_uninit", issue = "53491")]
#[inline(always)]
pub unsafe fn into_inner(self) -> T {
#[cfg(not(stage0))]
intrinsics::panic_if_uninhabited::<T>();
ManuallyDrop::into_inner(self.value)
}

View File

@ -46,17 +46,6 @@ macro_rules! impl_full_ops {
($($ty:ty: add($addfn:path), mul/div($bigty:ident);)*) => (
$(
impl FullOps for $ty {
#[cfg(stage0)]
fn full_add(self, other: $ty, carry: bool) -> (bool, $ty) {
// This cannot overflow; the output is between `0` and `2 * 2^nbits - 1`.
// FIXME: will LLVM optimize this into ADC or similar?
let (v, carry1) = unsafe { intrinsics::add_with_overflow(self, other) };
let (v, carry2) = unsafe {
intrinsics::add_with_overflow(v, if carry {1} else {0})
};
(carry1 || carry2, v)
}
#[cfg(not(stage0))]
fn full_add(self, other: $ty, carry: bool) -> (bool, $ty) {
// This cannot overflow; the output is between `0` and `2 * 2^nbits - 1`.
// FIXME: will LLVM optimize this into ADC or similar?

View File

@ -281,7 +281,6 @@ $EndFeature, "
```
"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() }
}
@ -297,7 +296,6 @@ Basic usage:
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn count_zeros(self) -> u32 {
(!self).count_ones()
@ -318,7 +316,6 @@ assert_eq!(n.leading_zeros(), 0);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn leading_zeros(self) -> u32 {
(self as $UnsignedT).leading_zeros()
@ -339,7 +336,6 @@ assert_eq!(n.trailing_zeros(), 2);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn trailing_zeros(self) -> u32 {
(self as $UnsignedT).trailing_zeros()
@ -363,7 +359,6 @@ let m = ", $rot_result, ";
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_left(self, n: u32) -> Self {
(self as $UnsignedT).rotate_left(n) as Self
@ -388,7 +383,6 @@ let m = ", $rot_op, ";
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_right(self, n: u32) -> Self {
(self as $UnsignedT).rotate_right(n) as Self
@ -410,7 +404,6 @@ let m = n.swap_bytes();
assert_eq!(m, ", $swapped, ");
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn swap_bytes(self) -> Self {
(self as $UnsignedT).swap_bytes() as Self
@ -460,7 +453,6 @@ if cfg!(target_endian = \"big\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn from_be(x: Self) -> Self {
#[cfg(target_endian = "big")]
@ -494,7 +486,6 @@ if cfg!(target_endian = \"little\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn from_le(x: Self) -> Self {
#[cfg(target_endian = "little")]
@ -528,7 +519,6 @@ if cfg!(target_endian = \"big\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn to_be(self) -> Self { // or not to be?
#[cfg(target_endian = "big")]
@ -562,7 +552,6 @@ if cfg!(target_endian = \"little\") {
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn to_le(self) -> Self {
#[cfg(target_endian = "little")]
@ -998,14 +987,8 @@ assert_eq!(", stringify!($SelfT), "::max_value().wrapping_add(2), ", stringify!(
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
#[cfg(stage0)]
unsafe {
intrinsics::overflowing_add(self, rhs)
}
#[cfg(not(stage0))]
intrinsics::overflowing_add(self, rhs)
}
}
@ -1025,14 +1008,8 @@ stringify!($SelfT), "::max_value());",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
#[cfg(stage0)]
unsafe {
intrinsics::overflowing_sub(self, rhs)
}
#[cfg(not(stage0))]
intrinsics::overflowing_sub(self, rhs)
}
}
@ -1051,14 +1028,8 @@ assert_eq!(11i8.wrapping_mul(12), -124);",
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
#[cfg(stage0)]
unsafe {
intrinsics::overflowing_mul(self, rhs)
}
#[cfg(not(stage0))]
intrinsics::overflowing_mul(self, rhs)
}
}
@ -1218,7 +1189,6 @@ assert_eq!((-1", stringify!($SelfT), ").wrapping_shl(128), -1);",
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_shl(self, rhs: u32) -> Self {
unsafe {
@ -1246,7 +1216,6 @@ assert_eq!((-128i16).wrapping_shr(64), -128);",
$EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_shr(self, rhs: u32) -> Self {
unsafe {
@ -1343,14 +1312,8 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($Sel
"::MIN, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) {
#[cfg(stage0)]
let (a, b) = unsafe {
intrinsics::add_with_overflow(self as $ActualT, rhs as $ActualT)
};
#[cfg(not(stage0))]
let (a, b) = intrinsics::add_with_overflow(self as $ActualT, rhs as $ActualT);
(a as Self, b)
}
@ -1374,14 +1337,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($Sel
"::MAX, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
#[cfg(stage0)]
let (a, b) = unsafe {
intrinsics::sub_with_overflow(self as $ActualT, rhs as $ActualT)
};
#[cfg(not(stage0))]
let (a, b) = intrinsics::sub_with_overflow(self as $ActualT, rhs as $ActualT);
(a as Self, b)
}
@ -1403,14 +1360,8 @@ assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));",
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
#[cfg(stage0)]
let (a, b) = unsafe {
intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT)
};
#[cfg(not(stage0))]
let (a, b) = intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT);
(a as Self, b)
}
@ -1594,7 +1545,6 @@ assert_eq!(0x1i32.overflowing_shl(36), (0x10, true));",
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
(self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
@ -1618,7 +1568,6 @@ assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));",
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
(self.wrapping_shr(rhs), (rhs > ($BITS - 1)))
@ -2242,13 +2191,9 @@ Basic usage:
assert_eq!(n.count_ones(), 3);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn count_ones(self) -> u32 {
#[cfg(stage0)]
unsafe { intrinsics::ctpop(self as $ActualT) as u32 }
#[cfg(not(stage0))]
{ intrinsics::ctpop(self as $ActualT) as u32 }
intrinsics::ctpop(self as $ActualT) as u32
}
}
@ -2263,7 +2208,6 @@ Basic usage:
", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn count_zeros(self) -> u32 {
(!self).count_ones()
@ -2283,13 +2227,9 @@ Basic usage:
assert_eq!(n.leading_zeros(), 2);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn leading_zeros(self) -> u32 {
#[cfg(stage0)]
unsafe { intrinsics::ctlz(self as $ActualT) as u32 }
#[cfg(not(stage0))]
{ intrinsics::ctlz(self as $ActualT) as u32 }
intrinsics::ctlz(self as $ActualT) as u32
}
}
@ -2307,13 +2247,9 @@ Basic usage:
assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn trailing_zeros(self) -> u32 {
#[cfg(stage0)]
unsafe { intrinsics::cttz(self) as u32 }
#[cfg(not(stage0))]
{ intrinsics::cttz(self) as u32 }
intrinsics::cttz(self) as u32
}
}
@ -2334,12 +2270,8 @@ let m = ", $rot_result, ";
assert_eq!(n.rotate_left(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_left(self, n: u32) -> Self {
#[cfg(stage0)]
unsafe { intrinsics::rotate_left(self, n as $SelfT) }
#[cfg(not(stage0))]
intrinsics::rotate_left(self, n as $SelfT)
}
}
@ -2362,12 +2294,8 @@ let m = ", $rot_op, ";
assert_eq!(n.rotate_right(", $rot, "), m);
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_rotate"))]
#[inline]
pub const fn rotate_right(self, n: u32) -> Self {
#[cfg(stage0)]
unsafe { intrinsics::rotate_right(self, n as $SelfT) }
#[cfg(not(stage0))]
intrinsics::rotate_right(self, n as $SelfT)
}
}
@ -2387,13 +2315,9 @@ let m = n.swap_bytes();
assert_eq!(m, ", $swapped, ");
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn swap_bytes(self) -> Self {
#[cfg(stage0)]
unsafe { intrinsics::bswap(self as $ActualT) as Self }
#[cfg(not(stage0))]
{ intrinsics::bswap(self as $ActualT) as Self }
intrinsics::bswap(self as $ActualT) as Self
}
}
@ -2413,13 +2337,9 @@ let m = n.reverse_bits();
assert_eq!(m, ", $reversed, ");
```"),
#[unstable(feature = "reverse_bits", issue = "48763")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_conversion"))]
#[inline]
pub const fn reverse_bits(self) -> Self {
#[cfg(stage0)]
unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
#[cfg(not(stage0))]
{ intrinsics::bitreverse(self as $ActualT) as Self }
intrinsics::bitreverse(self as $ActualT) as Self
}
}
@ -2443,7 +2363,6 @@ if cfg!(target_endian = \"big\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn from_be(x: Self) -> Self {
#[cfg(target_endian = "big")]
@ -2477,7 +2396,6 @@ if cfg!(target_endian = \"little\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn from_le(x: Self) -> Self {
#[cfg(target_endian = "little")]
@ -2511,7 +2429,6 @@ if cfg!(target_endian = \"big\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn to_be(self) -> Self { // or not to be?
#[cfg(target_endian = "big")]
@ -2545,7 +2462,6 @@ if cfg!(target_endian = \"little\") {
}", $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_ops"))]
#[inline]
pub const fn to_le(self) -> Self {
#[cfg(target_endian = "little")]
@ -2918,14 +2834,8 @@ assert_eq!(200", stringify!($SelfT), ".wrapping_add(", stringify!($SelfT), "::ma
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
#[cfg(stage0)]
unsafe {
intrinsics::overflowing_add(self, rhs)
}
#[cfg(not(stage0))]
intrinsics::overflowing_add(self, rhs)
}
}
@ -2944,14 +2854,8 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_sub(", stringify!($SelfT), "::ma
$EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
#[cfg(stage0)]
unsafe {
intrinsics::overflowing_sub(self, rhs)
}
#[cfg(not(stage0))]
intrinsics::overflowing_sub(self, rhs)
}
}
@ -2971,14 +2875,8 @@ $EndFeature, "
/// assert_eq!(25u8.wrapping_mul(12), 44);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
#[cfg(stage0)]
unsafe {
intrinsics::overflowing_mul(self, rhs)
}
#[cfg(not(stage0))]
intrinsics::overflowing_mul(self, rhs)
}
@ -3124,7 +3022,6 @@ Basic usage:
assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_shl(self, rhs: u32) -> Self {
unsafe {
@ -3154,7 +3051,6 @@ Basic usage:
assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, "
```"),
#[stable(feature = "num_wrapping", since = "1.2.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_wrapping"))]
#[inline]
pub const fn wrapping_shr(self, rhs: u32) -> Self {
unsafe {
@ -3218,14 +3114,8 @@ assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));
assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) {
#[cfg(stage0)]
let (a, b) = unsafe {
intrinsics::add_with_overflow(self as $ActualT, rhs as $ActualT)
};
#[cfg(not(stage0))]
let (a, b) = intrinsics::add_with_overflow(self as $ActualT, rhs as $ActualT);
(a as Self, b)
}
@ -3250,14 +3140,8 @@ assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT),
$EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
#[cfg(stage0)]
let (a, b) = unsafe {
intrinsics::sub_with_overflow(self as $ActualT, rhs as $ActualT)
};
#[cfg(not(stage0))]
let (a, b) = intrinsics::sub_with_overflow(self as $ActualT, rhs as $ActualT);
(a as Self, b)
}
@ -3281,14 +3165,8 @@ $EndFeature, "
/// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true));
/// ```
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
#[cfg(stage0)]
let (a, b) = unsafe {
intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT)
};
#[cfg(not(stage0))]
let (a, b) = intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT);
(a as Self, b)
}
@ -3447,7 +3325,6 @@ Basic usage
assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
(self.wrapping_shl(rhs), (rhs > ($BITS - 1)))
@ -3472,7 +3349,6 @@ Basic usage
assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, "
```"),
#[stable(feature = "wrapping", since = "1.7.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_int_overflowing"))]
#[inline]
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
(self.wrapping_shr(rhs), (rhs > ($BITS - 1)))

View File

@ -171,7 +171,7 @@ impl<T: ?Sized> DerefMut for &mut T {
/// Indicates that a struct can be used as a method receiver, without the
/// `arbitrary_self_types` feature. This is implemented by stdlib pointer types like `Box<T>`,
/// `Rc<T>`, `&T`, and `Pin<P>`.
#[cfg_attr(not(stage0), lang = "receiver")]
#[lang = "receiver"]
#[unstable(feature = "receiver_trait", issue = "0")]
#[doc(hidden)]
pub trait Receiver {

View File

@ -2413,12 +2413,11 @@ pub fn fence(order: Ordering) {
///
/// ```
/// use std::sync::atomic::{AtomicBool, AtomicUsize};
/// use std::sync::atomic::{ATOMIC_BOOL_INIT, ATOMIC_USIZE_INIT};
/// use std::sync::atomic::Ordering;
/// use std::sync::atomic::compiler_fence;
///
/// static IMPORTANT_VARIABLE: AtomicUsize = ATOMIC_USIZE_INIT;
/// static IS_READY: AtomicBool = ATOMIC_BOOL_INIT;
/// static IMPORTANT_VARIABLE: AtomicUsize = AtomicUsize::new(0);
/// static IS_READY: AtomicBool = AtomicBool::new(false);
///
/// fn main() {
/// IMPORTANT_VARIABLE.store(42, Ordering::Relaxed);

View File

@ -12,7 +12,6 @@
#![panic_runtime]
#![allow(unused_features)]
#![cfg_attr(stage0, feature(cfg_target_vendor))]
#![feature(core_intrinsics)]
#![feature(libc)]
#![feature(nll)]

View File

@ -8,6 +8,8 @@ use cmake::Config;
fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();
let (native, target) = match sanitizer_lib_boilerplate("asan") {
Ok(native) => native,
_ => return,

View File

@ -91,7 +91,7 @@ use std::panic;
use std::path::{PathBuf, Path};
use std::process::{self, Command, Stdio};
use std::str;
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Once, ONCE_INIT};
use std::thread;
@ -254,7 +254,7 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend> {
// general this assertion never trips due to the once guard in `get_codegen_backend`,
// but there's a few manual calls to this function in this file we protect
// against.
static LOADED: AtomicBool = ATOMIC_BOOL_INIT;
static LOADED: AtomicBool = AtomicBool::new(false);
assert!(!LOADED.fetch_or(true, Ordering::SeqCst),
"cannot load the default codegen backend twice");

View File

@ -24,6 +24,8 @@ fn main() {
return;
}
build_helper::restore_library_path();
let target = env::var("TARGET").expect("TARGET was not set");
let llvm_config = env::var_os("LLVM_CONFIG")
.map(PathBuf::from)

View File

@ -8,6 +8,8 @@ use cmake::Config;
fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();
let (native, target) = match sanitizer_lib_boilerplate("lsan") {
Ok(native) => native,
_ => return,

View File

@ -1127,9 +1127,9 @@ A borrow of a constant containing interior mutability was attempted. Erroneous
code example:
```compile_fail,E0492
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
use std::sync::atomic::AtomicUsize;
const A: AtomicUsize = ATOMIC_USIZE_INIT;
const A: AtomicUsize = AtomicUsize::new(0);
static B: &'static AtomicUsize = &A;
// error: cannot borrow a constant which may contain interior mutability,
// create a static instead
@ -1145,9 +1145,9 @@ explicitly a single memory location, which can be mutated at will.
So, in order to solve this error, either use statics which are `Sync`:
```
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
use std::sync::atomic::AtomicUsize;
static A: AtomicUsize = ATOMIC_USIZE_INIT;
static A: AtomicUsize = AtomicUsize::new(0);
static B: &'static AtomicUsize = &A; // ok!
```

View File

@ -24,10 +24,8 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(unicode_internals)]
#![feature(step_trait)]
#![feature(slice_concat_ext)]
#![cfg_attr(stage0, feature(if_while_or_patterns))]
#![feature(try_from)]
#![feature(reverse_bits)]
#![cfg_attr(stage0, feature(underscore_imports))]
#![recursion_limit="256"]

View File

@ -8,6 +8,8 @@ use cmake::Config;
fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();
let (native, target) = match sanitizer_lib_boilerplate("msan") {
Ok(native) => native,
_ => return,

View File

@ -8,6 +8,8 @@ use cmake::Config;
fn main() {
if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
build_helper::restore_library_path();
let (native, target) = match sanitizer_lib_boilerplate("tsan") {
Ok(native) => native,
_ => return,

View File

@ -95,11 +95,11 @@ pub use alloc_crate::alloc::*;
///
/// ```rust
/// use std::alloc::{System, GlobalAlloc, Layout};
/// use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering::SeqCst};
/// use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
///
/// struct Counter;
///
/// static ALLOCATED: AtomicUsize = ATOMIC_USIZE_INIT;
/// static ALLOCATED: AtomicUsize = AtomicUsize::new(0);
///
/// unsafe impl GlobalAlloc for Counter {
/// unsafe fn alloc(&self, layout: Layout) -> *mut u8 {

View File

@ -234,12 +234,9 @@
#![feature(c_variadic)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_thread_local)]
#![cfg_attr(stage0, feature(cfg_target_vendor))]
#![feature(char_error_internals)]
#![feature(compiler_builtins_lib)]
#![feature(concat_idents)]
#![cfg_attr(stage0, feature(const_int_ops))]
#![cfg_attr(stage0, feature(const_ip))]
#![feature(const_raw_ptr_deref)]
#![feature(const_cstr_unchecked)]
#![feature(core_intrinsics)]

View File

@ -328,7 +328,6 @@ impl Ipv4Addr {
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, rustc_const_unstable(feature = "const_ip"))]
pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
Ipv4Addr {
inner: c::in_addr {

View File

@ -2,13 +2,13 @@
use collections::BTreeMap;
use ptr;
use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use sync::atomic::{AtomicUsize, Ordering};
pub type Key = usize;
type Dtor = unsafe extern fn(*mut u8);
static NEXT_KEY: AtomicUsize = ATOMIC_USIZE_INIT;
static NEXT_KEY: AtomicUsize = AtomicUsize::new(0);
static mut KEYS: *mut BTreeMap<Key, Option<Dtor>> = ptr::null_mut();

View File

@ -1,4 +1,4 @@
use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use sync::atomic::{AtomicUsize, Ordering};
use ptr;
use mem;
use cell::Cell;
@ -15,7 +15,40 @@ macro_rules! dup {
((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* ));
(() $($val:tt)*) => ([$($val),*])
}
static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) ATOMIC_USIZE_INIT);
static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = [
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
];
extern "C" {
fn get_tls_ptr() -> *const u8;
@ -119,7 +152,7 @@ impl Tls {
}
mod sync_bitset {
use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use sync::atomic::{AtomicUsize, Ordering};
use iter::{Enumerate, Peekable};
use slice::Iter;
use super::{TLS_KEYS_BITSET_SIZE, USIZE_BITS};
@ -128,7 +161,7 @@ mod sync_bitset {
pub(super) struct SyncBitset([AtomicUsize; TLS_KEYS_BITSET_SIZE]);
pub(super) const SYNC_BITSET_INIT: SyncBitset =
SyncBitset([ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT]);
SyncBitset([AtomicUsize::new(0), AtomicUsize::new(0)]);
impl SyncBitset {
pub fn get(&self, index: usize) -> bool {

View File

@ -1,7 +1,7 @@
use io;
use libc::{self, c_int};
use mem;
use sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use sync::atomic::{AtomicBool, Ordering};
use sys::fd::FileDesc;
use sys::{cvt, cvt_r};
@ -13,7 +13,7 @@ pub struct AnonPipe(FileDesc);
pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
syscall! { fn pipe2(fds: *mut c_int, flags: c_int) -> c_int }
static INVALID: AtomicBool = ATOMIC_BOOL_INIT;
static INVALID: AtomicBool = AtomicBool::new(false);
let mut fds = [0; 2];

View File

@ -7,7 +7,7 @@ use path::Path;
use ptr;
use slice;
use sync::atomic::Ordering::SeqCst;
use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
use sync::atomic::AtomicUsize;
use sys::c;
use sys::fs::{File, OpenOptions};
use sys::handle::Handle;
@ -148,7 +148,7 @@ pub fn anon_pipe(ours_readable: bool) -> io::Result<Pipes> {
}
fn random_number() -> usize {
static N: AtomicUsize = ATOMIC_USIZE_INIT;
static N: AtomicUsize = AtomicUsize::new(0);
loop {
if N.load(SeqCst) != 0 {
return N.fetch_add(1, SeqCst)

View File

@ -23,7 +23,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![feature(asm)]
#![cfg_attr(stage0, feature(cfg_target_vendor))]
#![feature(fnbox)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc, rustc_private))]
#![feature(nll)]

View File

@ -1,7 +1,6 @@
#![no_std]
#![unstable(feature = "panic_unwind", issue = "32837")]
#![cfg_attr(stage0, feature(cfg_target_vendor))]
#![feature(link_cfg)]
#![feature(nll)]
#![feature(staged_api)]

View File

@ -12,7 +12,7 @@
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.
date: 2019-01-04
date: 2019-01-18
rustc: beta
cargo: beta

View File

@ -1,6 +1,9 @@
-include ../tools.mk
# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same
# (so fixing it is harder). See #57765 for context
ifndef IS_WINDOWS
# This test makes sure that we don't loose upstream object files when compiling
# staticlibs with -Zcross-lang-lto
@ -9,7 +12,7 @@ all: staticlib.rs upstream.rs
# Check No LTO
$(RUSTC) staticlib.rs -Z cross-lang-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a
(cd $(TMPDIR); llvm-ar x ./staticlib.a)
(cd $(TMPDIR); $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-ar x ./staticlib.a)
# Make sure the upstream object file was included
ls $(TMPDIR)/upstream.*.rcgu.o
@ -19,5 +22,11 @@ all: staticlib.rs upstream.rs
# Check ThinLTO
$(RUSTC) upstream.rs -Z cross-lang-lto -Ccodegen-units=1 -Clto=thin
$(RUSTC) staticlib.rs -Z cross-lang-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a
(cd $(TMPDIR); llvm-ar x ./staticlib.a)
(cd $(TMPDIR); $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-ar x ./staticlib.a)
ls $(TMPDIR)/upstream.*.rcgu.o
else
all:
endif

View File

@ -1,12 +1,17 @@
-include ../tools.mk
# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same
# (so fixing it is harder). See #57765 for context
ifndef IS_WINDOWS
# This test makes sure that the object files we generate are actually
# LLVM bitcode files (as used by linker LTO plugins) when compiling with
# -Z cross-lang-lto.
ASSERT_IS_BITCODE_OBJ=llvm-bcanalyzer # this only succeeds for bitcode files
EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; llvm-ar x $(1))
# this only succeeds for bitcode files
ASSERT_IS_BITCODE_OBJ=($(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-bcanalyzer $(1))
EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-ar x $(1))
BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Z cross-lang-lto=on -Ccodegen-units=1
BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Z cross-lang-lto=on -Ccodegen-units=1 --emit=obj
@ -16,31 +21,37 @@ all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib
staticlib: lib.rs
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a
$(call EXTRACT_OBJS, liblib.a)
for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done
staticlib-fat-lto: lib.rs
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat
$(call EXTRACT_OBJS, liblib-fat-lto.a)
for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done
staticlib-thin-lto: lib.rs
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin
$(call EXTRACT_OBJS, liblib-thin-lto.a)
for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done
rlib: lib.rs
$(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib
$(call EXTRACT_OBJS, liblib.rlib)
for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done
cdylib: lib.rs
$(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/cdylib.o
$(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/cdylib.o)
rdylib: lib.rs
$(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/rdylib.o
$(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/rdylib.o)
exe: lib.rs
$(BUILD_EXE) -o $(TMPDIR)/exe.o
$(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/exe.o
$(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/exe.o)
else
all:
endif

View File

@ -4,12 +4,12 @@
extern crate custom;
use std::sync::atomic::{ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
use custom::A;
#[global_allocator]
static ALLOCATOR: A = A(ATOMIC_USIZE_INIT);
static ALLOCATOR: A = A(AtomicUsize::new(0));
pub fn get() -> usize {
ALLOCATOR.0.load(Ordering::SeqCst)

View File

@ -8,9 +8,9 @@
extern crate helper;
use std::alloc::{self, Global, Alloc, System, Layout};
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use std::sync::atomic::{AtomicUsize, Ordering};
static HITS: AtomicUsize = ATOMIC_USIZE_INIT;
static HITS: AtomicUsize = AtomicUsize::new(0);
struct A;

View File

@ -10,10 +10,10 @@ extern crate custom;
extern crate helper;
use std::alloc::{Global, Alloc, System, Layout};
use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT};
use std::sync::atomic::{Ordering, AtomicUsize};
#[global_allocator]
static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT);
static GLOBAL: custom::A = custom::A(AtomicUsize::new(0));
fn main() {
unsafe {

View File

@ -12,9 +12,9 @@ extern crate custom_as_global;
extern crate helper;
use std::alloc::{alloc, dealloc, GlobalAlloc, System, Layout};
use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT};
use std::sync::atomic::{AtomicUsize, Ordering};
static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT);
static GLOBAL: custom::A = custom::A(AtomicUsize::new(0));
fn main() {
unsafe {
@ -45,4 +45,3 @@ fn main() {
assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 2);
}
}

View File

@ -1,9 +1,9 @@
#![allow(stable_features)]
#![feature(atomic_access)]
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT};
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering::*;
static mut ATOMIC: AtomicBool = ATOMIC_BOOL_INIT;
static mut ATOMIC: AtomicBool = AtomicBool::new(false);
fn main() {
unsafe {

View File

@ -1,10 +1,10 @@
#![allow(stable_features)]
#![feature(extended_compare_and_swap)]
use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT};
use std::sync::atomic::AtomicIsize;
use std::sync::atomic::Ordering::*;
static ATOMIC: AtomicIsize = ATOMIC_ISIZE_INIT;
static ATOMIC: AtomicIsize = AtomicIsize::new(0);
fn main() {
// Make sure codegen can emit all the intrinsics correctly

View File

@ -2,7 +2,7 @@
//! Test that #[derive(Copy, Clone)] produces a shallow copy
//! even when a member violates RFC 1521
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
use std::sync::atomic::{AtomicBool, Ordering};
/// A struct that pretends to be Copy, but actually does something
/// in its Clone impl
@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
struct Liar;
/// Static cooperating with the rogue Clone impl
static CLONED: AtomicBool = ATOMIC_BOOL_INIT;
static CLONED: AtomicBool = AtomicBool::new(false);
impl Clone for Liar {
fn clone(&self) -> Self {
@ -36,4 +36,3 @@ fn main() {
// if Innocent was byte-for-byte copied, CLONED will still be false
assert!(!CLONED.load(Ordering::SeqCst));
}

View File

@ -3,9 +3,9 @@
#![feature(generators, generator_trait)]
use std::ops::Generator;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
static A: AtomicUsize = ATOMIC_USIZE_INIT;
static A: AtomicUsize = AtomicUsize::new(0);
struct B;

View File

@ -3,9 +3,9 @@
#![feature(generators, generator_trait)]
use std::ops::Generator;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
static A: AtomicUsize = ATOMIC_USIZE_INIT;
static A: AtomicUsize = AtomicUsize::new(0);
struct B;

View File

@ -6,9 +6,9 @@
use std::ops::Generator;
use std::panic;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
static A: AtomicUsize = ATOMIC_USIZE_INIT;
static A: AtomicUsize = AtomicUsize::new(0);
struct B;

View File

@ -1,7 +1,7 @@
// run-pass
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
struct A(i32);

View File

@ -10,7 +10,7 @@
use std::sync::atomic;
use std::sync::atomic::Ordering::SeqCst;
static COUNTER: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;
static COUNTER: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
struct DropMe {
}

View File

@ -1,11 +1,11 @@
// run-pass
// ignore-emscripten no threads support
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::panic;
use std::thread;
static A: AtomicUsize = ATOMIC_USIZE_INIT;
static A: AtomicUsize = AtomicUsize::new(0);
fn main() {
panic::set_hook(Box::new(|_| {

View File

@ -6,13 +6,13 @@
#![feature(thread_local_try_with)]
use std::thread;
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
use std::sync::atomic::{AtomicUsize, Ordering};
struct Foo { cnt: usize }
thread_local!(static FOO: Foo = Foo::init());
static CNT: AtomicUsize = ATOMIC_USIZE_INIT;
static CNT: AtomicUsize = AtomicUsize::new(0);
impl Foo {
fn init() -> Foo {

View File

@ -10,7 +10,7 @@
#![feature(thread_local)]
#[thread_local]
static mut X: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
static mut X: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
fn main() {
unsafe {

View File

@ -1,6 +1,6 @@
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
use std::sync::atomic::AtomicUsize;
const A: AtomicUsize = ATOMIC_USIZE_INIT;
const A: AtomicUsize = AtomicUsize::new(0);
static B: &'static AtomicUsize = &A; //~ ERROR E0492
fn main() {

@ -1 +1 @@
Subproject commit 907c0febe7045fa02dff2a35c5e36d3bd59ea50d
Subproject commit 245818076052dd7178f5bb7585f5aec5b6c1e03e

View File

@ -20,7 +20,7 @@ use std::os::unix::prelude::*;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::str;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;
@ -31,7 +31,7 @@ macro_rules! t {
})
}
static TEST: AtomicUsize = ATOMIC_USIZE_INIT;
static TEST: AtomicUsize = AtomicUsize::new(0);
struct Config {
pub remote: bool,

View File

@ -188,7 +188,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
}
let mut parts = line.split(',');
let level = match parts.next().map(|l| l.trim().trim_left_matches('(')) {
let level = match parts.next().map(|l| l.trim().trim_start_matches('(')) {
Some("active") => Status::Unstable,
Some("removed") => Status::Removed,
Some("accepted") => Status::Stable,