From 7e346df43ed8bd696fa9c92a9992fc13734f6b86 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 6 Mar 2018 23:17:49 -0500 Subject: [PATCH 01/14] Impl Integer methods for Wrapping Wrapping now implements: count_ones, count_zeros, leading_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, from_be, from_le, to_be, to_le, and pow where T is: u8, u16, u32, u64, usize, i8, i16, i32, i64, or isize. Docs were written for all these methods, as well as examples. The examples mirror the ones on u8, u16, etc... for consistency. Closes #32463 --- src/libcore/num/wrapping.rs | 299 ++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index ae1b0b3ce11b2..6c110aa052311 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -317,11 +317,307 @@ macro_rules! wrapping_impl { } forward_ref_unop! { impl Neg, neg for Wrapping<$t>, #[stable(feature = "wrapping_ref", since = "1.14.0")] } + )*) } wrapping_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } +macro_rules! wrapping_int_impl { + ($($t:ty)*) => ($( + impl Wrapping<$t> { + /// Returns the number of ones in the binary representation of + /// `self`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(-0b1000_0000); + /// + /// assert_eq!(n.count_ones(), 1); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn count_ones(self) -> u32 { + self.0.count_ones() + } + + /// Returns the number of zeros in the binary representation of + /// `self`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(-0b1000_0000); + /// + /// assert_eq!(n.count_zeros(), 7); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn count_zeros(self) -> u32 { + self.0.count_zeros() + } + + /// Returns the number of leading zeros in the binary representation + /// of `self`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(-1); + /// + /// assert_eq!(n.leading_zeros(), 0); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn leading_zeros(self) -> u32 { + self.0.leading_zeros() + } + + /// Returns the number of trailing zeros in the binary representation + /// of `self`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(-4); + /// + /// assert_eq!(n.trailing_zeros(), 2); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn trailing_zeros(self) -> u32 { + self.0.trailing_zeros() + } + + /// Shifts the bits to the left by a specified amount, `n`, + /// wrapping the truncated bits to the end of the resulting + /// integer. + /// + /// Please note this isn't the same operation as `>>`! + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); + /// let m: Wrapping = Wrapping(-0x76543210FEDCBA99); + /// + /// assert_eq!(n.rotate_left(32), m); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn rotate_left(self, n: u32) -> Self { + Wrapping(self.0.rotate_left(n)) + } + + /// Shifts the bits to the right by a specified amount, `n`, + /// wrapping the truncated bits to the beginning of the resulting + /// integer. + /// + /// Please note this isn't the same operation as `<<`! + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); + /// let m: Wrapping = Wrapping(-0xFEDCBA987654322); + /// + /// assert_eq!(n.rotate_right(4), m); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn rotate_right(self, n: u32) -> Self { + Wrapping(self.0.rotate_right(n)) + } + + /// Reverses the byte order of the integer. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0b0000000_01010101); + /// assert_eq!(n, Wrapping(85)); + /// + /// let m = n.swap_bytes(); + /// + /// assert_eq!(m, Wrapping(0b01010101_00000000)); + /// assert_eq!(m, Wrapping(21760)); + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn swap_bytes(self) -> Self { + Wrapping(self.0.swap_bytes()) + } + + /// Converts an integer from big endian to the target's endianness. + /// + /// On big endian this is a no-op. On little endian the bytes are + /// swapped. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); + /// + /// if cfg!(target_endian = "big") { + /// assert_eq!(Wrapping::::from_be(n), n); + /// } else { + /// assert_eq!(Wrapping::::from_be(n), n.swap_bytes()); + /// } + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn from_be(x: Self) -> Self { + Wrapping(<$t>::from_be(x.0)) + } + + /// Converts an integer from little endian to the target's endianness. + /// + /// On little endian this is a no-op. On big endian the bytes are + /// swapped. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); + /// + /// if cfg!(target_endian = "little") { + /// assert_eq!(Wrapping::::from_le(n), n); + /// } else { + /// assert_eq!(Wrapping::::from_le(n), n.swap_bytes()); + /// } + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn from_le(x: Self) -> Self { + Wrapping(<$t>::from_le(x.0)) + } + + /// Converts `self` to big endian from the target's endianness. + /// + /// On big endian this is a no-op. On little endian the bytes are + /// swapped. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); + /// + /// if cfg!(target_endian = "big") { + /// assert_eq!(n.to_be(), n); + /// } else { + /// assert_eq!(n.to_be(), n.swap_bytes()); + /// } + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn to_be(self) -> Self { + Wrapping(self.0.to_be()) + } + + /// Converts `self` to little endian from the target's endianness. + /// + /// On little endian this is a no-op. On big endian the bytes are + /// swapped. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); + /// + /// if cfg!(target_endian = "little") { + /// assert_eq!(n.to_le(), n); + /// } else { + /// assert_eq!(n.to_le(), n.swap_bytes()); + /// } + /// ``` + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn to_le(self) -> Self { + Wrapping(self.0.to_le()) + } + + /// Raises self to the power of `exp`, using exponentiation by + /// squaring. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// let x: Wrapping = Wrapping(2); // or any other integer type + /// + /// assert_eq!(x.pow(4), Wrapping(16)); + #[inline] + #[unstable(feature = "wrapping_int_impl", issue = "32463")] + pub fn pow(self, exp: u32) -> Self { + Wrapping(self.0.pow(exp)) + } + } + )*) +} + +wrapping_int_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } + + mod shift_max { #![allow(non_upper_case_globals)] @@ -355,3 +651,6 @@ mod shift_max { pub const u64: u32 = i64; pub use self::platform::usize; } + + + From 55a2fdf2cf5408edba890ad1702462414899f40b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 6 Mar 2018 14:37:08 -0800 Subject: [PATCH 02/14] travis: Upgrade OSX builders This upgrades the OSX builders to the `xcode9.3-moar` image which has 3 cores as opposed to the 2 that our builders currently have. Should help make those OSX builds a bit speedier! --- .travis.yml | 4 +- .../debuginfo/lexical-scope-with-macro.rs | 1 + .../long-linker-command-lines/Makefile | 2 +- src/test/run-make/reproducible-build/Makefile | 28 +++++----- .../run-make/reproducible-build/linker.rs | 54 +++++++++++++++++++ 5 files changed, 70 insertions(+), 19 deletions(-) create mode 100644 src/test/run-make/reproducible-build/linker.rs diff --git a/.travis.yml b/.travis.yml index 4738f91665dbe..074149cf17118 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,7 @@ matrix: NO_LLVM_ASSERTIONS=1 NO_DEBUG_ASSERTIONS=1 os: osx - osx_image: xcode9.2 + osx_image: xcode9.3-moar if: branch = auto - env: > @@ -70,7 +70,7 @@ matrix: NO_LLVM_ASSERTIONS=1 NO_DEBUG_ASSERTIONS=1 os: osx - osx_image: xcode9.2 + osx_image: xcode9.3-moar if: branch = auto # OSX builders producing releases. These do not run the full test suite and diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs index eb5798dc7cc48..32d775168692b 100644 --- a/src/test/debuginfo/lexical-scope-with-macro.rs +++ b/src/test/debuginfo/lexical-scope-with-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // min-lldb-version: 310 +// ignore-macos FIXME #48807 // compile-flags:-g -Zdebug-macros diff --git a/src/test/run-make/long-linker-command-lines/Makefile b/src/test/run-make/long-linker-command-lines/Makefile index 309a27fe503ad..5876fbc94bc98 100644 --- a/src/test/run-make/long-linker-command-lines/Makefile +++ b/src/test/run-make/long-linker-command-lines/Makefile @@ -1,5 +1,5 @@ -include ../tools.mk all: - $(RUSTC) foo.rs -g + $(RUSTC) foo.rs -g -O RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/src/test/run-make/reproducible-build/Makefile b/src/test/run-make/reproducible-build/Makefile index 629e618505129..ca76a5e5d77b6 100644 --- a/src/test/run-make/reproducible-build/Makefile +++ b/src/test/run-make/reproducible-build/Makefile @@ -10,31 +10,27 @@ all: \ smoke: rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -o"$(TMPDIR)/reproducible-build1" - $(RUSTC) reproducible-build.rs -o"$(TMPDIR)/reproducible-build2" - $(B2) - nm "$(TMPDIR)/reproducible-build1" | sort > "$(TMPDIR)/reproducible-build1.nm" - nm "$(TMPDIR)/reproducible-build2" | sort > "$(TMPDIR)/reproducible-build2.nm" - cmp "$(TMPDIR)/reproducible-build1.nm" "$(TMPDIR)/reproducible-build2.nm" || exit 1 + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" debug: rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O $(RUSTC) reproducible-build-aux.rs -g - $(RUSTC) reproducible-build.rs -o"$(TMPDIR)/reproducible-build1" -g - $(RUSTC) reproducible-build.rs -o"$(TMPDIR)/reproducible-build2" -g - nm "$(TMPDIR)/reproducible-build1" | sort > "$(TMPDIR)/reproducible-build1-debug.nm" - nm "$(TMPDIR)/reproducible-build2" | sort > "$(TMPDIR)/reproducible-build2-debug.nm" - cmp "$(TMPDIR)/reproducible-build1-debug.nm" "$(TMPDIR)/reproducible-build2-debug.nm" || exit 1 + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" opt: rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O $(RUSTC) reproducible-build-aux.rs -O - $(RUSTC) reproducible-build.rs -o"$(TMPDIR)/reproducible-build1" -O - $(RUSTC) reproducible-build.rs -o"$(TMPDIR)/reproducible-build2" -O - nm "$(TMPDIR)/reproducible-build1" | sort > "$(TMPDIR)/reproducible-build1-opt.nm" - nm "$(TMPDIR)/reproducible-build2" | sort > "$(TMPDIR)/reproducible-build2-opt.nm" - cmp "$(TMPDIR)/reproducible-build1-opt.nm" "$(TMPDIR)/reproducible-build2-opt.nm" || exit 1 + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" link_paths: rm -rf $(TMPDIR) && mkdir $(TMPDIR) diff --git a/src/test/run-make/reproducible-build/linker.rs b/src/test/run-make/reproducible-build/linker.rs new file mode 100644 index 0000000000000..fd8946708bffd --- /dev/null +++ b/src/test/run-make/reproducible-build/linker.rs @@ -0,0 +1,54 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::env; +use std::path::Path; +use std::fs::File; +use std::io::{Read, Write}; + +fn main() { + let mut dst = env::current_exe().unwrap(); + dst.pop(); + dst.push("linker-arguments1"); + if dst.exists() { + dst.pop(); + dst.push("linker-arguments2"); + assert!(!dst.exists()); + } + + let mut out = String::new(); + for arg in env::args().skip(1) { + let path = Path::new(&arg); + if !path.is_file() { + out.push_str(&arg); + out.push_str("\n"); + continue + } + + let mut contents = Vec::new(); + File::open(path).unwrap().read_to_end(&mut contents).unwrap(); + + out.push_str(&format!("{}: {}\n", arg, hash(&contents))); + } + + File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); +} + +// fnv hash for now +fn hash(contents: &[u8]) -> u64 { + let mut hash = 0xcbf29ce484222325; + + for byte in contents { + hash = hash ^ (*byte as u64); + hash = hash.wrapping_mul(0x100000001b3); + } + + hash +} From d14f07e08916d3dbb3ff77b756bde324aeb05190 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Sat, 17 Feb 2018 09:54:11 +0100 Subject: [PATCH 03/14] bootstrap: pass datadir to rust-installer Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/config.rs | 4 +++- src/bootstrap/install.rs | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index f15d4d3585839..a4193ea8b8f30 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -127,6 +127,7 @@ pub struct Config { pub musl_root: Option, pub prefix: Option, pub sysconfdir: Option, + pub datadir: Option, pub docdir: Option, pub bindir: Option, pub libdir: Option, @@ -212,13 +213,13 @@ struct Build { struct Install { prefix: Option, sysconfdir: Option, + datadir: Option, docdir: Option, bindir: Option, libdir: Option, mandir: Option, // standard paths, currently unused - datadir: Option, infodir: Option, localstatedir: Option, } @@ -419,6 +420,7 @@ impl Config { if let Some(ref install) = toml.install { config.prefix = install.prefix.clone().map(PathBuf::from); config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from); + config.datadir = install.datadir.clone().map(PathBuf::from); config.docdir = install.docdir.clone().map(PathBuf::from); config.bindir = install.bindir.clone().map(PathBuf::from); config.libdir = install.libdir.clone().map(PathBuf::from); diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 20f7d379a6967..540c07748b9a0 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -67,18 +67,21 @@ fn install_sh( let prefix_default = PathBuf::from("/usr/local"); let sysconfdir_default = PathBuf::from("/etc"); - let docdir_default = PathBuf::from("share/doc/rust"); + let datadir_default = PathBuf::from("share"); + let docdir_default = datadir_default.join("doc/rust"); let bindir_default = PathBuf::from("bin"); let libdir_default = PathBuf::from("lib"); - let mandir_default = PathBuf::from("share/man"); + let mandir_default = datadir_default.join("man"); let prefix = build.config.prefix.as_ref().unwrap_or(&prefix_default); let sysconfdir = build.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default); + let datadir = build.config.datadir.as_ref().unwrap_or(&datadir_default); let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default); let bindir = build.config.bindir.as_ref().unwrap_or(&bindir_default); let libdir = build.config.libdir.as_ref().unwrap_or(&libdir_default); let mandir = build.config.mandir.as_ref().unwrap_or(&mandir_default); let sysconfdir = prefix.join(sysconfdir); + let datadir = prefix.join(datadir); let docdir = prefix.join(docdir); let bindir = prefix.join(bindir); let libdir = prefix.join(libdir); @@ -88,6 +91,7 @@ fn install_sh( let prefix = add_destdir(&prefix, &destdir); let sysconfdir = add_destdir(&sysconfdir, &destdir); + let datadir = add_destdir(&datadir, &destdir); let docdir = add_destdir(&docdir, &destdir); let bindir = add_destdir(&bindir, &destdir); let libdir = add_destdir(&libdir, &destdir); @@ -107,6 +111,7 @@ fn install_sh( .arg(sanitize_sh(&tmpdir(build).join(&package_name).join("install.sh"))) .arg(format!("--prefix={}", sanitize_sh(&prefix))) .arg(format!("--sysconfdir={}", sanitize_sh(&sysconfdir))) + .arg(format!("--datadir={}", sanitize_sh(&datadir))) .arg(format!("--docdir={}", sanitize_sh(&docdir))) .arg(format!("--bindir={}", sanitize_sh(&bindir))) .arg(format!("--libdir={}", sanitize_sh(&libdir))) From 02aa39f1733938d7fac2214deb9cba75c277c84a Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 8 Mar 2018 02:31:15 -0500 Subject: [PATCH 04/14] Make Wrapping::pow use wrapping_pow, add example --- src/libcore/num/wrapping.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 6c110aa052311..fb79ddd095172 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -606,10 +606,23 @@ macro_rules! wrapping_int_impl { /// let x: Wrapping = Wrapping(2); // or any other integer type /// /// assert_eq!(x.pow(4), Wrapping(16)); + /// ``` + /// + /// Results that are too large are wrapped: + /// + /// ``` + /// #![feature(wrapping_int_impl)] + /// use std::num::Wrapping; + /// + /// // 5 ^ 4 = 625, which is too big for a u8 + /// let x: Wrapping = Wrapping(5); + /// + /// assert_eq!(x.pow(4).0, 113); + /// ``` #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] pub fn pow(self, exp: u32) -> Self { - Wrapping(self.0.pow(exp)) + Wrapping(self.0.wrapping_pow(exp)) } } )*) @@ -651,6 +664,3 @@ mod shift_max { pub const u64: u32 = i64; pub use self::platform::usize; } - - - From 910d855171aab58ea51f69908011397e9a073ab0 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 8 Mar 2018 03:30:55 -0500 Subject: [PATCH 05/14] Fix trailing whitespace --- src/libcore/num/wrapping.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index fb79ddd095172..826883fdc3f01 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -525,7 +525,7 @@ macro_rules! wrapping_int_impl { /// use std::num::Wrapping; /// /// let n: Wrapping = Wrapping(0x0123456789ABCDEF); - /// + /// /// if cfg!(target_endian = "little") { /// assert_eq!(Wrapping::::from_le(n), n); /// } else { From 11915108810250f74e0d30ac6f12948a7e94e648 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Sun, 11 Feb 2018 15:39:09 -0700 Subject: [PATCH 06/14] Remove ONLY_BUILD_TARGETS. All cases where it is used can be replaced by substituing run.host for run.builder.build.build; that is its only effect. As such, it is removable. --- src/bootstrap/builder.rs | 7 +------ src/bootstrap/dist.rs | 21 +++------------------ src/bootstrap/install.rs | 3 +-- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 22656e5a9da4c..1e15d5393829f 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -60,9 +60,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { /// Run this rule for all hosts without cross compiling. const ONLY_HOSTS: bool = false; - /// Run this rule for all targets, but only with the native host. - const ONLY_BUILD_TARGETS: bool = false; - /// Only run this step with the build triple as host and target. const ONLY_BUILD: bool = false; @@ -101,7 +98,6 @@ pub struct RunConfig<'a> { struct StepDescription { default: bool, only_hosts: bool, - only_build_targets: bool, only_build: bool, should_run: fn(ShouldRun) -> ShouldRun, make_run: fn(RunConfig), @@ -138,7 +134,6 @@ impl StepDescription { StepDescription { default: S::DEFAULT, only_hosts: S::ONLY_HOSTS, - only_build_targets: S::ONLY_BUILD_TARGETS, only_build: S::ONLY_BUILD, should_run: S::should_run, make_run: S::make_run, @@ -155,7 +150,7 @@ impl StepDescription { self.name, builder.config.exclude); } let build = builder.build; - let hosts = if self.only_build_targets || self.only_build { + let hosts = if self.only_build { build.build_triple() } else { &build.hosts diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index aa0a7c52246ba..c3d8c9f8c010d 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -70,7 +70,6 @@ pub struct Docs { impl Step for Docs { type Output = PathBuf; const DEFAULT: bool = true; - const ONLY_BUILD_TARGETS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.path("src/doc") @@ -271,7 +270,6 @@ pub struct Mingw { impl Step for Mingw { type Output = Option; const DEFAULT: bool = true; - const ONLY_BUILD_TARGETS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.never() @@ -331,7 +329,6 @@ impl Step for Rustc { type Output = PathBuf; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - const ONLY_BUILD_TARGETS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.path("src/librustc") @@ -561,7 +558,6 @@ pub struct Std { impl Step for Std { type Output = PathBuf; const DEFAULT: bool = true; - const ONLY_BUILD_TARGETS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.path("src/libstd") @@ -569,7 +565,7 @@ impl Step for Std { fn make_run(run: RunConfig) { run.builder.ensure(Std { - compiler: run.builder.compiler(run.builder.top_stage, run.host), + compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), target: run.target, }); } @@ -638,7 +634,6 @@ pub struct Analysis { impl Step for Analysis { type Output = PathBuf; const DEFAULT: bool = true; - const ONLY_BUILD_TARGETS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { let builder = run.builder; @@ -647,7 +642,7 @@ impl Step for Analysis { fn make_run(run: RunConfig) { run.builder.ensure(Analysis { - compiler: run.builder.compiler(run.builder.top_stage, run.host), + compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build), target: run.target, }); } @@ -755,8 +750,6 @@ impl Step for Src { type Output = PathBuf; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - const ONLY_BUILD_TARGETS: bool = true; - const ONLY_BUILD: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.path("src") @@ -851,8 +844,6 @@ impl Step for PlainSourceTarball { type Output = PathBuf; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - const ONLY_BUILD_TARGETS: bool = true; - const ONLY_BUILD: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { let builder = run.builder; @@ -1007,7 +998,6 @@ pub struct Cargo { impl Step for Cargo { type Output = PathBuf; - const ONLY_BUILD_TARGETS: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { @@ -1095,7 +1085,6 @@ pub struct Rls { impl Step for Rls { type Output = Option; - const ONLY_BUILD_TARGETS: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { @@ -1177,7 +1166,6 @@ pub struct Rustfmt { impl Step for Rustfmt { type Output = Option; - const ONLY_BUILD_TARGETS: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { @@ -1263,7 +1251,6 @@ pub struct Extended { impl Step for Extended { type Output = (); const DEFAULT: bool = true; - const ONLY_BUILD_TARGETS: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { @@ -1274,7 +1261,7 @@ impl Step for Extended { fn make_run(run: RunConfig) { run.builder.ensure(Extended { stage: run.builder.top_stage, - host: run.host, + host: run.builder.build.build, target: run.target, }); } @@ -1692,9 +1679,7 @@ pub struct HashSign; impl Step for HashSign { type Output = (); - const ONLY_BUILD_TARGETS: bool = true; const ONLY_HOSTS: bool = true; - const ONLY_BUILD: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.path("hash-and-sign") diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 20f7d379a6967..fa48902d55893 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -161,7 +161,6 @@ macro_rules! install { impl Step for $name { type Output = (); const DEFAULT: bool = true; - const ONLY_BUILD_TARGETS: bool = true; const ONLY_HOSTS: bool = $only_hosts; $(const $c: bool = true;)* @@ -174,7 +173,7 @@ macro_rules! install { run.builder.ensure($name { stage: run.builder.top_stage, target: run.target, - host: run.host, + host: run.builder.build.build, }); } From 1c8f3b011cacdc2e5c614f9b05c509db4a4217db Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Sun, 11 Feb 2018 15:41:06 -0700 Subject: [PATCH 07/14] Remove ONLY_BUILD. All uses are replaced with not accessing run.target/run.host, and instead directly using run.builder.build.build. --- src/bootstrap/builder.rs | 13 +------------ src/bootstrap/install.rs | 33 +++++++++++++++++++++++++++++---- src/bootstrap/test.rs | 16 ++++------------ 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 1e15d5393829f..7da88bffa4b4a 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -60,9 +60,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { /// Run this rule for all hosts without cross compiling. const ONLY_HOSTS: bool = false; - /// Only run this step with the build triple as host and target. - const ONLY_BUILD: bool = false; - /// Primary function to execute this rule. Can call `builder.ensure(...)` /// with other steps to run those. fn run(self, builder: &Builder) -> Self::Output; @@ -98,7 +95,6 @@ pub struct RunConfig<'a> { struct StepDescription { default: bool, only_hosts: bool, - only_build: bool, should_run: fn(ShouldRun) -> ShouldRun, make_run: fn(RunConfig), name: &'static str, @@ -134,7 +130,6 @@ impl StepDescription { StepDescription { default: S::DEFAULT, only_hosts: S::ONLY_HOSTS, - only_build: S::ONLY_BUILD, should_run: S::should_run, make_run: S::make_run, name: unsafe { ::std::intrinsics::type_name::() }, @@ -150,18 +145,12 @@ impl StepDescription { self.name, builder.config.exclude); } let build = builder.build; - let hosts = if self.only_build { - build.build_triple() - } else { - &build.hosts - }; + let hosts = &build.hosts; // Determine the targets participating in this rule. let targets = if self.only_hosts { if build.config.run_host_only { &[] - } else if self.only_build { - build.build_triple() } else { &build.hosts } diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index fa48902d55893..17900fc35e095 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -225,10 +225,6 @@ install!((self, builder, _config), }); install_analysis(builder, self.stage, self.target); }; - Src, "src", Self::should_build(_config) , only_hosts: true, { - builder.ensure(dist::Src); - install_src(builder, self.stage); - }, ONLY_BUILD; Rustc, "src/librustc", true, only_hosts: true, { builder.ensure(dist::Rustc { compiler: builder.compiler(self.stage, self.target), @@ -236,3 +232,32 @@ install!((self, builder, _config), install_rustc(builder, self.stage, self.target); }; ); + +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct Src { + pub stage: u32, +} + +impl Step for Src { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + let config = &run.builder.config; + let cond = config.extended && + config.tools.as_ref().map_or(true, |t| t.contains("src")); + run.path("src").default_condition(cond) + } + + fn make_run(run: RunConfig) { + run.builder.ensure(Src { + stage: run.builder.top_stage, + }); + } + + fn run(self, builder: &Builder) { + builder.ensure(dist::Src); + install_src(builder, self.stage); + } +} diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 48490493525f9..7054c8005060c 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -505,27 +505,23 @@ impl Step for RustdocJS { } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct Tidy { - host: Interned, -} +pub struct Tidy; impl Step for Tidy { type Output = (); const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - const ONLY_BUILD: bool = true; - /// Runs the `tidy` tool as compiled in `stage` by the `host` compiler. + /// Runs the `tidy` tool. /// /// This tool in `src/tools` checks up on various bits and pieces of style and /// otherwise just implements a few lint-like checks that are specific to the /// compiler itself. fn run(self, builder: &Builder) { let build = builder.build; - let host = self.host; let _folder = build.fold_output(|| "tidy"); - println!("tidy check ({})", host); + println!("tidy check"); let mut cmd = builder.tool_cmd(Tool::Tidy); cmd.arg(build.src.join("src")); cmd.arg(&build.initial_cargo); @@ -543,9 +539,7 @@ impl Step for Tidy { } fn make_run(run: RunConfig) { - run.builder.ensure(Tidy { - host: run.builder.build.build, - }); + run.builder.ensure(Tidy); } } @@ -1607,7 +1601,6 @@ pub struct Distcheck; impl Step for Distcheck { type Output = (); - const ONLY_BUILD: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { run.path("distcheck") @@ -1673,7 +1666,6 @@ impl Step for Bootstrap { type Output = (); const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - const ONLY_BUILD: bool = true; /// Test the build system itself fn run(self, builder: &Builder) { From c8edb3652096bc3d294593375a5333503e6e86b1 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Wed, 14 Feb 2018 18:50:11 -0700 Subject: [PATCH 08/14] Print out the sysroot and libdir on verbose builds. --- src/bootstrap/bin/rustc.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 6c3c48aba72f1..40e2ef41144f3 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -95,7 +95,7 @@ fn main() { let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc)); let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir)); let mut dylib_path = bootstrap::util::dylib_path(); - dylib_path.insert(0, PathBuf::from(libdir)); + dylib_path.insert(0, PathBuf::from(&libdir)); let mut cmd = Command::new(rustc); cmd.args(&args) @@ -107,7 +107,7 @@ fn main() { if let Some(target) = target { // The stage0 compiler has a special sysroot distinct from what we // actually downloaded, so we just always pass the `--sysroot` option. - cmd.arg("--sysroot").arg(sysroot); + cmd.arg("--sysroot").arg(&sysroot); // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of @@ -280,6 +280,8 @@ fn main() { if verbose > 1 { eprintln!("rustc command: {:?}", cmd); + eprintln!("sysroot: {:?}", sysroot); + eprintln!("libdir: {:?}", libdir); } // Actually run the compiler! From 9cfc73cd3ff9aa845b699eb6d66e76cd4e0cdef0 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Thu, 15 Feb 2018 18:31:17 -0700 Subject: [PATCH 09/14] Deny warnings --- src/bootstrap/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index f3d9246c6fc6c..5cba65f7f0ad2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -113,7 +113,7 @@ //! More documentation can be found in each respective module below, and you can //! also check out the `src/bootstrap/README.md` file for more information. -//#![deny(warnings)] +#![deny(warnings)] #![feature(core_intrinsics)] #[macro_use] From 29a852970bf6ac9abee1a637727ed03d1888d582 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Sun, 11 Feb 2018 15:42:05 -0700 Subject: [PATCH 10/14] Refactor run_host_only to have the proper effect. Previously it was set to true when we didn't run HOSTS steps. --- src/bootstrap/builder.rs | 4 ++-- src/bootstrap/config.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7da88bffa4b4a..74b9978a8373c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -149,8 +149,8 @@ impl StepDescription { // Determine the targets participating in this rule. let targets = if self.only_hosts { - if build.config.run_host_only { - &[] + if !build.config.run_host_only { + return; // don't run anything } else { &build.hosts } diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index f15d4d3585839..eeafa6891cc87 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -347,7 +347,7 @@ impl Config { config.keep_stage = flags.keep_stage; // If --target was specified but --host wasn't specified, don't run any host-only tests. - config.run_host_only = flags.host.is_empty() && !flags.target.is_empty(); + config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty()); let toml = file.map(|file| { let mut f = t!(File::open(&file)); From a63bf3bb10117af94cc8189e9f228a81da5b432d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 9 Mar 2018 14:08:59 +0100 Subject: [PATCH 11/14] Add missing urls --- src/liballoc/vec.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 2f57c53a6d834..1bb2bed463b09 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1212,8 +1212,9 @@ impl Vec { /// difference, with each additional slot filled with `value`. /// If `new_len` is less than `len`, the `Vec` is simply truncated. /// - /// This method requires `Clone` to clone the passed value. If you'd - /// rather create a value with `Default` instead, see [`resize_default`]. + /// This method requires [`Clone`] to be able clone the passed value. If + /// you'd rather create a value with [`Default`] instead, see + /// [`resize_default`]. /// /// # Examples /// @@ -1227,6 +1228,8 @@ impl Vec { /// assert_eq!(vec, [1, 2]); /// ``` /// + /// [`Clone`]: ../../std/clone/trait.Clone.html + /// [`Default`]: ../../std/default/trait.Default.html /// [`resize_default`]: #method.resize_default #[stable(feature = "vec_resize", since = "1.5.0")] pub fn resize(&mut self, new_len: usize, value: T) { @@ -1244,7 +1247,7 @@ impl Vec { /// Iterates over the slice `other`, clones each element, and then appends /// it to this `Vec`. The `other` vector is traversed in-order. /// - /// Note that this function is same as `extend` except that it is + /// Note that this function is same as [`extend`] except that it is /// specialized to work with slices instead. If and when Rust gets /// specialization this function will likely be deprecated (but still /// available). @@ -1256,6 +1259,8 @@ impl Vec { /// vec.extend_from_slice(&[2, 3, 4]); /// assert_eq!(vec, [1, 2, 3, 4]); /// ``` + /// + /// [`extend`]: #method.extend #[stable(feature = "vec_extend_from_slice", since = "1.6.0")] pub fn extend_from_slice(&mut self, other: &[T]) { self.spec_extend(other.iter()) @@ -1266,12 +1271,11 @@ impl Vec { /// Resizes the `Vec` in-place so that `len` is equal to `new_len`. /// /// If `new_len` is greater than `len`, the `Vec` is extended by the - /// difference, with each additional slot filled with `Default::default()`. + /// difference, with each additional slot filled with [`Default::default()`]. /// If `new_len` is less than `len`, the `Vec` is simply truncated. /// - /// This method uses `Default` to create new values on every push. If - /// you'd rather `Clone` a given value, use [`resize`]. - /// + /// This method uses [`Default`] to create new values on every push. If + /// you'd rather [`Clone`] a given value, use [`resize`]. /// /// # Examples /// @@ -1288,6 +1292,9 @@ impl Vec { /// ``` /// /// [`resize`]: #method.resize + /// [`Default::default()`]: ../../std/default/trait.Default.html#tymethod.default + /// [`Default`]: ../../std/default/trait.Default.html + /// [`Clone`]: ../../std/clone/trait.Clone.html #[unstable(feature = "vec_resize_default", issue = "41758")] pub fn resize_default(&mut self, new_len: usize) { let len = self.len(); From c1a73d2f4a8ef0003b93c4307930438be4aae9a5 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 9 Mar 2018 17:11:06 +0300 Subject: [PATCH 12/14] tidy: Add a check for stray `.stderr` and `.stdout` files in UI test directories --- .../ex3-both-anon-regions-4.stderr | 19 ------ .../propagate-approximated-to-empty.stderr | 45 -------------- src/test/ui/resolve-error.stderr | 62 ------------------- src/test/ui/span/loan-extend.stderr | 14 ----- src/tools/tidy/src/lib.rs | 1 + src/tools/tidy/src/main.rs | 1 + src/tools/tidy/src/ui_tests.rs | 26 ++++++++ 7 files changed, 28 insertions(+), 140 deletions(-) delete mode 100644 src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr delete mode 100644 src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr delete mode 100644 src/test/ui/resolve-error.stderr delete mode 100644 src/test/ui/span/loan-extend.stderr create mode 100644 src/tools/tidy/src/ui_tests.rs diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr deleted file mode 100644 index 19339800a7a98..0000000000000 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-4.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-4.rs:12:13 - | -11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these references are declared with different lifetimes... -12 | z.push((x,y)); - | ^ ...but data flows into `z` here - -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-4.rs:12:15 - | -11 | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these references are declared with different lifetimes... -12 | z.push((x,y)); - | ^ ...but data flows into `z` here - -error: aborting due to 2 previous errors - -If you want more information on this error, try using "rustc --explain E0623" diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr deleted file mode 100644 index 502b344c89e44..0000000000000 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-to-empty.stderr +++ /dev/null @@ -1,45 +0,0 @@ -warning: not reporting region error due to -Znll - --> $DIR/propagate-approximated-to-empty.rs:41:9 - | -41 | demand_y(x, y, x.get()) - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: free region `'_#6r` does not outlive free region `'_#4r` - --> $DIR/propagate-approximated-to-empty.rs:41:18 - | -41 | demand_y(x, y, x.get()) - | ^ - -note: No external requirements - --> $DIR/propagate-approximated-to-empty.rs:39:47 - | -39 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { - | _______________________________________________^ -40 | | // Only works if 'x: 'y: -41 | | demand_y(x, y, x.get()) -42 | | //~^ WARN not reporting region error due to -Znll -43 | | //~| ERROR free region `'_#6r` does not outlive free region `'_#4r` -44 | | }); - | |_____^ - | - = note: defining type: DefId(0/1:18 ~ propagate_approximated_to_empty[317d]::supply[0]::{{closure}}[0]) with closure substs [ - i16, - for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) u32>)) - ] - -note: No external requirements - --> $DIR/propagate-approximated-to-empty.rs:38:1 - | -38 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -39 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -40 | | // Only works if 'x: 'y: -41 | | demand_y(x, y, x.get()) -... | -44 | | }); -45 | | } - | |_^ - | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_to_empty[317d]::supply[0]) with substs [] - -error: aborting due to previous error - diff --git a/src/test/ui/resolve-error.stderr b/src/test/ui/resolve-error.stderr deleted file mode 100644 index 27f93939246c0..0000000000000 --- a/src/test/ui/resolve-error.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error: cannot find derive macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:37:10 - | -37 | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` - -error: cannot find attribute macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:40:3 - | -40 | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro` - -error: cannot find attribute macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:43:3 - | -43 | #[FooWithLongNan] - | ^^^^^^^^^^^^^^ - -error: cannot find derive macro `Dlone` in this scope - --> $DIR/resolve-error.rs:46:10 - | -46 | #[derive(Dlone)] - | ^^^^^ help: try: `Clone` - -error: cannot find derive macro `Dlona` in this scope - --> $DIR/resolve-error.rs:49:10 - | -49 | #[derive(Dlona)] - | ^^^^^ help: try: `Clona` - -error: cannot find derive macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:52:10 - | -52 | #[derive(attr_proc_macra)] - | ^^^^^^^^^^^^^^^ - -error: cannot find macro `FooWithLongNama!` in this scope - --> $DIR/resolve-error.rs:56:5 - | -56 | FooWithLongNama!(); - | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!` - -error: cannot find macro `attr_proc_macra!` in this scope - --> $DIR/resolve-error.rs:58:5 - | -58 | attr_proc_macra!(); - | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!` - -error: cannot find macro `Dlona!` in this scope - --> $DIR/resolve-error.rs:60:5 - | -60 | Dlona!(); - | ^^^^^ - -error: cannot find macro `bang_proc_macrp!` in this scope - --> $DIR/resolve-error.rs:62:5 - | -62 | bang_proc_macrp!(); - | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!` - -error: aborting due to previous error(s) - diff --git a/src/test/ui/span/loan-extend.stderr b/src/test/ui/span/loan-extend.stderr deleted file mode 100644 index af498129fc440..0000000000000 --- a/src/test/ui/span/loan-extend.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `short` does not live long enough - --> $DIR/loan-extend.rs:21:1 - | -19 | long = borrow(&mut short); - | ----- borrow occurs here -20 | -21 | } - | ^ `short` dropped here while still borrowed - | - = note: values in a scope are dropped in the opposite order they are created - -error: aborting due to previous error - -If you want more information on this error, try using "rustc --explain E0597" diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index c927ff19b279b..06eb055f68e06 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -51,6 +51,7 @@ pub mod features; pub mod cargo; pub mod pal; pub mod deps; +pub mod ui_tests; pub mod unstable_book; fn filter_dirs(path: &Path) -> bool { diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index afa3ebd198319..2497419279560 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -45,6 +45,7 @@ fn main() { deps::check(&path, &mut bad); } deps::check_whitelist(&path, &cargo, &mut bad); + ui_tests::check(&path, &mut bad); if bad { eprintln!("some tidy checks failed"); diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs new file mode 100644 index 0000000000000..f7fec2e667ab9 --- /dev/null +++ b/src/tools/tidy/src/ui_tests.rs @@ -0,0 +1,26 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Tidy check to ensure that there are no stray `.stderr` files in UI test directories. + +use std::path::Path; + +pub fn check(path: &Path, bad: &mut bool) { + super::walk_many(&[&path.join("test/ui"), &path.join("test/ui-fulldeps")], + &mut |_| false, + &mut |file_path| { + if let Some(ext) = file_path.extension() { + if (ext == "stderr" || ext == "stdout") && !file_path.with_extension("rs").exists() { + println!("Stray file with UI testing output: {:?}", file_path); + *bad = true; + } + } + }); +} From b8cd6e5d7b885d3af2832cbe4a684ce6e6cf3614 Mon Sep 17 00:00:00 2001 From: kennytm Date: Sat, 10 Mar 2018 18:38:27 +0800 Subject: [PATCH 13/14] Prevents the crash log printer on macOS from crashing the entire job. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4eff6337ad8c9..8315cc9f90f1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -275,11 +275,12 @@ after_failure: - ls -lat $HOME/Library/Logs/DiagnosticReports/ - find $HOME/Library/Logs/DiagnosticReports -type f + -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; - -exec echo travis_fold":"end:crashlog \; + -exec echo travis_fold":"end:crashlog \; || true # attempt to debug anything killed by the oom killer on linux, just to see if # it happened From c67e55338442071666da7fb310b064b8e31fbacb Mon Sep 17 00:00:00 2001 From: kennytm Date: Sat, 10 Mar 2018 19:55:04 +0800 Subject: [PATCH 14/14] Print /proc/cpuinfo and /proc/meminfo before starting to build. --- src/ci/run.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ci/run.sh b/src/ci/run.sh index 79300e08a7d36..7ce50d5c2000b 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -91,11 +91,19 @@ make check-bootstrap travis_fold end check-bootstrap travis_time_finish +# Display the CPU and memory information. This helps us know why the CI timing +# is fluctuating. +travis_fold start log-system-info if [ "$TRAVIS_OS_NAME" = "osx" ]; then + system_profiler SPHardwareDataType || true + sysctl hw || true ncpus=$(sysctl -n hw.ncpu) else + cat /proc/cpuinfo || true + cat /proc/meminfo || true ncpus=$(grep processor /proc/cpuinfo | wc -l) fi +travis_fold end log-system-info if [ ! -z "$SCRIPT" ]; then sh -x -c "$SCRIPT"