Skip to content

Rollup of 7 pull requests #41513

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

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a42c025
Add bootstrap support for android
malbarbo Apr 18, 2017
87d3272
Pass `--format-version 1` to `cargo metadata`.
kennytm Apr 17, 2017
f2bbd45
Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.
kennytm Apr 17, 2017
b455737
Force link with an absolute rpath when using sanitizer on macOS.
kennytm Apr 20, 2017
d7efbec
Adding links and examples for various mspc pages #29377
projektir Apr 21, 2017
2111aff
Add Vec::splice and String::splice
SimonSapin Apr 8, 2017
b85e2e4
Update splice impl
mattico Apr 8, 2017
cec00ba
Improve splice docs and tests
mattico Apr 8, 2017
c3baa8c
Use Vec::splice impl in string::Splice::drop()
mattico Apr 8, 2017
7b86ba0
Add splice to the unstable book.
mattico Apr 8, 2017
f852e3f
use the word 'length' in Vec::len's docs
steveklabnik Apr 24, 2017
612bb1f
rustc: rename some of the queries to match tcx methods.
eddyb Apr 24, 2017
9bde6b6
rustc: expose the common DUMMY_SP query case as tcx methods.
eddyb Apr 24, 2017
feae5a0
Add Splice forget test
mattico Apr 24, 2017
decf759
rustc: use tcx.at(span) to set the location of a query.
eddyb Apr 24, 2017
009f45f
Run tests for the cargo submodule in tree
alexcrichton Apr 18, 2017
0547f71
Rollup merge of #40434 - mattico:splice-update, r=alexcrichton
frewsxcv Apr 24, 2017
80a45da
Rollup merge of #41352 - kennytm:macos-sanitizers, r=alexcrichton
frewsxcv Apr 24, 2017
2f36312
Rollup merge of #41362 - alexcrichton:run-cargot-ests, r=aturon
frewsxcv Apr 24, 2017
9fb3885
Rollup merge of #41370 - malbarbo:android-bootstrap, r=alexcrichton
frewsxcv Apr 24, 2017
f8de13c
Rollup merge of #41438 - projektir:mpsc_docs, r=alexcrichton
frewsxcv Apr 24, 2017
7de8da5
Rollup merge of #41500 - steveklabnik:gh37866, r=frewsxcv
frewsxcv Apr 24, 2017
4d6b278
Rollup merge of #41504 - eddyb:query-api, r=nikomatsakis
frewsxcv Apr 24, 2017
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ matrix:
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
- env: >
RUST_CHECK_TARGET=check
RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin
RUST_CONFIGURE_ARGS="--build=x86_64-apple-darwin --enable-sanitizers"
SRC=.
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
Expand Down Expand Up @@ -98,7 +98,7 @@ matrix:
install: *osx_install_sccache
- env: >
RUST_CHECK_TARGET=dist
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended"
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers"
SRC=.
DEPLOY=1
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
Expand Down
2 changes: 1 addition & 1 deletion cargo
Submodule cargo updated 1 files
+0 −2 src/ci/docker/run.sh
22 changes: 16 additions & 6 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ def build_triple(self):
# The goal here is to come up with the same triple as LLVM would,
# at least for the subset of platforms we're willing to target.
if ostype == 'Linux':
ostype = 'unknown-linux-gnu'
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
if os == 'Android':
ostype = 'linux-android'
else:
ostype = 'unknown-linux-gnu'
elif ostype == 'FreeBSD':
ostype = 'unknown-freebsd'
elif ostype == 'DragonFly':
Expand Down Expand Up @@ -464,15 +468,21 @@ def build_triple(self):
cputype = 'i686'
elif cputype in {'xscale', 'arm'}:
cputype = 'arm'
if ostype == 'linux-android':
ostype = 'linux-androideabi'
elif cputype == 'armv6l':
cputype = 'arm'
ostype += 'eabihf'
if ostype == 'linux-android':
ostype = 'linux-androideabi'
else:
ostype += 'eabihf'
elif cputype in {'armv7l', 'armv8l'}:
cputype = 'armv7'
ostype += 'eabihf'
elif cputype == 'aarch64':
cputype = 'aarch64'
elif cputype == 'arm64':
if ostype == 'linux-android':
ostype = 'linux-androideabi'
else:
ostype += 'eabihf'
elif cputype in {'aarch64', 'arm64'}:
cputype = 'aarch64'
elif cputype == 'mips':
if sys.byteorder == 'big':
Expand Down
40 changes: 29 additions & 11 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ pub fn linkcheck(build: &Build, host: &str) {
pub fn cargotest(build: &Build, stage: u32, host: &str) {
let ref compiler = Compiler::new(stage, host);

// Configure PATH to find the right rustc. NB. we have to use PATH
// and not RUSTC because the Cargo test suite has tests that will
// fail if rustc is not spelled `rustc`.
let path = build.sysroot(compiler).join("bin");
let old_path = ::std::env::var("PATH").expect("");
let sep = if cfg!(windows) { ";" } else {":" };
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);

// Note that this is a short, cryptic, and not scoped directory name. This
// is currently to minimize the length of path on Windows where we otherwise
// quickly run into path name limit constraints.
Expand All @@ -95,9 +87,35 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
let _time = util::timeit();
let mut cmd = Command::new(build.tool(&Compiler::new(0, host), "cargotest"));
build.prepare_tool_cmd(compiler, &mut cmd);
build.run(cmd.env("PATH", newpath)
.arg(&build.cargo)
.arg(&out_dir));
build.run(cmd.arg(&build.cargo)
.arg(&out_dir)
.env("RUSTC", build.compiler_path(compiler))
.env("RUSTDOC", build.rustdoc(compiler)))
}

/// Runs `cargo test` for `cargo` packaged with Rust.
pub fn cargo(build: &Build, stage: u32, host: &str) {
let ref compiler = Compiler::new(stage, host);

// Configure PATH to find the right rustc. NB. we have to use PATH
// and not RUSTC because the Cargo test suite has tests that will
// fail if rustc is not spelled `rustc`.
let path = build.sysroot(compiler).join("bin");
let old_path = ::std::env::var("PATH").expect("");
let sep = if cfg!(windows) { ";" } else {":" };
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);

let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("cargo/Cargo.toml"));

// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");

// Don't run cross-compile tests, we may not have cross-compiled libstd libs
// available.
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");

build.run(cargo.env("PATH", newpath));
}

/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
Expand Down
16 changes: 16 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ pub fn std_link(build: &Build,
if target.contains("musl") && !target.contains("mips") {
copy_musl_third_party_objects(build, target, &libdir);
}

if build.config.sanitizers && target == "x86_64-apple-darwin" {
copy_apple_sanitizer_dylibs(&build.native_dir(target), "osx", &libdir);
}
}

/// Copies the crt(1,i,n).o startup objects
Expand All @@ -126,6 +130,18 @@ fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
}
}

fn copy_apple_sanitizer_dylibs(native_dir: &Path, platform: &str, into: &Path) {
for &sanitizer in &["asan", "tsan"] {
let filename = format!("libclang_rt.{}_{}_dynamic.dylib", sanitizer, platform);
let mut src_path = native_dir.join(sanitizer);
src_path.push("build");
src_path.push("lib");
src_path.push("darwin");
src_path.push(&filename);
copy(&src_path, &into.join(filename));
}
}

/// Build and prepare startup objects like rsbegin.o and rsend.o
///
/// These are primarily used on Windows right now for linking executables/dlls.
Expand Down
13 changes: 13 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,19 @@ impl Build {
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
}

// When being built Cargo will at some point call `nmake.exe` on Windows
// MSVC. Unfortunately `nmake` will read these two environment variables
// below and try to intepret them. We're likely being run, however, from
// MSYS `make` which uses the same variables.
//
// As a result, to prevent confusion and errors, we remove these
// variables from our environment to prevent passing MSYS make flags to
// nmake, causing it to blow up.
if cfg!(target_env = "msvc") {
cargo.env_remove("MAKE");
cargo.env_remove("MAKEFLAGS");
}

// Environment variables *required* needed throughout the build
//
// FIXME: should update code to not require this env var
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fn build_krate(build: &mut Build, krate: &str) {
// the dependency graph and what `-p` arguments there are.
let mut cargo = Command::new(&build.cargo);
cargo.arg("metadata")
.arg("--format-version").arg("1")
.arg("--manifest-path").arg(build.src.join(krate).join("Cargo.toml"));
let output = output(&mut cargo);
let output: Output = json::decode(&output).unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ check:
check-aux:
$(Q)$(BOOTSTRAP) test \
src/tools/cargotest \
cargo \
src/test/pretty \
src/test/run-pass/pretty \
src/test/run-fail/pretty \
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.dep(|s| s.name("librustc"))
.host(true)
.run(move |s| check::cargotest(build, s.stage, s.target));
rules.test("check-cargo", "cargo")
.dep(|s| s.name("tool-cargo"))
.host(true)
.run(move |s| check::cargo(build, s.stage, s.target));
rules.test("check-tidy", "src/tools/tidy")
.dep(|s| s.name("tool-tidy").stage(0))
.default(true)
Expand Down
21 changes: 20 additions & 1 deletion src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ pub fn native_lib_boilerplate(src_name: &str,
let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or(env::var_os("OUT_DIR").unwrap());
let out_dir = PathBuf::from(out_dir).join(out_name);
t!(create_dir_racy(&out_dir));
println!("cargo:rustc-link-lib=static={}", link_name);
if link_name.contains('=') {
println!("cargo:rustc-link-lib={}", link_name);
} else {
println!("cargo:rustc-link-lib=static={}", link_name);
}
println!("cargo:rustc-link-search=native={}", out_dir.join(search_subdir).display());

let timestamp = out_dir.join("rustbuild.timestamp");
Expand All @@ -209,6 +213,21 @@ pub fn native_lib_boilerplate(src_name: &str,
}
}

pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoilerplate, ()> {
let (link_name, search_path) = match &*env::var("TARGET").unwrap() {
"x86_64-unknown-linux-gnu" => (
format!("clang_rt.{}-x86_64", sanitizer_name),
"build/lib/linux",
),
"x86_64-apple-darwin" => (
format!("dylib=clang_rt.{}_osx_dynamic", sanitizer_name),
"build/lib/darwin",
),
_ => return Err(()),
};
native_lib_boilerplate("compiler-rt", sanitizer_name, &link_name, search_path)
}

fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
let meta = t!(e.metadata());
Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
- [slice_rsplit](library-features/slice-rsplit.md)
- [sort_internals](library-features/sort-internals.md)
- [sort_unstable](library-features/sort-unstable.md)
- [splice](library-features/splice.md)
- [step_by](library-features/step-by.md)
- [step_trait](library-features/step-trait.md)
- [str_checked_slicing](library-features/str-checked-slicing.md)
Expand Down
24 changes: 24 additions & 0 deletions src/doc/unstable-book/src/library-features/splice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# `splice`

The tracking issue for this feature is: [#32310]

[#32310]: https://github.com/rust-lang/rust/issues/32310

------------------------

The `splice()` method on `Vec` and `String` allows you to replace a range
of values in a vector or string with another range of values, and returns
the replaced values.

A simple example:

```rust
#![feature(splice)]
let mut s = String::from("α is alpha, β is beta");
let beta_offset = s.find('β').unwrap_or(s.len());

// Replace the range up until the β from the string
let t: String = s.splice(..beta_offset, "Α is capital alpha; ").collect();
assert_eq!(t, "α is alpha, ");
assert_eq!(s, "Α is capital alpha; β is beta");
```
6 changes: 1 addition & 5 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,13 +1519,9 @@ impl<T: Clone> ToOwned for [T] {
self.to_vec()
}

// HACK(japaric): with cfg(test) the inherent `[T]::to_vec`, which is required for this method
// definition, is not available. Since we don't require this method for testing purposes, I'll
// just stub it
// NB see the slice::hack module in slice.rs for more information
#[cfg(test)]
fn to_owned(&self) -> Vec<T> {
panic!("not available with cfg(test)")
hack::to_vec(self)
}

fn clone_into(&self, target: &mut Vec<T>) {
Expand Down
Loading