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 #49675

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9942012
Run make tests for file resolution
chmanchester Mar 27, 2018
d2b9a77
check impl trait first
tinaun Mar 3, 2018
97e0dc3
added test
tinaun Mar 3, 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
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
f886518
std: Minimize size of panicking on wasm
alexcrichton Mar 29, 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
21641d6
Refactor inner function into closure.
leoyvens Mar 26, 2018
ba5a5cf
Remove single use helper function.
leoyvens Mar 27, 2018
0a3eb5c
Simplify code around expected argument types.
leoyvens Mar 27, 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
1b1df3e
Use `Span` instead of `SyntaxContext` in `Ident`
petrochenkov Mar 17, 2018
8cde9ad
Rename `PathSegment::identifier` to `ident`
petrochenkov Mar 18, 2018
2e622b1
Get rid of `SpannedIdent`
petrochenkov Mar 18, 2018
1f4c139
Use `Span::apply_mark` where possible
petrochenkov Mar 18, 2018
179c9f1
Rename `ast::Variant_::name` into `ident` + Fix rebase
petrochenkov Mar 18, 2018
2dcafc4
Remove more duplicated spans
petrochenkov Mar 19, 2018
2c8eb34
Make lifetime nonterminals closer to identifier nonterminals
petrochenkov Mar 24, 2018
2bb74f6
Fix stable hash for identifiers
petrochenkov Mar 24, 2018
8a82a76
Use `Ident` instead of `Name` in `MetaItem`
petrochenkov Mar 24, 2018
eba1218
Fix feature gating for crate/extern in paths
petrochenkov Mar 25, 2018
1a2a234
Stabilize attributes on generic parameters
petrochenkov Mar 8, 2018
81e4ea1
Rollup merge of #48709 - tinaun:issue48703, r=nikomatsakis
alexcrichton Apr 5, 2018
c887c22
Rollup merge of #48851 - petrochenkov:genparattr, r=nikomatsakis
alexcrichton Apr 5, 2018
0afb655
Rollup merge of #49154 - petrochenkov:spident, r=eddyb
alexcrichton Apr 5, 2018
ab7bb51
Rollup merge of #49253 - chmanchester:probing_fix, r=alexcrichton
alexcrichton Apr 5, 2018
07e06ad
Rollup merge of #49345 - davidtwco:issue-44109, r=nikomatsakis
alexcrichton Apr 5, 2018
2d9e754
Rollup merge of #49419 - leodasvacas:small-typeck-refactorings, r=nik…
alexcrichton Apr 5, 2018
59053aa
Rollup merge of #49432 - nabijaczleweli:master, r=michaelwoerister
alexcrichton Apr 5, 2018
7432273
Rollup merge of #49488 - alexcrichton:small-wasm-panic, r=sfackler
alexcrichton Apr 5, 2018
1191bb1
Rollup merge of #49496 - glandium:master, r=sfackler
alexcrichton Apr 5, 2018
f8e3584
Rollup merge of #49563 - japaric:std-thumb, r=alexcrichton
alexcrichton 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
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
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
6 changes: 6 additions & 0 deletions src/ci/docker/wasm32-unknown/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ ENV RUST_CONFIGURE_ARGS \
--set build.nodejs=/node-v9.2.0-linux-x64/bin/node \
--set rust.lld

# Some run-make tests have assertions about code size, and enabling debug
# assertions in libstd causes the binary to be much bigger than it would
# otherwise normally be. We already test libstd with debug assertions in lots of
# other contexts as well
ENV NO_DEBUG_ASSERTIONS=1

ENV SCRIPT python2.7 /checkout/x.py test --target $TARGETS \
src/test/run-make \
src/test/ui \
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#![feature(fmt_internals)]
#![feature(from_ref)]
#![feature(fundamental)]
#![feature(generic_param_attrs)]
#![cfg_attr(stage0, feature(generic_param_attrs))]
#![cfg_attr(stage0, feature(i128_type))]
#![feature(lang_items)]
#![feature(needs_allocator)]
Expand Down
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
2 changes: 1 addition & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(generic_param_attrs)]
#![cfg_attr(stage0, feature(generic_param_attrs))]
#![cfg_attr(test, feature(test))]

#![allow(deprecated)]
Expand Down
10 changes: 10 additions & 0 deletions src/libcore/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,13 @@ impl<'a> fmt::Display for Location<'a> {
write!(formatter, "{}:{}:{}", self.file, self.line, self.col)
}
}

/// An internal trait used by libstd to pass data from libstd to `panic_unwind`
/// and other panic runtimes. Not intended to be stabilized any time soon, do
/// not use.
#[unstable(feature = "std_internals", issue = "0")]
#[doc(hidden)]
pub unsafe trait BoxMeUp {
fn box_me_up(&mut self) -> *mut (Any + Send);
fn get(&self) -> &(Any + Send);
}
2 changes: 1 addition & 1 deletion src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub unsafe extern fn __rust_maybe_catch_panic(f: fn(*mut u8),
// now hopefully.
#[no_mangle]
#[rustc_std_internal_symbol]
pub unsafe extern fn __rust_start_panic(_data: usize, _vtable: usize) -> u32 {
pub unsafe extern fn __rust_start_panic(_payload: usize) -> u32 {
abort();

#[cfg(any(unix, target_os = "cloudabi"))]
Expand Down
12 changes: 7 additions & 5 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
#![deny(warnings)]

#![feature(allocator_api)]
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(panic_unwind)]
#![feature(raw)]
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(unwind_attributes)]
#![cfg_attr(target_env = "msvc", feature(raw))]

Expand All @@ -48,9 +50,11 @@ extern crate libc;
#[cfg(not(any(target_env = "msvc", all(windows, target_arch = "x86_64", target_env = "gnu"))))]
extern crate unwind;

use alloc::boxed::Box;
use core::intrinsics;
use core::mem;
use core::raw;
use core::panic::BoxMeUp;

// Rust runtime's startup objects depend on these symbols, so make them public.
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
Expand Down Expand Up @@ -114,9 +118,7 @@ pub unsafe extern "C" fn __rust_maybe_catch_panic(f: fn(*mut u8),
#[no_mangle]
#[cfg_attr(stage0, unwind)]
#[cfg_attr(not(stage0), unwind(allowed))]
pub unsafe extern "C" fn __rust_start_panic(data: usize, vtable: usize) -> u32 {
imp::panic(mem::transmute(raw::TraitObject {
data: data as *mut (),
vtable: vtable as *mut (),
}))
pub unsafe extern "C" fn __rust_start_panic(payload: usize) -> u32 {
let payload = payload as *mut &mut BoxMeUp;
imp::panic(Box::from_raw((*payload).box_me_up()))
}
18 changes: 10 additions & 8 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,15 +720,17 @@ impl TokenTree {
}).into();
},
TokenNode::Term(symbol) => {
let ident = ast::Ident { name: symbol.0, ctxt: self.span.0.ctxt() };
let ident = ast::Ident::new(symbol.0, self.span.0);
let sym_str = symbol.0.as_str();
let token =
if sym_str.starts_with("'") { Lifetime(ident) }
else if sym_str.starts_with("r#") {
let name = Symbol::intern(&sym_str[2..]);
let ident = ast::Ident { name, ctxt: self.span.0.ctxt() };
Ident(ident, true)
} else { Ident(ident, false) };
let token = if sym_str.starts_with("'") {
Lifetime(ident)
} else if sym_str.starts_with("r#") {
let name = Symbol::intern(&sym_str[2..]);
let ident = ast::Ident::new(name, ident.span);
Ident(ident, true)
} else {
Ident(ident, false)
};
return TokenTree::Token(self.span.0, token).into();
}
TokenNode::Literal(self::Literal(Literal(Lit::Integer(ref a), b)))
Expand Down
1 change: 1 addition & 0 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ define_dep_nodes!( <'tcx>
[input] CrateDisambiguator(CrateNum),
[input] CrateHash(CrateNum),
[input] OriginalCrateName(CrateNum),
[input] ExtraFileName(CrateNum),

[] ImplementationsOfTrait { krate: CrateNum, trait_id: DefId },
[] AllTraitImplementations(CrateNum),
Expand Down
Loading