Skip to content

Rollup of 15 pull requests #41539

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 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 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
e1afddc
Haiku: fix initial platform support
jessicah Apr 22, 2017
f8c6436
Step::replace_one should put a one, not a zero (Issue #41492)
scottmcm Apr 24, 2017
f852e3f
use the word 'length' in Vec::len's docs
steveklabnik Apr 24, 2017
e482529
Fix invalid module suggestion
GuillaumeGomez Dec 9, 2016
bd880bc
Add tests for module suggestions
GuillaumeGomez Jan 3, 2017
b10c044
Remove strip prefix
GuillaumeGomez Feb 25, 2017
0d63f13
Haiku: add missing cases of using LIBRARY_PATH
jessicah Apr 24, 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
93d57d6
Pass `--format-version 1` to `cargo metadata`.
kennytm Apr 17, 2017
00dff0a
Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.
kennytm Apr 17, 2017
86747a9
Force link with an absolute rpath when using sanitizer on macOS.
kennytm Apr 20, 2017
3b33913
appveyor: Upgrade to gcc for mingw 6.3.0
alexcrichton Apr 20, 2017
ca96892
Clean up TcpStream example
steveklabnik Apr 25, 2017
dce33e9
Clarify the doc index
steveklabnik Apr 25, 2017
696df71
Clarify "side effect" in peek's docs
steveklabnik Apr 25, 2017
3f97b2a
Add ui tests
GuillaumeGomez Apr 24, 2017
164fd69
Do not check if libclang_rt.?san_*_dynamic.dylib is an unstable crate.
kennytm Apr 25, 2017
19b7272
Fix up vec guarnatee around capacity
steveklabnik Apr 25, 2017
c4db48c
Rollup merge of #39983 - AndrewGaspar:rust-windbg, r=brson
Apr 25, 2017
e7d78e7
Rollup merge of #41352 - kennytm:macos-sanitizers, r=alexcrichton
Apr 25, 2017
81e1281
Rollup merge of #41370 - malbarbo:android-bootstrap, r=alexcrichton
Apr 25, 2017
38fb097
Rollup merge of #41420 - alexcrichton:mingw-6.3.0, r=petrochenkov
Apr 25, 2017
2af895c
Rollup merge of #41442 - tbu-:pr_writeall_interrupted, r=aturon
Apr 25, 2017
f7ad2df
Rollup merge of #41456 - jessicah:haiku-support, r=alexcrichton
Apr 25, 2017
9e6641a
Rollup merge of #41463 - SergioBenitez:master, r=alexcrichton
Apr 25, 2017
adbca82
Rollup merge of #41493 - scottmcm:fix-step-replace, r=sfackler
Apr 25, 2017
7a910ad
Rollup merge of #41500 - steveklabnik:gh37866, r=frewsxcv
Apr 25, 2017
5f9eb73
Rollup merge of #41501 - GuillaumeGomez:invalid_module_location, r=js…
Apr 25, 2017
1eb4e5a
Rollup merge of #41518 - tbu-:pr_fix_cp_error, r=sfackler
Apr 25, 2017
f8b265e
Rollup merge of #41526 - steveklabnik:gh35950, r=GuillaumeGomez
Apr 25, 2017
f52af0b
Rollup merge of #41527 - steveklabnik:gh41285, r=frewsxcv
Apr 25, 2017
72dc0f0
Rollup merge of #41528 - steveklabnik:gh33269, r=frewsxcv
Apr 25, 2017
8ccf0e8
Rollup merge of #41535 - steveklabnik:gh37746, r=alexcrichton
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
28 changes: 24 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ environment:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-ninja
SCRIPT: python x.py test
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
MINGW_ARCHIVE: i686-6.2.0-release-posix-dwarf-rt_v5-rev1.7z
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev1.7z
MINGW_DIR: mingw32
- MSYS_BITS: 64
SCRIPT: python x.py test
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-ninja
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
MINGW_ARCHIVE: x86_64-6.2.0-release-posix-seh-rt_v5-rev1.7z
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev1.7z
MINGW_DIR: mingw64

# 32/64 bit MSVC and GNU deployment
Expand All @@ -60,14 +60,14 @@ environment:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended --enable-ninja
SCRIPT: python x.py dist
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
MINGW_ARCHIVE: i686-6.2.0-release-posix-dwarf-rt_v5-rev1.7z
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev1.7z
MINGW_DIR: mingw32
DEPLOY: 1
- MSYS_BITS: 64
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended --enable-ninja
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
MINGW_ARCHIVE: x86_64-6.2.0-release-posix-seh-rt_v5-rev1.7z
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev1.7z
MINGW_DIR: mingw64
DEPLOY: 1

Expand Down Expand Up @@ -96,6 +96,26 @@ install:
- if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
- if defined MINGW_URL set PATH=%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%

# Here we do a pretty heinous thing which is to mangle the MinGW installation
# we just had above. Currently, as of this writing, we're using MinGW-w64
# builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it appears to
# be the first version which contains a fix for #40546, builds randomly
# failing during LLVM due to ar.exe/ranlib.exe failures.
#
# Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
# to contain a regression in gdb (#40184). As a result if we were to use the
# gdb provided (7.11.1) then we would fail all debuginfo tests.
#
# In order to fix spurious failures (pretty high priority) we use 6.3.0. To
# avoid disabling gdb tests we download an *old* version of gdb, specifically
# that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
# with the 6.2.0 gdb to get tests passing.
#
# Note that we don't literally overwrite the gdb.exe binary because it appears
# to just use gdborig.exe, so that's the binary we deal with instead.
- if defined MINGW_URL appveyor-retry appveyor DownloadFile %MINGW_URL%/2017-04-20-%MSYS_BITS%bits-gdborig.exe
- if defined MINGW_URL mv 2017-04-20-%MSYS_BITS%bits-gdborig.exe %MINGW_DIR%\bin\gdborig.exe

# Otherwise pull in the MinGW installed on appveyor
- if NOT defined MINGW_URL set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH%

Expand Down
25 changes: 19 additions & 6 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ def build_bootstrap(self):
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
if "DYLD_LIBRARY_PATH" in env else ""
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["LIBRARY_PATH"]) \
if "LIBRARY_PATH" in env else ""
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
os.pathsep + env["PATH"]
if not os.path.isfile(self.cargo()):
Expand Down Expand Up @@ -407,7 +410,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 +471,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
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
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
2 changes: 2 additions & 0 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ pub fn dylib_path_var() -> &'static str {
"PATH"
} else if cfg!(target_os = "macos") {
"DYLD_LIBRARY_PATH"
} else if cfg!(target_os = "haiku") {
"LIBRARY_PATH"
} else {
"LD_LIBRARY_PATH"
}
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
13 changes: 9 additions & 4 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,21 @@ nicknamed 'The Rust Bookshelf.'
* [The Rustonomicon][nomicon] is your guidebook to the dark arts of unsafe Rust.
* [The Reference][ref] is not a formal spec, but is more detailed and comprehensive than the book.

Initially, documentation lands in the Unstable Book, and then, as part of the
stabilization process, is moved into the Book, Nomicon, or Reference.

Another few words about the reference: it is guaranteed to be accurate, but not
complete. We now have a policy that all new features must be included in the
reference before stabilization; however, we are still back-filling things that
landed before then. That work is being tracked [here][38643].
complete. We have a policy that features must have documentation to be stabilized,
but we did not always have this policy, and so there are some stable things that
are not yet in the reference. We're working on back-filling things that landed
before this policy was put into place. That work is being tracked
[here][refchecklist].

[Rust Learning]: https://github.com/ctjhoa/rust-learning
[Docs.rs]: https://docs.rs/
[api]: std/index.html
[ref]: reference/index.html
[38643]: https://github.com/rust-lang/rust/issues/38643
[refchecklist]: https://github.com/rust-lang-nursery/reference/issues/9
[err]: error-index.html
[book]: book/index.html
[nomicon]: nomicon/index.html
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 @@ -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
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}`.
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;" %*
7 changes: 5 additions & 2 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ use Bound::{Excluded, Included, Unbounded};
/// removed data to be erased for security purposes. Even if you drop a `Vec`, its
/// buffer may simply be reused by another `Vec`. Even if you zero a `Vec`'s memory
/// first, that may not actually happen because the optimizer does not consider
/// this a side-effect that must be preserved.
/// this a side-effect that must be preserved. There is one case which we will
/// not break, however: using `unsafe` code to write to the excess capacity,
/// and then increasing the length to match, is always valid.
///
/// `Vec` does not currently guarantee the order in which elements are dropped
/// (the order has changed in the past, and may change again).
Expand Down Expand Up @@ -1147,7 +1149,8 @@ impl<T> Vec<T> {
self.truncate(0)
}

/// Returns the number of elements in the vector.
/// Returns the number of elements in the vector, also referred to
/// as its 'length'.
///
/// # Examples
///
Expand Down
5 changes: 3 additions & 2 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,9 @@ pub trait Iterator {
///
/// Note that the underlying iterator is still advanced when [`peek`] is
/// called for the first time: In order to retrieve the next element,
/// [`next`] is called on the underlying iterator, hence any side effects of
/// the [`next`] method will occur.
/// [`next`] is called on the underlying iterator, hence any side effects (i.e.
/// anything other than fetching the next value) of the [`next`] method
/// will occur.
///
/// [`peek`]: struct.Peekable.html#method.peek
/// [`next`]: ../../std/iter/trait.Iterator.html#tymethod.next
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ macro_rules! step_impl_unsigned {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down Expand Up @@ -157,12 +157,12 @@ macro_rules! step_impl_signed {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down Expand Up @@ -206,12 +206,12 @@ macro_rules! step_impl_no_between {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down
Loading