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 7 pull requests #63644

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f0e3258
rustc: implement argsfiles for command line
jsgf Jul 30, 2019
a0dbeea
Use named arguments for formatting usage message.
jsgf Aug 1, 2019
4fc66a7
Use BufReader::lines() to parse out the lines
jsgf Aug 8, 2019
892ae41
Require -Zunstable-options to use @path
jsgf Aug 10, 2019
b5404f0
Simplify by removing FileArgs
jsgf Aug 13, 2019
1ab9e52
Update rustc-demangle to 0.1.16.
eddyb Aug 14, 2019
55caf1d
Remap paths for proc-macro crates.
jgalenson Aug 14, 2019
9e2d02a
Remap debuginfo for all crates.
jgalenson Aug 14, 2019
6589dce
Normalize test results for different test environments
jsgf Aug 15, 2019
178abd7
add git keyword to submodule option
DieracDelta Aug 16, 2019
0f1da63
Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.
eddyb Aug 16, 2019
892ef6f
rustbuild: work around the stdarch cfg(bootstrap) bug.
eddyb Aug 16, 2019
4087fc5
Feature gate 'yield ?' pre-expansion.
Centril Aug 14, 2019
20661f1
Simplify pre-expansion gating in general.
Centril Aug 14, 2019
ea81d8c
resolve: Populate external modules in more automatic and lazy way
petrochenkov Jul 29, 2019
fe2524c
resolve: Populate external traits lazily as well
petrochenkov Aug 15, 2019
ab4cc2d
resolve: Move some code around
petrochenkov Aug 15, 2019
5e47cd4
Fix rebase
petrochenkov Aug 16, 2019
804d973
Rollup merge of #63149 - petrochenkov:lazypop2, r=eddyb
Centril Aug 16, 2019
85ba0ff
Rollup merge of #63175 - jsgf:argsfile, r=alexcrichton
Centril Aug 16, 2019
1ac66dd
Rollup merge of #63545 - Centril:gate-yield-preexp, r=oli-obk
Centril Aug 16, 2019
28d4d9a
Rollup merge of #63548 - eddyb:unicode-demangling, r=alexcrichton
Centril Aug 16, 2019
833447d
Rollup merge of #63558 - jgalenson:move-remap, r=alexcrichton
Centril Aug 16, 2019
4151153
Rollup merge of #63641 - DieracDelta:master, r=eddyb
Centril Aug 16, 2019
e2f410f
Rollup merge of #63642 - eddyb:wrap-it-up, r=rkruppe,Mark-Simulacrum
Centril Aug 16, 2019
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
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ dependencies = [
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0",
]

Expand Down Expand Up @@ -2729,7 +2729,7 @@ dependencies = [

[[package]]
name = "rustc-demangle"
version = "0.1.15"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2887,7 +2887,7 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"punycode 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0",
"rustc_metadata 0.0.0",
"rustc_target 0.0.0",
Expand Down Expand Up @@ -4592,7 +4592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61673783f2089e01033ffa82d1988f55175402071b31253a358292e1624d4602"
"checksum rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28f3dd1346d5b0269c07a4a78855e309a298ab569c9c1302d4d4f57f8eee4e84"
"checksum rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45e67b526dbda3a0c7dab91c8947d43685e7697f52686a4949da3c179cd7c979"
"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af"
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
"checksum rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2e07e19601f21c59aad953c2632172ba70cb27e685771514ea66e4062b3363"
"checksum rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79d38ca7cbc22fa59f09d8534ea4b27f67b0facf0cbe274433aceea227a02543"
Expand Down
4 changes: 2 additions & 2 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@
# library and facade crates.
#compiler-docs = false

# Indicate whether submodules are managed and updated automatically.
# Indicate whether git submodules are managed and updated automatically.
#submodules = true

# Update submodules only when the checked out commit in the submodules differs
# Update git submodules only when the checked out commit in the submodules differs
# from what is committed in the main rustc repo.
#fast-submodules = true

Expand Down
17 changes: 11 additions & 6 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ fn main() {
// FIXME: the fact that core here is excluded is due to core_arch from our stdarch submodule
// being broken on the beta compiler with bootstrap passed, so this is a temporary workaround
// (we've just snapped, so there are no cfg(bootstrap) related annotations in core).
if stage == "0" && crate_name != Some("core") {
cmd.arg("--cfg").arg("bootstrap");
if stage == "0" {
if crate_name != Some("core") {
cmd.arg("--cfg").arg("bootstrap");
} else {
// NOTE(eddyb) see FIXME above, except now we need annotations again in core.
cmd.arg("--cfg").arg("boostrap_stdarch_ignore_this");
}
}

// Print backtrace in case of ICE
Expand Down Expand Up @@ -276,10 +281,6 @@ fn main() {
cmd.arg("-C").arg("target-feature=-crt-static");
}
}

if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
cmd.arg("--remap-path-prefix").arg(&map);
}
} else {
// Override linker if necessary.
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
Expand All @@ -296,6 +297,10 @@ fn main() {
}
}

if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
cmd.arg("--remap-path-prefix").arg(&map);
}

// Force all crates compiled by this compiler to (a) be unstable and (b)
// allow the `rustc_private` feature to link to other unstable crates
// also in the sysroot. We also do this for host crates, since those
Expand Down
7 changes: 7 additions & 0 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,10 @@ to customize the output:

Note that it is invalid to combine the `--json` argument with the `--color`
argument, and it is required to combine `--json` with `--error-format=json`.

## `@path`: load command-line flags from a path

If you specify `@path` on the command-line, then it will open `path` and read
command line options from it. These options are one per line; a blank line indicates
an empty option. The file can use Unix or Windows style line endings, and must be
encoded as UTF-8.
22 changes: 22 additions & 0 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,18 +1293,40 @@ extern "rust-intrinsic" {
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_add` method. For example,
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
#[cfg(boostrap_stdarch_ignore_this)]
pub fn overflowing_add<T>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_sub` method. For example,
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
#[cfg(boostrap_stdarch_ignore_this)]
pub fn overflowing_sub<T>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_mul` method. For example,
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
#[cfg(boostrap_stdarch_ignore_this)]
pub fn overflowing_mul<T>(a: T, b: T) -> T;

/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_add` method. For example,
/// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
#[cfg(not(boostrap_stdarch_ignore_this))]
pub fn wrapping_add<T>(a: T, b: T) -> T;
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_sub` method. For example,
/// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
#[cfg(not(boostrap_stdarch_ignore_this))]
pub fn wrapping_sub<T>(a: T, b: T) -> T;
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `wrapping_mul` method. For example,
/// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
#[cfg(not(boostrap_stdarch_ignore_this))]
pub fn wrapping_mul<T>(a: T, b: T) -> T;

/// Computes `a + b`, while saturating at numeric bounds.
/// The stabilized versions of this intrinsic are available on the integer
/// primitives via the `saturating_add` method. For example,
Expand Down
48 changes: 42 additions & 6 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,13 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
intrinsics::overflowing_add(self, rhs)
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_add(self, rhs)
}

#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_add(self, rhs)
}
}
}

Expand All @@ -1135,7 +1141,13 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
intrinsics::overflowing_sub(self, rhs)
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_sub(self, rhs)
}

#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_sub(self, rhs)
}
}
}

Expand All @@ -1157,7 +1169,13 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
intrinsics::overflowing_mul(self, rhs)
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_mul(self, rhs)
}

#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_mul(self, rhs)
}
}
}

Expand Down Expand Up @@ -3031,7 +3049,13 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_add(self, rhs: Self) -> Self {
intrinsics::overflowing_add(self, rhs)
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_add(self, rhs)
}

#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_add(self, rhs)
}
}
}

Expand All @@ -3053,7 +3077,13 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_sub(self, rhs: Self) -> Self {
intrinsics::overflowing_sub(self, rhs)
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_sub(self, rhs)
}

#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_sub(self, rhs)
}
}
}

Expand All @@ -3076,7 +3106,13 @@ $EndFeature, "
without modifying the original"]
#[inline]
pub const fn wrapping_mul(self, rhs: Self) -> Self {
intrinsics::overflowing_mul(self, rhs)
#[cfg(boostrap_stdarch_ignore_this)] {
intrinsics::overflowing_mul(self, rhs)
}

#[cfg(not(boostrap_stdarch_ignore_this))] {
intrinsics::wrapping_mul(self, rhs)
}
}

doc_comment! {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_llvm/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
},
"ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" | "ctpop" | "bswap" |
"bitreverse" | "add_with_overflow" | "sub_with_overflow" |
"mul_with_overflow" | "overflowing_add" | "overflowing_sub" | "overflowing_mul" |
"mul_with_overflow" | "wrapping_add" | "wrapping_sub" | "wrapping_mul" |
"unchecked_div" | "unchecked_rem" | "unchecked_shl" | "unchecked_shr" |
"unchecked_add" | "unchecked_sub" | "unchecked_mul" | "exact_div" |
"rotate_left" | "rotate_right" | "saturating_add" | "saturating_sub" => {
Expand Down Expand Up @@ -398,9 +398,9 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {

return;
},
"overflowing_add" => self.add(args[0].immediate(), args[1].immediate()),
"overflowing_sub" => self.sub(args[0].immediate(), args[1].immediate()),
"overflowing_mul" => self.mul(args[0].immediate(), args[1].immediate()),
"wrapping_add" => self.add(args[0].immediate(), args[1].immediate()),
"wrapping_sub" => self.sub(args[0].immediate(), args[1].immediate()),
"wrapping_mul" => self.mul(args[0].immediate(), args[1].immediate()),
"exact_div" =>
if signed {
self.exactsdiv(args[0].immediate(), args[1].immediate())
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test = false
flate2 = "1.0"
log = "0.4"
punycode = "0.4.0"
rustc-demangle = "0.1.15"
rustc-demangle = "0.1.16"

syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
Expand Down
84 changes: 84 additions & 0 deletions src/librustc_driver/args/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
use std::env;
use std::error;
use std::fmt;
use std::fs;
use std::io;
use std::str;
use std::sync::atomic::{AtomicBool, Ordering};

#[cfg(test)]
mod tests;

static USED_ARGSFILE_FEATURE: AtomicBool = AtomicBool::new(false);

pub fn used_unstable_argsfile() -> bool {
USED_ARGSFILE_FEATURE.load(Ordering::Relaxed)
}

pub struct ArgsIter {
base: env::ArgsOs,
file: std::vec::IntoIter<String>,
}

impl ArgsIter {
pub fn new() -> Self {
ArgsIter { base: env::args_os(), file: vec![].into_iter() }
}
}

impl Iterator for ArgsIter {
type Item = Result<String, Error>;

fn next(&mut self) -> Option<Self::Item> {
loop {
if let Some(line) = self.file.next() {
return Some(Ok(line));
}

let arg =
self.base.next().map(|arg| arg.into_string().map_err(|_| Error::Utf8Error(None)));
match arg {
Some(Err(err)) => return Some(Err(err)),
Some(Ok(ref arg)) if arg.starts_with("@") => {
let path = &arg[1..];
let file = match fs::read_to_string(path) {
Ok(file) => {
USED_ARGSFILE_FEATURE.store(true, Ordering::Relaxed);
file
}
Err(ref err) if err.kind() == io::ErrorKind::InvalidData => {
return Some(Err(Error::Utf8Error(Some(path.to_string()))));
}
Err(err) => return Some(Err(Error::IOError(path.to_string(), err))),
};
self.file =
file.lines().map(ToString::to_string).collect::<Vec<_>>().into_iter();
}
Some(Ok(arg)) => return Some(Ok(arg)),
None => return None,
}
}
}
}

#[derive(Debug)]
pub enum Error {
Utf8Error(Option<String>),
IOError(String, io::Error),
}

impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Utf8Error(None) => write!(fmt, "Utf8 error"),
Error::Utf8Error(Some(path)) => write!(fmt, "Utf8 error in {}", path),
Error::IOError(path, err) => write!(fmt, "IO Error: {}: {}", path, err),
}
}
}

impl error::Error for Error {
fn description(&self) -> &'static str {
"argument error"
}
}
Loading