Skip to content
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

Rollup of 11 pull requests #61737

Closed
wants to merge 36 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e02f133
move intrinsics codegen tests into a seperate folder
lcnr Jun 4, 2019
4c44d4a
improve test indentation
lcnr Jun 4, 2019
36601f6
Windows 10 SDK is also required now.
sfengyuan Jun 5, 2019
1cf662e
rephrase
sfengyuan Jun 7, 2019
3d6070d
Neutralize link
sfengyuan Jun 7, 2019
50e0c6c
Delete Rustbook step
Mark-Simulacrum Jun 7, 2019
e70e9c4
Delete unnecessary command
Mark-Simulacrum Jun 7, 2019
0e64a94
Inline prepare_tool_cmd
Mark-Simulacrum Jun 7, 2019
147246c
Make RemoteTestServer a bootstrap tool
Mark-Simulacrum Jun 7, 2019
b15cb0f
Delete unused fields on Crate struct
Mark-Simulacrum Jun 7, 2019
e4c44c7
Remove unnecessary Std dependency
Mark-Simulacrum Jun 7, 2019
41e976b
Azure: retry failed awscli installs
wesleywiser Jun 10, 2019
e3516a1
librustc_errors: Add some more documentation
phansch Jun 9, 2019
33137ff
Address review comments
phansch Jun 10, 2019
7b97cf9
make sure to_ascii_lowercase actually leaves upper-case non-ASCII cha…
RalfJung Jun 10, 2019
9ed4674
typeck: Fix const generic in repeat param ICE.
davidtwco Jun 9, 2019
d3461bf
core: use memcmp optimization for 128 bit integer slices
aschampion Jun 10, 2019
8eb7f36
std: Remove internal definitions of `cfg_if!` macro
alexcrichton Jun 10, 2019
97f4e70
syntax: Remove `SyntaxExtension::IdentTT` and `IdentMacroExpander`
petrochenkov Jun 6, 2019
5a6ebec
syntax: Remove `SyntaxExtension::MultiDecorator` and `MultiItemDecora…
petrochenkov Jun 6, 2019
edb925a
syntax: Use `MultiItemModifier` for built-in derives
petrochenkov Jun 6, 2019
8edbbac
syntax: Remove `SyntaxExtension::DeclMacro`
petrochenkov Jun 6, 2019
0468eb6
syntax: Improve documentation of `SyntaxExtension`
petrochenkov Jun 6, 2019
93eb63c
syntax: Rename variants of `SyntaxExtension` for consistency
petrochenkov Jun 6, 2019
c127f53
Use `for_each` in `Iterator::partition`
cuviper Jun 10, 2019
44033a7
Rollup merge of #61526 - lcnr:test_reorder, r=nikomatsakis
Centril Jun 11, 2019
c426fa5
Rollup merge of #61550 - jacobsun:patch-1, r=alexcrichton
Centril Jun 11, 2019
c6c9f66
Rollup merge of #61606 - petrochenkov:legclean, r=pnkfelix
Centril Jun 11, 2019
d3abd6c
Rollup merge of #61639 - Mark-Simulacrum:bootstrap-cleanup, r=alexcri…
Centril Jun 11, 2019
2c642de
Rollup merge of #61686 - phansch:librustc_errors_docs, r=estebank
Centril Jun 11, 2019
4f6aa0d
Rollup merge of #61698 - davidtwco:ice-const-generic-length, r=varkor
Centril Jun 11, 2019
a845141
Rollup merge of #61707 - wesleywiser:awscli_retry, r=alexcrichton
Centril Jun 11, 2019
503a790
Rollup merge of #61715 - RalfJung:test-ascii-lowercase, r=varkor
Centril Jun 11, 2019
5fa30ca
Rollup merge of #61720 - alexcrichton:libstd-cfg-if-dep, r=sfackler
Centril Jun 11, 2019
e294c42
Rollup merge of #61724 - aschampion:128-bit-memcmp, r=sfackler
Centril Jun 11, 2019
5837b9f
Rollup merge of #61726 - cuviper:partition-for_each, r=scottmcm
Centril Jun 11, 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
std: Remove internal definitions of cfg_if! macro
This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
alexcrichton committed Jun 10, 2019
commit 8eb7f36a3ba06dbea4a44254c3e2d92455ae150f
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -1813,6 +1813,7 @@ name = "panic_unwind"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3338,6 +3339,7 @@ dependencies = [
"alloc 0.0.0",
"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3936,6 +3938,7 @@ name = "unwind"
version = "0.0.0"
dependencies = [
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
50 changes: 25 additions & 25 deletions src/libcore/hint.rs
Original file line number Diff line number Diff line change
@@ -111,31 +111,31 @@ pub fn spin_loop() {
/// This function is a no-op, and does not even read from `dummy`.
#[inline]
#[unstable(feature = "test", issue = "27812")]
#[allow(unreachable_code)] // this makes #[cfg] a bit easier below.
pub fn black_box<T>(dummy: T) -> T {
cfg_if! {
if #[cfg(any(
target_arch = "asmjs",
all(
target_arch = "wasm32",
target_os = "emscripten"
)
))] {
#[inline]
unsafe fn black_box_impl<T>(d: T) -> T {
// these targets do not support inline assembly
let ret = crate::ptr::read_volatile(&d);
crate::mem::forget(d);
ret
}
} else {
#[inline]
unsafe fn black_box_impl<T>(d: T) -> T {
// we need to "use" the argument in some way LLVM can't
// introspect.
asm!("" : : "r"(&d));
d
}
}
// We need to "use" the argument in some way LLVM can't introspect, and on
// targets that support it we can typically leverage inline assembly to do
// this. LLVM's intepretation of inline assembly is that it's, well, a black
// box. This isn't the greatest implementation since it probably deoptimizes
// more than we want, but it's so far good enough.
#[cfg(not(any(
target_arch = "asmjs",
all(
target_arch = "wasm32",
target_os = "emscripten"
)
)))]
unsafe {
asm!("" : : "r"(&dummy));
return dummy;
}

// Not all platforms support inline assembly so try to do something without
// inline assembly which in theory still hinders at least some optimizations
// on those targets. This is the "best effort" scenario.
unsafe {
let ret = crate::ptr::read_volatile(&dummy);
crate::mem::forget(dummy);
ret
}
unsafe { black_box_impl(dummy) }
}
81 changes: 0 additions & 81 deletions src/libcore/internal_macros.rs
Original file line number Diff line number Diff line change
@@ -117,84 +117,3 @@ macro_rules! impl_fn_for_zst {
)+
}
}

/// A macro for defining `#[cfg]` if-else statements.
///
/// The macro provided by this crate, `cfg_if`, is similar to the `if/elif` C
/// preprocessor macro by allowing definition of a cascade of `#[cfg]` cases,
/// emitting the implementation which matches first.
///
/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code
/// without having to rewrite each clause multiple times.
///
/// # Example
///
/// ```
/// #[macro_use]
/// extern crate cfg_if;
///
/// cfg_if! {
/// if #[cfg(unix)] {
/// fn foo() { /* unix specific functionality */ }
/// } else if #[cfg(target_pointer_width = "32")] {
/// fn foo() { /* non-unix, 32-bit functionality */ }
/// } else {
/// fn foo() { /* fallback implementation */ }
/// }
/// }
///
/// # fn main() {}
/// ```
macro_rules! cfg_if {
// match if/else chains with a final `else`
($(
if #[cfg($($meta:meta),*)] { $($it:item)* }
) else * else {
$($it2:item)*
}) => {
cfg_if! {
@__items
() ;
$( ( ($($meta),*) ($($it)*) ), )*
( () ($($it2)*) ),
}
};

// match if/else chains lacking a final `else`
(
if #[cfg($($i_met:meta),*)] { $($i_it:item)* }
$(
else if #[cfg($($e_met:meta),*)] { $($e_it:item)* }
)*
) => {
cfg_if! {
@__items
() ;
( ($($i_met),*) ($($i_it)*) ),
$( ( ($($e_met),*) ($($e_it)*) ), )*
( () () ),
}
};

// Internal and recursive macro to emit all the items
//
// Collects all the negated cfgs in a list at the beginning and after the
// semicolon is all the remaining items
(@__items ($($not:meta,)*) ; ) => {};
(@__items ($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
// Emit all items within one block, applying an approprate #[cfg]. The
// #[cfg] will require all `$m` matchers specified and must also negate
// all previous matchers.
cfg_if! { @__apply cfg(all($($m,)* not(any($($not),*)))), $($it)* }

// Recurse to emit all other items in `$rest`, and when we do so add all
// our `$m` matchers to the list of `$not` matchers as future emissions
// will have to negate everything we just matched as well.
cfg_if! { @__items ($($not,)* $($m,)*) ; $($rest)* }
};

// Internal macro to Apply a cfg attribute to a list of items
(@__apply $m:meta, $($it:item)*) => {
$(#[$m] $it)*
};
}
1 change: 1 addition & 0 deletions src/libpanic_unwind/Cargo.toml
Original file line number Diff line number Diff line change
@@ -16,3 +16,4 @@ core = { path = "../libcore" }
libc = { version = "0.2", default-features = false }
unwind = { path = "../libunwind" }
compiler_builtins = "0.1.0"
cfg-if = "0.1.8"
5 changes: 1 addition & 4 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
@@ -38,10 +38,7 @@ use core::mem;
use core::raw;
use core::panic::BoxMeUp;

#[macro_use]
mod macros;

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(target_os = "emscripten")] {
#[path = "emcc.rs"]
mod imp;
35 changes: 0 additions & 35 deletions src/libpanic_unwind/macros.rs

This file was deleted.

1 change: 1 addition & 0 deletions src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ crate-type = ["dylib", "rlib"]

[dependencies]
alloc = { path = "../liballoc" }
cfg-if = "0.1.8"
panic_unwind = { path = "../libpanic_unwind", optional = true }
panic_abort = { path = "../libpanic_abort" }
core = { path = "../libcore" }
6 changes: 6 additions & 0 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
@@ -336,6 +336,12 @@ extern crate libc;
#[allow(unused_extern_crates)]
extern crate unwind;

// Only needed for now for the `std_detect` module until that crate changes to
// use `cfg_if::cfg_if!`
#[macro_use]
#[cfg(not(test))]
extern crate cfg_if;

// During testing, this crate is not actually the "real" std library, but rather
// it links to the real std library, which was compiled from this same source
// code. So any lang items std defines are conditionally excluded (or else they
36 changes: 0 additions & 36 deletions src/libstd/macros.rs
Original file line number Diff line number Diff line change
@@ -896,39 +896,3 @@ mod builtin {
($cond:expr, $($arg:tt)+) => ({ /* compiler built-in */ });
}
}

/// Defines `#[cfg]` if-else statements.
///
/// This is similar to the `if/elif` C preprocessor macro by allowing definition
/// of a cascade of `#[cfg]` cases, emitting the implementation which matches
/// first.
///
/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code
/// without having to rewrite each clause multiple times.
macro_rules! cfg_if {
($(
if #[cfg($($meta:meta),*)] { $($it:item)* }
) else * else {
$($it2:item)*
}) => {
__cfg_if_items! {
() ;
$( ( ($($meta),*) ($($it)*) ), )*
( () ($($it2)*) ),
}
}
}

macro_rules! __cfg_if_items {
(($($not:meta,)*) ; ) => {};
(($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
__cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* }
__cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
}
}

macro_rules! __cfg_if_apply {
($m:meta, $($it:item)*) => {
$(#[$m] $it)*
}
}
2 changes: 1 addition & 1 deletion src/libstd/os/mod.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
#![stable(feature = "os", since = "1.0.0")]
#![allow(missing_docs, nonstandard_style, missing_debug_implementations)]

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(rustdoc)] {

// When documenting libstd we want to show unix/windows/linux modules as
6 changes: 3 additions & 3 deletions src/libstd/sys/mod.rs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@

#![allow(missing_debug_implementations)]

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(unix)] {
mod unix;
pub use self::unix::*;
@@ -54,7 +54,7 @@ cfg_if! {
// Windows when we're compiling for Linux.

#[cfg(rustdoc)]
cfg_if! {
cfg_if::cfg_if! {
if #[cfg(any(unix, target_os = "redox"))] {
// On unix we'll document what's already available
#[stable(feature = "rust1", since = "1.0.0")]
@@ -77,7 +77,7 @@ cfg_if! {
}

#[cfg(rustdoc)]
cfg_if! {
cfg_if::cfg_if! {
if #[cfg(windows)] {
// On windows we'll just be documenting what's already available
#[allow(missing_docs)]
2 changes: 1 addition & 1 deletion src/libstd/sys/wasm/mod.rs
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ pub mod stdio;

pub use crate::sys_common::os_str_bytes as os_str;

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(target_feature = "atomics")] {
#[path = "condvar_atomics.rs"]
pub mod condvar;
2 changes: 1 addition & 1 deletion src/libstd/sys/wasm/thread.rs
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ pub mod guard {
pub unsafe fn init() -> Option<Guard> { None }
}

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(all(target_feature = "atomics", feature = "wasm-bindgen-threads"))] {
#[link(wasm_import_module = "__wbindgen_thread_xform__")]
extern {
2 changes: 1 addition & 1 deletion src/libstd/sys_common/mod.rs
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ pub mod bytestring;
pub mod process;
pub mod fs;

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(any(target_os = "cloudabi",
target_os = "l4re",
target_os = "redox",
1 change: 1 addition & 0 deletions src/libunwind/Cargo.toml
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ doc = false
core = { path = "../libcore" }
libc = { version = "0.2.43", features = ['rustc-dep-of-std'], default-features = false }
compiler_builtins = "0.1.0"
cfg-if = "0.1.8"

[build-dependencies]
cc = { optional = true, version = "1.0.1" }
5 changes: 1 addition & 4 deletions src/libunwind/lib.rs
Original file line number Diff line number Diff line change
@@ -11,10 +11,7 @@

#![cfg_attr(not(target_env = "msvc"), feature(libc))]

#[macro_use]
mod macros;

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(target_env = "msvc")] {
// no extra unwinder support needed
} else if #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] {
9 changes: 3 additions & 6 deletions src/libunwind/libunwind.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![allow(nonstandard_style)]

macro_rules! cfg_if {
( $( if #[cfg( $meta:meta )] { $($it1:item)* } else { $($it2:item)* } )* ) =>
( $( $( #[cfg($meta)] $it1)* $( #[cfg(not($meta))] $it2)* )* )
}

use libc::{c_int, c_void, uintptr_t};

#[repr(C)]
@@ -82,7 +77,7 @@ extern "C" {
pub fn _Unwind_GetDataRelBase(ctx: *mut _Unwind_Context) -> _Unwind_Ptr;
}

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))))] {
// Not ARM EHABI
#[repr(C)]
@@ -206,7 +201,9 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
pc
}
}
} // cfg_if!

cfg_if::cfg_if! {
if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
// Not 32-bit iOS
extern "C" {
35 changes: 0 additions & 35 deletions src/libunwind/macros.rs

This file was deleted.