Commit Graph

105329 Commits

Author SHA1 Message Date
Lzu Tao
a5f42397be Rename Result::as_deref_ok to as_deref 2020-01-11 03:08:40 +00:00
Lzu Tao
7ba25acd7a Revert "Rollup merge of #67727 - Dylan-DPC:stabilise/remove_item, r=alexcrichton"
This reverts commit 4ed415b547, reversing
changes made to 3cce950743.
2020-01-11 03:04:39 +00:00
bors
88d1109600 Auto merge of #68115 - Centril:rollup-e2fszdv, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #67666 (make use of pointer::is_null)
 - #67806 (Extract `rustc_ast_passes`, move gating, & refactor linting)
 - #68043 (Add some missing timers)
 - #68074 (Add `llvm-skip-rebuild` flag to `x.py`)
 - #68079 (Clarify suggestion for E0013)
 - #68084 (Do not ICE on unicode next point)
 - #68102 (Inline some conversion methods around OsStr)
 - #68106 (Fix issue with using `self` module via indirection)

Failed merges:

r? @ghost
2020-01-11 03:03:42 +00:00
Mazdak Farrokhzad
04a340f61f
Rollup merge of #68106 - varkor:self_self_use, r=estebank
Fix issue with using `self` module via indirection

Fixes https://github.com/rust-lang/rust/issues/68103.
2020-01-11 04:02:31 +01:00
Mazdak Farrokhzad
c960c3e057
Rollup merge of #68102 - lzutao:inline, r=alexcrichton
Inline some conversion methods around OsStr

Diff on the assembly of this snippet before and after this PR: https://www.diffchecker.com/NeGMjaJ2
```rust
use std::env;
use std::io;
use std::path::{Path, PathBuf};

pub fn cargo_home_with_cwd(cwd: &Path) -> io::Result<PathBuf> {
    match env::var_os("CARGO_HOME").filter(|h| !h.is_empty()) {
        Some(home) => {
            let home = PathBuf::from(home);
            if home.is_absolute() {
                Ok(home)
            } else {
                Ok(cwd.join(&home))
            }
        }
        _ => env::home_dir()
            .map(|p| p.join(".cargo"))
            .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "could not find cargo home dir")),
    }
}
```
2020-01-11 04:02:30 +01:00
Mazdak Farrokhzad
cacda2d7a0
Rollup merge of #68084 - estebank:ice-68000, r=varkor
Do not ICE on unicode next point

Use `shrink_to_hi` instead of `next_point` and fix `next_point`.

Fix #68000, fix #68091, fix #68092.
2020-01-11 04:02:28 +01:00
Mazdak Farrokhzad
ba14f9429a
Rollup merge of #68079 - varkor:E0013-clarify, r=Centril
Clarify suggestion for E0013

Fixes https://github.com/rust-lang/rust/issues/68038.
2020-01-11 04:02:27 +01:00
Mazdak Farrokhzad
ef3e360c4b
Rollup merge of #68074 - matthew-healy:skip-llvm-rebuild-option, r=Centril
Add `llvm-skip-rebuild` flag to `x.py`

This PR follows on from #67437 to complete the feature request from #65612.

Specifically it adds a new command-line flag, `--llvm-skip-rebuild`, which overrides both any value set in `config.toml` and the default value (`false`).

I'm not 100% confident that I've implemented the override in the "best" way, but I've checked it locally and it seems to work at least.

This option isn't currently mentioned in the Guide to Rustc Development. I'd be happy to write something on it if folk think that's worthwhile.
2020-01-11 04:02:25 +01:00
Mazdak Farrokhzad
8c0c5c7e65
Rollup merge of #68043 - Zoxc:missing-timers, r=wesleywiser
Add some missing timers

Based on https://github.com/rust-lang/rust/pull/67988

r? @wesleywiser
2020-01-11 04:02:24 +01:00
Mazdak Farrokhzad
9634e1f7d9
Rollup merge of #67806 - Centril:splitsynmore, r=petrochenkov
Extract `rustc_ast_passes`, move gating, & refactor linting

Based on https://github.com/rust-lang/rust/pull/67770.

This PR extracts a crate `rustc_ast_passes`:

- `ast_validation.rs`, which is contributed by `rustc_passes` (now only has HIR based passes) -- the goal here is to improve recompilation of the parser,
- `feature_gate.rs`, which is contributed by `syntax` and performs post-expansion-gating & final erroring for pre-expansion gating,
- `show_span`, which is contributed by `syntax`.

To facilitate this, we first have to also:

- Move `{leveled_}feature_err{_err}` from `syntax::feature_gate::check` into `rustc_session::parse`.
- Move `get_features` into `rustc_parse::config`, the only place it is used.
- Move some some lint datatypes and traits, e.g. `LintBuffer`, `BufferedEarlyLint`, `BuiltinLintDiagnostics`, `LintPass`, and `LintArray` into `rustc_session::lint`.
- Move all the hard-wired lint `static`s into `rustc_session::lint::builtin`.
2020-01-11 04:02:22 +01:00
Mazdak Farrokhzad
76edc5c4eb
Rollup merge of #67666 - lzutao:ptr-null-cmp, r=dtolnay
make use of pointer::is_null

r? @Mark-Simulacrum
2020-01-11 04:02:21 +01:00
Dylan MacKenzie
1d418a1191 Test that stable const fn requires allow_internal_unstable 2020-01-10 18:51:42 -08:00
Dylan MacKenzie
09b5c854de Remove unnecessary const_fn feature gates
This flag opts out of the min-const-fn checks entirely, which is usually
not what we want. The few cases where the flag is still necessary have
been annotated.
2020-01-10 18:51:12 -08:00
Mazdak Farrokhzad
682f500c8f fix fallout in ui-fulldeps 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad
d0d1c60f1e pacify tidy by nixing added docs :( 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad
b4809d0818 appease rustfmt 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad
7d6548a14a rustc_passes: remove unused rustc_parse dep 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad
ae213db0f5 {syntax -> rustc_ast_passes}::show_span 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad
6cbcb83022 {syntax -> rustc_ast_passes}::feature_gate 2020-01-11 03:30:20 +01:00
Mazdak Farrokhzad
ed69fbbc44 ast_validation -> new crate rustc_ast_passes 2020-01-11 03:27:39 +01:00
Mazdak Farrokhzad
f361b71a7d nix syntax::early_buffered_lints 2020-01-11 03:26:16 +01:00
Mazdak Farrokhzad
2b44a6c8f4 move {rustc -> rustc_session}::lint::builtin 2020-01-11 03:26:16 +01:00
Mazdak Farrokhzad
45f27643db prepare moving HardwiredLints to rustc_session 2020-01-11 03:26:16 +01:00
Mazdak Farrokhzad
7dbccf5b55 buffered lint infra -> rustc_session 2020-01-11 03:21:34 +01:00
Mazdak Farrokhzad
82eeb8573a prepare for moving BuiltinLintDiagnostics to rustc_session 2020-01-11 03:19:50 +01:00
Mazdak Farrokhzad
d247ac4c0d Remove unused derives 2020-01-11 03:19:50 +01:00
Mazdak Farrokhzad
fff5ef68b0 canonicalize rustc::session import 2020-01-11 03:19:50 +01:00
Mazdak Farrokhzad
1af8c10bd4 simplify feature_err imports 2020-01-11 03:19:50 +01:00
Mazdak Farrokhzad
7c78090690 get_features -> rustc_parse::config 2020-01-11 03:17:36 +01:00
Mazdak Farrokhzad
c944e6aac1 document feature_err et. al 2020-01-11 03:15:32 +01:00
Mazdak Farrokhzad
6007641d21 gating diagnostics -> rustc_session::parse 2020-01-11 03:15:32 +01:00
varkor
088a1808d2 Add suggestions when encountering chained comparisons 2020-01-11 01:56:25 +00:00
Dylan MacKenzie
8f1df30d06 Only require allow_internal_unstable for stable const fn 2020-01-10 17:18:25 -08:00
Yuki Okushi
48cad460bc Fix test not to depend on environment 2020-01-11 10:15:54 +09:00
John Kåre Alsaker
4a647167e6 Add a comment 2020-01-11 00:38:10 +01:00
John Kåre Alsaker
51a73eb4fb Avoid a duplicate hash map lookup 2020-01-11 00:33:27 +01:00
John Kåre Alsaker
4beeadda3c Fix a deadlock 2020-01-11 00:33:27 +01:00
John Kåre Alsaker
f3ce14479c Run codegen unit partitioning and assert_symbols_are_distinct in parallel 2020-01-11 00:33:27 +01:00
varkor
799efd3615 Fix issue with using self module via indirection 2020-01-10 23:30:13 +00:00
bors
e621797264 Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichton
build-std compatible sanitizer support

### Motivation

When using `-Z sanitizer=*` feature it is essential that both user code and
standard library is instrumented. Otherwise the utility of sanitizer will be
limited, or its use will be impractical like in the case of memory sanitizer.

The recently introduced cargo feature build-std makes it possible to rebuild
standard library with arbitrary rustc flags. Unfortunately, those changes alone
do not make it easy to rebuild standard library with sanitizers, since runtimes
are dependencies of std that have to be build in specific environment,
generally not available outside rustbuild process. Additionally rebuilding them
requires presence of llvm-config and compiler-rt sources.

The goal of changes proposed here is to make it possible to avoid rebuilding
sanitizer runtimes when rebuilding the std, thus making it possible to
instrument standard library for use with sanitizer with simple, although
verbose command:

```
env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu
```

### Implementation

* Sanitizer runtimes are no long packed into crates. Instead, libraries build
  from compiler-rt are used as is, after renaming them into `librusc_rt.*`.
* rustc obtains runtimes from target libdir for default sysroot, so that
  they are not required in custom build sysroots created with build-std.
* The runtimes are only linked-in into executables to address issue #64629.
  (in previous design it was hard to avoid linking runtimes into static
  libraries produced by rustc as demonstrated by sanitizer-staticlib-link
  test, which still passes despite changes made in #64780).

cc @kennytm, @japaric, @firstyear, @choller
2020-01-10 23:26:21 +00:00
bors
1756313117 Auto merge of #68101 - JohnTitor:rollup-mvmjukr, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #66045 (Add method Result::into_ok)
 - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns)
 - #68014 (Unify output of "variant not found" errors)
 - #68019 (Build compiletest with in-tree libtest)
 - #68039 (remove explicit strip-hidden pass from compiler doc generation)
 - #68050 (Canonicalize rustc_error imports)
 - #68059 (Allow specifying LLVM args in target specifications)
 - #68075 (rustbuild: Cleanup book generation)

Failed merges:

 - #68089 (Unstabilize `Vec::remove_item`)

r? @ghost
2020-01-10 20:08:58 +00:00
Yuki Okushi
bcfb380634
Rollup merge of #68075 - ollie27:rustbuild_books, r=Mark-Simulacrum
rustbuild: Cleanup book generation

The Cargo book can be generated the same way as the other books.
2020-01-11 04:50:56 +09:00
Yuki Okushi
1af7524d20
Rollup merge of #68059 - jethrogb:jb/target-llvm-args, r=alexcrichton
Allow specifying LLVM args in target specifications
2020-01-11 04:50:54 +09:00
Yuki Okushi
7ae0618e0a
Rollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum
Canonicalize rustc_error imports

r? @Mark-Simulacrum
2020-01-11 04:50:53 +09:00
Yuki Okushi
93f0ba970f
Rollup merge of #68039 - euclio:remove-strip-hidden, r=dtolnay
remove explicit strip-hidden pass from compiler doc generation

`strip-hidden` is now implied by `--document-private-items` with #67875, so there's no need to specify it anymore.
2020-01-11 04:50:51 +09:00
Yuki Okushi
a74c790758
Rollup merge of #68019 - cuviper:in-tree-compiletest, r=Mark-Simulacrum
Build compiletest with in-tree libtest

This updates compiletest to build in `Mode::ToolStd`, using the locally-built crates for `std` and especially `test`. This way we're immune to unstable differences in the bootstrap compiler crates, whether that's a prior-release stage0 or a current release local rebuild. Fixes #59264.

As a minor cleanup, this also removes the unused `llvm_tools` flag.
2020-01-11 04:50:49 +09:00
Yuki Okushi
a491100aa3
Rollup merge of #68014 - estebank:unify-e0599, r=cramertj
Unify output of "variant not found" errors

Fix #49566.
2020-01-11 04:50:48 +09:00
Yuki Okushi
793b1be6df
Rollup merge of #67258 - Centril:open-ended-ranges, r=oli-obk
Introduce `X..`, `..X`, and `..=X` range patterns

Tracking issue: https://github.com/rust-lang/rust/issues/67264
Feature gate: `#![feature(half_open_range_patterns)]`

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

In this PR, we introduce range-from (`X..`), range-to (`..X`), and range-to-inclusive (`..=X`) patterns.
These correspond to the `RangeFrom`, `RangeTo`, and `RangeToInclusive` expression forms introduced with the same syntaxes. The correspondence is both syntactic and semantic (in the sense that e.g. a `X..` pattern matching on a scrutinee `s` holds exactly when `(X..).contains(&s)` holds).

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

Noteworthy:

- The compiler complexity added with this PR is around 10 lines (discounting new tests, which account for the large PR size).

- `...X` is accepted syntactically with the same meaning as `..=X`. This is done primarily to simplify and unify the implementation & spec. If-and-when we decide to make `X...Y` a hard error on a new edition, we can do the same for `...X` patterns as well.

- `X...` and `X..=` is rejected syntactically just like it is for the expression equivalents. We should perhaps make these into semantic restrictions (cc @petrochenkov).

- In HAIR, these half-open ranges are represented by inserting the max/min values for the approprate types. That is, `X..` where `X: u8` would become `X..=u8::MAX` in HAIR (note the `..=` since `RangeFrom` includes the end).

- Exhaustive integer / char matching does not (yet) allow for e.g. exhaustive matching on `0usize..` or `..5usize | 5..` (same idea for `isize`). This would be a substantially more invasive change, and could be added in some other PR.

- The issues with slice pattern syntax has been resolved as we decided to use `..` to mean a "rest-pattern" and `[xs @ ..]` to bind the rest to a name in a slice pattern.

- Like with https://github.com/rust-lang/rust/pull/35712, which provided `X..Y` range patterns, this is not yet backed up by an RFC. I'm providing this experimental implementation now to have something concrete to discuss. I would be happy to provide an RFC for this PR as well as for #35712 to finalize and confirm the ideas with the larger community.

Closes https://github.com/rust-lang/rfcs/issues/947.

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

r? @varkor cc @matthewjasper @oli-obk

I would recommend reviewing this (in particular HAIR-lowering and pattern parsing changes) with whitespace changes ignored.
2020-01-11 04:50:46 +09:00
Yuki Okushi
2dbcf0841a
Rollup merge of #66045 - mzabaluev:unwrap-infallible, r=dtolnay
Add method Result::into_ok

Implementation of https://github.com/rust-lang/rfcs/pull/2799

Tracking issue #61695
2020-01-11 04:50:45 +09:00
Esteban Küber
38a3506c45 Ignore platforms that can't point to std 2020-01-10 11:40:30 -08:00