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 9 pull requests #49684

Merged
merged 29 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9942012
Run make tests for file resolution
chmanchester Mar 27, 2018
bd81547
Take the original extra-filename passed to a crate into account when
chmanchester Mar 13, 2018
cd09c2b
Flush executables to disk after linkage
nabijaczleweli Mar 27, 2018
3787106
Also protect first attempt
nabijaczleweli Mar 29, 2018
0f5e419
Add a generic CAS loop to std::sync::Atomic*
llogiq Mar 2, 2018
e1d3c47
Open the file as write before trying to flush it
nabijaczleweli Mar 31, 2018
68b54a5
add a dist-thumb builder to build rust-std for the THUMB targets
japaric Apr 1, 2018
2a99c02
add new image to .travis.yml
japaric Apr 1, 2018
cc939ac
Add vec![ptr::null{,_mut}(); n] optimization, like vec![0; n]
glandium Mar 30, 2018
0df837f
Add vec!['\0'; n] optimization, like vec![0; n]
glandium Apr 2, 2018
138472b
Checking location and syntax of non_exhaustive attribute.
davidtwco Mar 24, 2018
d069354
merge dist-various-3 into dist-various-1
japaric Apr 3, 2018
862c839
extend no-std-ness check to all *-none-* targets
japaric Apr 3, 2018
9e9a987
Documenting private items in compiler docs.
davidtwco Apr 4, 2018
809d01c
Updated codeblocks to specify language where required.
davidtwco Apr 4, 2018
14768f9
create a nostd crate
japaric Apr 4, 2018
bca569f
Revert "create a nostd crate"
japaric Apr 4, 2018
b1015f5
compile other no-std crates
japaric Apr 4, 2018
3237955
Add more features to rust_2018_preview
Manishearth Apr 4, 2018
621ccf8
ci: Remove x86_64-gnu-incremental builder
alexcrichton Apr 5, 2018
920249a
Rollup merge of #48658 - llogiq:no-more-cas, r=kennytm
kennytm Apr 5, 2018
46d0bef
Rollup merge of #49253 - chmanchester:probing_fix, r=alexcrichton
kennytm Apr 5, 2018
a70f844
Rollup merge of #49345 - davidtwco:issue-44109, r=nikomatsakis
kennytm Apr 5, 2018
19c6908
Rollup merge of #49432 - nabijaczleweli:master, r=michaelwoerister
kennytm Apr 5, 2018
23689cc
Rollup merge of #49496 - glandium:master, r=sfackler
kennytm Apr 5, 2018
b146e33
Rollup merge of #49563 - japaric:std-thumb, r=alexcrichton
kennytm Apr 5, 2018
84f6440
Rollup merge of #49654 - davidtwco:issue-29893, r=alexcrichton
kennytm Apr 5, 2018
d05009b
Rollup merge of #49667 - Manishearth:preview-features, r=nikomatsakis
kennytm Apr 5, 2018
f4511e2
Rollup merge of #49674 - alexcrichton:no-incremental-rustc, r=michael…
kennytm Apr 5, 2018
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
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ matrix:
if: branch = auto
- env: IMAGE=x86_64-gnu-distcheck
if: branch = auto
- env: IMAGE=x86_64-gnu-incremental
if: branch = auto

- stage: publish toolstate
if: branch = master AND type = push
Expand Down
78 changes: 44 additions & 34 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,48 +140,58 @@ pub fn std_cargo(build: &Builder,
compiler: &Compiler,
target: Interned<String>,
cargo: &mut Command) {
let mut features = build.std_features();

if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") {
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
}

// When doing a local rebuild we tell cargo that we're stage1 rather than
// stage0. This works fine if the local rust and being-built rust have the
// same view of what the default allocator is, but fails otherwise. Since
// we don't have a way to express an allocator preference yet, work
// around the issue in the case of a local rebuild with jemalloc disabled.
if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc {
features.push_str(" force_alloc_system");
}
if build.no_std(target) == Some(true) {
// for no-std targets we only compile a few no_std crates
cargo.arg("--features").arg("c mem")
.args(&["-p", "alloc"])
.args(&["-p", "compiler_builtins"])
.args(&["-p", "std_unicode"])
.arg("--manifest-path")
.arg(build.src.join("src/rustc/compiler_builtins_shim/Cargo.toml"));
} else {
let mut features = build.std_features();

// When doing a local rebuild we tell cargo that we're stage1 rather than
// stage0. This works fine if the local rust and being-built rust have the
// same view of what the default allocator is, but fails otherwise. Since
// we don't have a way to express an allocator preference yet, work
// around the issue in the case of a local rebuild with jemalloc disabled.
if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc {
features.push_str(" force_alloc_system");
}

if compiler.stage != 0 && build.config.sanitizers {
// This variable is used by the sanitizer runtime crates, e.g.
// rustc_lsan, to build the sanitizer runtime from C code
// When this variable is missing, those crates won't compile the C code,
// so we don't set this variable during stage0 where llvm-config is
// missing
// We also only build the runtimes when --enable-sanitizers (or its
// config.toml equivalent) is used
let llvm_config = build.ensure(native::Llvm {
target: build.config.build,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
}
if compiler.stage != 0 && build.config.sanitizers {
// This variable is used by the sanitizer runtime crates, e.g.
// rustc_lsan, to build the sanitizer runtime from C code
// When this variable is missing, those crates won't compile the C code,
// so we don't set this variable during stage0 where llvm-config is
// missing
// We also only build the runtimes when --enable-sanitizers (or its
// config.toml equivalent) is used
let llvm_config = build.ensure(native::Llvm {
target: build.config.build,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
}

cargo.arg("--features").arg(features)
.arg("--manifest-path")
.arg(build.src.join("src/libstd/Cargo.toml"));
cargo.arg("--features").arg(features)
.arg("--manifest-path")
.arg(build.src.join("src/libstd/Cargo.toml"));

if let Some(target) = build.config.target_config.get(&target) {
if let Some(ref jemalloc) = target.jemalloc {
cargo.env("JEMALLOC_OVERRIDE", jemalloc);
if let Some(target) = build.config.target_config.get(&target) {
if let Some(ref jemalloc) = target.jemalloc {
cargo.env("JEMALLOC_OVERRIDE", jemalloc);
}
}
}
if target.contains("musl") {
if let Some(p) = build.musl_root(target) {
cargo.env("MUSL_ROOT", p);
if target.contains("musl") {
if let Some(p) = build.musl_root(target) {
cargo.env("MUSL_ROOT", p);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ pub struct Target {
pub crt_static: Option<bool>,
pub musl_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
}

/// Structure of the `config.toml` file that configuration is read from.
Expand Down
7 changes: 6 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,12 @@ impl Step for Std {
if build.hosts.iter().any(|t| t == target) {
builder.ensure(compile::Rustc { compiler, target });
} else {
builder.ensure(compile::Test { compiler, target });
if build.no_std(target) == Some(true) {
// the `test` doesn't compile for no-std targets
builder.ensure(compile::Std { compiler, target });
} else {
builder.ensure(compile::Test { compiler, target });
}
}

let image = tmpdir(build).join(format!("{}-{}-image", name, target));
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ impl Step for Rustc {
t!(symlink_dir_force(&builder.config, &out, &out_dir));

let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
cargo.env("RUSTDOCFLAGS", "--document-private-items");
compile::rustc_cargo(build, &mut cargo);

// Only include compiler crates, no dependencies of those, such as `libc`.
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,12 @@ impl Build {
.map(|p| &**p)
}

/// Returns true if this is a no-std `target`, if defined
fn no_std(&self, target: Interned<String>) -> Option<bool> {
self.config.target_config.get(&target)
.map(|t| t.no_std)
}

/// Returns whether the target will be tested using the `remote-test-client`
/// and `remote-test-server` binaries.
fn remote_tested(&self, target: Interned<String>) -> bool {
Expand Down
13 changes: 13 additions & 0 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ pub fn check(build: &mut Build) {
panic!("the iOS target is only supported on macOS");
}

if target.contains("-none-") {
if build.no_std(*target).is_none() {
let target = build.config.target_config.entry(target.clone())
.or_insert(Default::default());

target.no_std = true;
}

if build.no_std(*target) == Some(false) {
panic!("All the *-none-* targets are no-std targets")
}
}

// Make sure musl-root is valid
if target.contains("musl") {
// If this is a native target (host is also musl) and no musl-root is given,
Expand Down
8 changes: 7 additions & 1 deletion src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
patch \
libssl-dev \
pkg-config
pkg-config \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi

WORKDIR /build

Expand Down Expand Up @@ -86,6 +88,10 @@ ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl
ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu
ENV TARGETS=$TARGETS,x86_64-unknown-redox
ENV TARGETS=$TARGETS,thumbv6m-none-eabi
ENV TARGETS=$TARGETS,thumbv7m-none-eabi
ENV TARGETS=$TARGETS,thumbv7em-none-eabi
ENV TARGETS=$TARGETS,thumbv7em-none-eabihf

# FIXME: remove armv5te vars after https://github.com/alexcrichton/cc-rs/issues/271
# get fixed and cc update
Expand Down
22 changes: 0 additions & 22 deletions src/ci/docker/x86_64-gnu-incremental/Dockerfile

This file was deleted.

81 changes: 55 additions & 26 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,40 +1594,69 @@ impl SpecFromElem for u8 {
}
}

macro_rules! impl_spec_from_elem {
impl<T: Clone + IsZero> SpecFromElem for T {
#[inline]
fn from_elem(elem: T, n: usize) -> Vec<T> {
if elem.is_zero() {
return Vec {
buf: RawVec::with_capacity_zeroed(n),
len: n,
}
}
let mut v = Vec::with_capacity(n);
v.extend_with(n, ExtendElement(elem));
v
}
}

unsafe trait IsZero {
/// Whether this value is zero
fn is_zero(&self) -> bool;
}

macro_rules! impl_is_zero {
($t: ty, $is_zero: expr) => {
impl SpecFromElem for $t {
unsafe impl IsZero for $t {
#[inline]
fn from_elem(elem: $t, n: usize) -> Vec<$t> {
if $is_zero(elem) {
return Vec {
buf: RawVec::with_capacity_zeroed(n),
len: n,
}
}
let mut v = Vec::with_capacity(n);
v.extend_with(n, ExtendElement(elem));
v
fn is_zero(&self) -> bool {
$is_zero(*self)
}
}
};
}
}

impl_spec_from_elem!(i8, |x| x == 0);
impl_spec_from_elem!(i16, |x| x == 0);
impl_spec_from_elem!(i32, |x| x == 0);
impl_spec_from_elem!(i64, |x| x == 0);
impl_spec_from_elem!(i128, |x| x == 0);
impl_spec_from_elem!(isize, |x| x == 0);
impl_is_zero!(i8, |x| x == 0);
impl_is_zero!(i16, |x| x == 0);
impl_is_zero!(i32, |x| x == 0);
impl_is_zero!(i64, |x| x == 0);
impl_is_zero!(i128, |x| x == 0);
impl_is_zero!(isize, |x| x == 0);

impl_is_zero!(u16, |x| x == 0);
impl_is_zero!(u32, |x| x == 0);
impl_is_zero!(u64, |x| x == 0);
impl_is_zero!(u128, |x| x == 0);
impl_is_zero!(usize, |x| x == 0);

impl_is_zero!(char, |x| x == '\0');

impl_is_zero!(f32, |x: f32| x.to_bits() == 0);
impl_is_zero!(f64, |x: f64| x.to_bits() == 0);

impl_spec_from_elem!(u16, |x| x == 0);
impl_spec_from_elem!(u32, |x| x == 0);
impl_spec_from_elem!(u64, |x| x == 0);
impl_spec_from_elem!(u128, |x| x == 0);
impl_spec_from_elem!(usize, |x| x == 0);
unsafe impl<T: ?Sized> IsZero for *const T {
#[inline]
fn is_zero(&self) -> bool {
(*self).is_null()
}
}

unsafe impl<T: ?Sized> IsZero for *mut T {
#[inline]
fn is_zero(&self) -> bool {
(*self).is_null()
}
}

impl_spec_from_elem!(f32, |x: f32| x.to_bits() == 0);
impl_spec_from_elem!(f64, |x: f64| x.to_bits() == 0);

////////////////////////////////////////////////////////////////////////////////
// Common trait implementations for Vec
Expand Down
Loading