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

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a42c025
Add bootstrap support for android
malbarbo Apr 18, 2017
c49d090
Specify behavior of `write_all` for `ErrorKind::Interrupted` errors
tbu- 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
feae5a0
Add Splice forget test
mattico Apr 24, 2017
009f45f
Run tests for the cargo submodule in tree
alexcrichton Apr 18, 2017
bd5e56c
Pass `--format-version 1` to `cargo metadata`.
kennytm Apr 17, 2017
3c8118d
Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.
kennytm Apr 17, 2017
ec4c9b9
Force link with an absolute rpath when using sanitizer on macOS.
kennytm Apr 20, 2017
957d51a
Fix a copy-paste error in `Instant::sub_duration`
tbu- Apr 24, 2017
70e6739
Adds rust-windbg.cmd script
AndrewGaspar Feb 20, 2017
a765dca
Add internal accessor methods to io::{Chain, Take}.
SergioBenitez Apr 22, 2017
aab87e3
Add more_io_inner_methods feature to unstable book.
SergioBenitez Apr 22, 2017
76397ae
Reference tracking issue for more_io_inner_methods.
SergioBenitez Apr 24, 2017
c168d8b
Add cautions to io::get_mut method documentation.
SergioBenitez Apr 24, 2017
2ac3d6a
Rollup merge of #39983 - AndrewGaspar:rust-windbg, r=brson
frewsxcv Apr 25, 2017
5947cec
Rollup merge of #40434 - mattico:splice-update, r=alexcrichton
frewsxcv Apr 25, 2017
fc37cc0
Rollup merge of #41352 - kennytm:macos-sanitizers, r=alexcrichton
frewsxcv Apr 25, 2017
05cf1dd
Rollup merge of #41362 - alexcrichton:run-cargot-ests, r=aturon
frewsxcv Apr 25, 2017
429f8ff
Rollup merge of #41370 - malbarbo:android-bootstrap, r=alexcrichton
frewsxcv Apr 25, 2017
ee274be
Rollup merge of #41442 - tbu-:pr_writeall_interrupted, r=aturon
frewsxcv Apr 25, 2017
4318c48
Rollup merge of #41463 - SergioBenitez:master, r=alexcrichton
frewsxcv Apr 25, 2017
f2ebe4c
Rollup merge of #41500 - steveklabnik:gh37866, r=frewsxcv
frewsxcv Apr 25, 2017
c63aca0
Rollup merge of #41518 - tbu-:pr_fix_cp_error, r=sfackler
frewsxcv Apr 25, 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
19 changes: 19 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ 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 && compiler.stage != 0 && target == "x86_64-apple-darwin" {
// The sanitizers are only built in stage1 or above, so the dylibs will
// be missing in stage0 and causes panic. See the `std()` function above
// for reason why the sanitizers are not built in stage0.
copy_apple_sanitizer_dylibs(&build.native_dir(target), "osx", &libdir);
}
}

/// Copies the crt(1,i,n).o startup objects
Expand All @@ -126,6 +133,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
7 changes: 6 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,12 @@ pub fn debugger_scripts(build: &Build,
install(&build.src.join("src/etc/").join(file), &dst, 0o644);
};
if host.contains("windows-msvc") {
// no debugger scripts
// windbg debugger scripts
install(&build.src.join("src/etc/rust-windbg.cmd"), &sysroot.join("bin"),
0o755);

cp_debugger_script("natvis/libcore.natvis");
cp_debugger_script("natvis/libcollections.natvis");
} else {
cp_debugger_script("debugger_pretty_printers_common.py");

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
2 changes: 2 additions & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
- [linked_list_extras](library-features/linked-list-extras.md)
- [lookup_host](library-features/lookup-host.md)
- [manually_drop](library-features/manually-drop.md)
- [more_io_inner_methods](library-features/more-io-inner-methods.md)
- [mpsc_select](library-features/mpsc-select.md)
- [n16](library-features/n16.md)
- [never_type_impls](library-features/never-type-impls.md)
Expand Down Expand Up @@ -195,6 +196,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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `more_io_inner_methods`

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

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

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

This feature enables several internal accessor methods on structures in
`std::io` including `Take::{get_ref, get_mut}` and `Chain::{into_inner, get_ref,
get_mut}`.
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");
```
18 changes: 18 additions & 0 deletions src/etc/rust-windbg.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
setlocal

REM Copyright 2014 The Rust Project Developers. See the COPYRIGHT
REM file at the top-level directory of this distribution and at
REM http://rust-lang.org/COPYRIGHT.
REM
REM Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
REM http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
REM <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
REM option. This file may not be copied, modified, or distributed
REM except according to those terms.

for /f "delims=" %%i in ('rustc --print=sysroot') do set rustc_sysroot=%%i

set rust_etc=%rustc_sysroot%\lib\rustlib\etc

windbg -c ".nvload %rust_etc%\libcore.natvis;.nvload %rust_etc%\libcollections.natvis;" %*
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