]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obk
bors [Sat, 11 Jan 2020 14:46:17 +0000 (14:46 +0000)]
Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obk

Promote references to constants instead of statics

r? @oli-obk

4 years agoMake codegen tests wordsize independent
Oliver Scherer [Sat, 11 Jan 2020 13:40:07 +0000 (14:40 +0100)]
Make codegen tests wordsize independent

4 years agoAuto merge of #68126 - Centril:rollup-cz5u7xx, r=Centril
bors [Sat, 11 Jan 2020 11:36:39 +0000 (11:36 +0000)]
Auto merge of #68126 - Centril:rollup-cz5u7xx, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #67756 (Collector tweaks)
 - #67889 (Compile some CGUs in parallel at the start of codegen)
 - #67930 (Rename Result::as_deref_ok to as_deref)
 - #68018 (feature_gate: Remove `GateStrength`)
 - #68070 (clean up E0185 explanation)
 - #68072 (Fix ICE #68058)
 - #68114 (Don't require `allow_internal_unstable` unless `staged_api` is enabled.)
 - #68120 (Ban `...X` pats, harden tests, and improve diagnostics)

Failed merges:

r? @ghost

4 years agoRollup merge of #68120 - Centril:ban-range-to-dotdotdot, r=oli-obk
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:15 +0000 (12:36 +0100)]
Rollup merge of #68120 - Centril:ban-range-to-dotdotdot, r=oli-obk

Ban `...X` pats, harden tests, and improve diagnostics

Follow up to https://github.com/rust-lang/rust/pull/67258#issuecomment-565656155 and https://github.com/rust-lang/rust/pull/67258#discussion_r357879932.

r? @cramertj @oli-obk

4 years agoRollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=Centril
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:14 +0000 (12:36 +0100)]
Rollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=Centril

Don't require `allow_internal_unstable` unless `staged_api` is enabled.

#63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely.

After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable.

r? @oli-obk (author of #63770)
cc @Centril

4 years agoRollup merge of #68072 - JohnTitor:fix-macro-ice, r=petrochenkov
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:12 +0000 (12:36 +0100)]
Rollup merge of #68072 - JohnTitor:fix-macro-ice, r=petrochenkov

Fix ICE #68058

Fixes #68058

r? @petrochenkov

4 years agoRollup merge of #68070 - GuillaumeGomez:clean-up-e0185, r=Dylan-DPC
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:10 +0000 (12:36 +0100)]
Rollup merge of #68070 - GuillaumeGomez:clean-up-e0185, r=Dylan-DPC

clean up E0185 explanation

r? @Dylan-DPC

4 years agoRollup merge of #68018 - petrochenkov:nosoft, r=Centril
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:09 +0000 (12:36 +0100)]
Rollup merge of #68018 - petrochenkov:nosoft, r=Centril

feature_gate: Remove `GateStrength`

The "soft feature gating" from `feature_gate/check.rs` is unused, and even if it were used, hardcoded warning is not a good solution and [deny-by-default lint](https://github.com/rust-lang/rust/issues/64266) would be a better way to do this.

cc https://github.com/rust-lang/rust/pull/67806#discussion_r363091701
r? @Centril

4 years agoRollup merge of #67930 - lzutao:result-as_deref, r=dtolnay
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:07 +0000 (12:36 +0100)]
Rollup merge of #67930 - lzutao:result-as_deref, r=dtolnay

Rename Result::as_deref_ok to as_deref

Addresses https://github.com/rust-lang/rust/issues/50264#issuecomment-533952247
r? @dtolnay

4 years agoRollup merge of #67889 - Zoxc:parallel-cgus, r=michaelwoerister
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:06 +0000 (12:36 +0100)]
Rollup merge of #67889 - Zoxc:parallel-cgus, r=michaelwoerister

Compile some CGUs in parallel at the start of codegen

This brings the compilation time for `syntex_syntax` from 11.542s to 10.453s with 6 threads in non-incremental debug mode. Just compiling `n` CGUs in parallel at the beginning of codegen seems sufficient to get rid of the staircase effect, at least for `syntex_syntax`.

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

r? @michaelwoerister
cc @alexcrichton @Mark-Simulacrum

4 years agoRollup merge of #67756 - Zoxc:collector-tweaks, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:36:04 +0000 (12:36 +0100)]
Rollup merge of #67756 - Zoxc:collector-tweaks, r=Mark-Simulacrum

Collector tweaks

r? @Mark-Simulacrum

4 years agofeature_gate: Remove `GateStrength`
Vadim Petrochenkov [Wed, 8 Jan 2020 17:27:06 +0000 (20:27 +0300)]
feature_gate: Remove `GateStrength`

4 years agoBan `...X` pats, harden tests, and improve diagnostics.
Mazdak Farrokhzad [Sat, 11 Jan 2020 05:49:43 +0000 (06:49 +0100)]
Ban `...X` pats, harden tests, and improve diagnostics.

Also fix a bug with the span passed in `mk_range`.

4 years agoAuto merge of #65912 - estebank:variants-orig, r=petrochenkov
bors [Sat, 11 Jan 2020 06:15:59 +0000 (06:15 +0000)]
Auto merge of #65912 - estebank:variants-orig, r=petrochenkov

Point at the span for the definition of crate foreign ADTs

Follow up to #65421. Partially addresses #65386. Blocked on #53081.

4 years agoExpand comment
ecstatic-morse [Sat, 11 Jan 2020 03:29:16 +0000 (19:29 -0800)]
Expand comment

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoUpdate test after renaming Result::as_deref
Lzu Tao [Tue, 7 Jan 2020 06:57:08 +0000 (06:57 +0000)]
Update test after renaming Result::as_deref

4 years agoRename Result::as_deref_ok to as_deref
Lzu Tao [Mon, 6 Jan 2020 12:59:46 +0000 (12:59 +0000)]
Rename Result::as_deref_ok to as_deref

4 years agoAuto merge of #68115 - Centril:rollup-e2fszdv, r=Centril
bors [Sat, 11 Jan 2020 03:03:42 +0000 (03:03 +0000)]
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

4 years agoRollup merge of #68106 - varkor:self_self_use, r=estebank
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:31 +0000 (04:02 +0100)]
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.

4 years agoRollup merge of #68102 - lzutao:inline, r=alexcrichton
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:30 +0000 (04:02 +0100)]
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")),
    }
}
```

4 years agoRollup merge of #68084 - estebank:ice-68000, r=varkor
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:28 +0000 (04:02 +0100)]
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.

4 years agoRollup merge of #68079 - varkor:E0013-clarify, r=Centril
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:27 +0000 (04:02 +0100)]
Rollup merge of #68079 - varkor:E0013-clarify, r=Centril

Clarify suggestion for E0013

Fixes https://github.com/rust-lang/rust/issues/68038.

4 years agoRollup merge of #68074 - matthew-healy:skip-llvm-rebuild-option, r=Centril
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:25 +0000 (04:02 +0100)]
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.

4 years agoRollup merge of #68043 - Zoxc:missing-timers, r=wesleywiser
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:24 +0000 (04:02 +0100)]
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

4 years agoRollup merge of #67806 - Centril:splitsynmore, r=petrochenkov
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:22 +0000 (04:02 +0100)]
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`.

4 years agoRollup merge of #67666 - lzutao:ptr-null-cmp, r=dtolnay
Mazdak Farrokhzad [Sat, 11 Jan 2020 03:02:21 +0000 (04:02 +0100)]
Rollup merge of #67666 - lzutao:ptr-null-cmp, r=dtolnay

make use of pointer::is_null

r? @Mark-Simulacrum

4 years agoTest that stable `const fn` requires `allow_internal_unstable`
Dylan MacKenzie [Sat, 11 Jan 2020 02:48:52 +0000 (18:48 -0800)]
Test that stable `const fn` requires `allow_internal_unstable`

4 years agoRemove unnecessary `const_fn` feature gates
Dylan MacKenzie [Sat, 11 Jan 2020 01:40:57 +0000 (17:40 -0800)]
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.

4 years agofix fallout in ui-fulldeps
Mazdak Farrokhzad [Wed, 8 Jan 2020 21:54:08 +0000 (22:54 +0100)]
fix fallout in ui-fulldeps

4 years agopacify tidy by nixing added docs :(
Mazdak Farrokhzad [Sun, 5 Jan 2020 12:30:12 +0000 (13:30 +0100)]
pacify tidy by nixing added docs :(

4 years agoappease rustfmt
Mazdak Farrokhzad [Sun, 5 Jan 2020 12:05:49 +0000 (13:05 +0100)]
appease rustfmt

4 years agorustc_passes: remove unused rustc_parse dep
Mazdak Farrokhzad [Sun, 5 Jan 2020 11:02:45 +0000 (12:02 +0100)]
rustc_passes: remove unused rustc_parse dep

4 years ago{syntax -> rustc_ast_passes}::show_span
Mazdak Farrokhzad [Sun, 5 Jan 2020 10:21:26 +0000 (11:21 +0100)]
{syntax -> rustc_ast_passes}::show_span

4 years ago{syntax -> rustc_ast_passes}::feature_gate
Mazdak Farrokhzad [Sun, 5 Jan 2020 10:11:39 +0000 (11:11 +0100)]
{syntax -> rustc_ast_passes}::feature_gate

4 years agoast_validation -> new crate rustc_ast_passes
Mazdak Farrokhzad [Sun, 5 Jan 2020 09:58:44 +0000 (10:58 +0100)]
ast_validation -> new crate rustc_ast_passes

4 years agonix syntax::early_buffered_lints
Mazdak Farrokhzad [Sun, 5 Jan 2020 09:47:20 +0000 (10:47 +0100)]
nix syntax::early_buffered_lints

4 years agomove {rustc -> rustc_session}::lint::builtin
Mazdak Farrokhzad [Sun, 5 Jan 2020 09:35:40 +0000 (10:35 +0100)]
move {rustc -> rustc_session}::lint::builtin

4 years agoprepare moving HardwiredLints to rustc_session
Mazdak Farrokhzad [Sun, 5 Jan 2020 09:07:26 +0000 (10:07 +0100)]
prepare moving HardwiredLints to rustc_session

4 years agobuffered lint infra -> rustc_session
Mazdak Farrokhzad [Sun, 5 Jan 2020 08:40:16 +0000 (09:40 +0100)]
buffered lint infra -> rustc_session

4 years agoprepare for moving BuiltinLintDiagnostics to rustc_session
Mazdak Farrokhzad [Sun, 5 Jan 2020 07:54:10 +0000 (08:54 +0100)]
prepare for moving BuiltinLintDiagnostics to rustc_session

4 years agoRemove unused derives
Mazdak Farrokhzad [Sun, 5 Jan 2020 06:30:38 +0000 (07:30 +0100)]
Remove unused derives

4 years agocanonicalize rustc::session import
Mazdak Farrokhzad [Thu, 2 Jan 2020 11:54:43 +0000 (12:54 +0100)]
canonicalize rustc::session import

4 years agosimplify feature_err imports
Mazdak Farrokhzad [Thu, 2 Jan 2020 11:42:42 +0000 (12:42 +0100)]
simplify feature_err imports

4 years agoget_features -> rustc_parse::config
Mazdak Farrokhzad [Thu, 2 Jan 2020 11:33:56 +0000 (12:33 +0100)]
get_features -> rustc_parse::config

4 years agodocument feature_err et. al
Mazdak Farrokhzad [Thu, 2 Jan 2020 10:55:00 +0000 (11:55 +0100)]
document feature_err et. al

4 years agogating diagnostics -> rustc_session::parse
Mazdak Farrokhzad [Thu, 2 Jan 2020 10:41:57 +0000 (11:41 +0100)]
gating diagnostics -> rustc_session::parse

4 years agoOnly require `allow_internal_unstable` for stable `const fn`
Dylan MacKenzie [Sat, 11 Jan 2020 00:12:26 +0000 (16:12 -0800)]
Only require `allow_internal_unstable` for stable `const fn`

4 years agoFix test not to depend on environment
Yuki Okushi [Sat, 11 Jan 2020 01:15:54 +0000 (10:15 +0900)]
Fix test not to depend on environment

4 years agoAdd a comment
John Kåre Alsaker [Fri, 10 Jan 2020 23:38:10 +0000 (00:38 +0100)]
Add a comment

4 years agoAvoid a duplicate hash map lookup
John Kåre Alsaker [Tue, 31 Dec 2019 13:28:36 +0000 (14:28 +0100)]
Avoid a duplicate hash map lookup

4 years agoFix a deadlock
John Kåre Alsaker [Tue, 31 Dec 2019 13:27:20 +0000 (14:27 +0100)]
Fix a deadlock

4 years agoRun codegen unit partitioning and assert_symbols_are_distinct in parallel
John Kåre Alsaker [Tue, 31 Dec 2019 13:01:38 +0000 (14:01 +0100)]
Run codegen unit partitioning and assert_symbols_are_distinct in parallel

4 years agoFix issue with using `self` module via indirection
varkor [Fri, 10 Jan 2020 22:29:57 +0000 (22:29 +0000)]
Fix issue with using `self` module via indirection

4 years agoAuto merge of #65241 - tmiasko:no-std-san, r=alexcrichton
bors [Fri, 10 Jan 2020 23:26:21 +0000 (23:26 +0000)]
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

4 years agoAuto merge of #68101 - JohnTitor:rollup-mvmjukr, r=JohnTitor
bors [Fri, 10 Jan 2020 20:08:58 +0000 (20:08 +0000)]
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

4 years agoRollup merge of #68075 - ollie27:rustbuild_books, r=Mark-Simulacrum
Yuki Okushi [Fri, 10 Jan 2020 19:50:56 +0000 (04:50 +0900)]
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.

4 years agoRollup merge of #68059 - jethrogb:jb/target-llvm-args, r=alexcrichton
Yuki Okushi [Fri, 10 Jan 2020 19:50:54 +0000 (04:50 +0900)]
Rollup merge of #68059 - jethrogb:jb/target-llvm-args, r=alexcrichton

Allow specifying LLVM args in target specifications

4 years agoRollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum
Yuki Okushi [Fri, 10 Jan 2020 19:50:53 +0000 (04:50 +0900)]
Rollup merge of #68050 - Centril:canon-error, r=Mark-Simulacrum

Canonicalize rustc_error imports

r? @Mark-Simulacrum

4 years agoRollup merge of #68039 - euclio:remove-strip-hidden, r=dtolnay
Yuki Okushi [Fri, 10 Jan 2020 19:50:51 +0000 (04:50 +0900)]
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.

4 years agoRollup merge of #68019 - cuviper:in-tree-compiletest, r=Mark-Simulacrum
Yuki Okushi [Fri, 10 Jan 2020 19:50:49 +0000 (04:50 +0900)]
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.

4 years agoRollup merge of #68014 - estebank:unify-e0599, r=cramertj
Yuki Okushi [Fri, 10 Jan 2020 19:50:48 +0000 (04:50 +0900)]
Rollup merge of #68014 - estebank:unify-e0599, r=cramertj

Unify output of "variant not found" errors

Fix #49566.

4 years agoRollup merge of #67258 - Centril:open-ended-ranges, r=oli-obk
Yuki Okushi [Fri, 10 Jan 2020 19:50:46 +0000 (04:50 +0900)]
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.

4 years agoRollup merge of #66045 - mzabaluev:unwrap-infallible, r=dtolnay
Yuki Okushi [Fri, 10 Jan 2020 19:50:45 +0000 (04:50 +0900)]
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

4 years agoIgnore platforms that can't point to std
Esteban Küber [Tue, 7 Jan 2020 20:59:24 +0000 (12:59 -0800)]
Ignore platforms that can't point to std

4 years ago./x.py fmt
Esteban Küber [Tue, 7 Jan 2020 20:22:47 +0000 (12:22 -0800)]
./x.py fmt

4 years agoUse `def_span` to minimize definition span to first line when possible
Esteban Küber [Mon, 28 Oct 2019 21:48:49 +0000 (14:48 -0700)]
Use `def_span` to minimize definition span to first line when possible

4 years agoPoint at the span for the definition of crate foreign ADTs
Esteban Küber [Tue, 15 Oct 2019 00:20:50 +0000 (17:20 -0700)]
Point at the span for the definition of crate foreign ADTs

4 years agoinline `impl From<String> for Box<dyn Error + Send + Sync>`
Lzu Tao [Fri, 10 Jan 2020 19:27:02 +0000 (19:27 +0000)]
inline `impl From<String> for Box<dyn Error + Send + Sync>`

4 years agoAdd ICE regression tests
Esteban Küber [Fri, 10 Jan 2020 19:22:57 +0000 (11:22 -0800)]
Add ICE regression tests

4 years agoChange `next_point` when `shrink_to_hi` is more appropriate
Esteban Küber [Fri, 10 Jan 2020 19:22:33 +0000 (11:22 -0800)]
Change `next_point` when `shrink_to_hi` is more appropriate

4 years agoinline `impl AsRef<Path> for PathBuf`
Lzu Tao [Fri, 10 Jan 2020 19:18:17 +0000 (19:18 +0000)]
inline `impl AsRef<Path> for PathBuf`

4 years agoinline `impl AsRef<OsStr> for OsString`
Lzu Tao [Fri, 10 Jan 2020 19:06:18 +0000 (19:06 +0000)]
inline `impl AsRef<OsStr> for OsString`

4 years agoFix invalid bounding box
Esteban Küber [Fri, 10 Jan 2020 19:03:26 +0000 (11:03 -0800)]
Fix invalid bounding box

4 years agoFix `next_point` to be unicode aware
Esteban Küber [Fri, 10 Jan 2020 19:02:47 +0000 (11:02 -0800)]
Fix `next_point` to be unicode aware

4 years agoInline `impl From<OsString> for PathBuf`
Lzu Tao [Fri, 10 Jan 2020 19:02:14 +0000 (19:02 +0000)]
Inline `impl From<OsString> for PathBuf`

4 years agoInline `AsRef<Path> for str`
Lzu Tao [Fri, 10 Jan 2020 18:56:30 +0000 (18:56 +0000)]
Inline `AsRef<Path> for str`

4 years agoInline PathBuf::deref to make it zero cost
Lzu Tao [Fri, 10 Jan 2020 18:48:15 +0000 (18:48 +0000)]
Inline PathBuf::deref to make it zero cost

4 years agoUpdate E0185.md
Dylan DPC [Fri, 10 Jan 2020 18:26:00 +0000 (23:56 +0530)]
Update E0185.md

4 years agoInline to make OsStr::is_empty zero cost
Lzu Tao [Fri, 10 Jan 2020 18:20:40 +0000 (18:20 +0000)]
Inline to make OsStr::is_empty zero cost

4 years agoAuto merge of #67996 - JohnTitor:clippy-up, r=JohnTitor
bors [Fri, 10 Jan 2020 16:53:17 +0000 (16:53 +0000)]
Auto merge of #67996 - JohnTitor:clippy-up, r=JohnTitor

Update Clippy

Fixes #67994

r? @ghost

4 years agoClarify suggestion for E0013
varkor [Fri, 10 Jan 2020 13:31:36 +0000 (13:31 +0000)]
Clarify suggestion for E0013

4 years agomake use of pointer::is_null
Lzu Tao [Fri, 10 Jan 2020 12:52:00 +0000 (12:52 +0000)]
make use of pointer::is_null

4 years agoAuto merge of #67397 - michaelwoerister:query-keys-in-self-profiling, r=wesleywiser
bors [Fri, 10 Jan 2020 12:18:46 +0000 (12:18 +0000)]
Auto merge of #67397 - michaelwoerister:query-keys-in-self-profiling, r=wesleywiser

self-profiling: Support recording query keys

This PR makes self-profiling able to record query keys. The implementation is not as efficient as it could be yet (all query keys except for `DefId`s cause string data to be duplicated) and the rendered strings could be nicer too. But the implementation is functional and introduces the basic framework for emitting per-query-invocation event data.

I tried to add proper documentation on how everything works. Let me know if more documentation is needed.

r? @wesleywiser

@Mark-Simulacrum, heads up: This updates `measureme` to 0.7.0 which means that `summarize` on perf.rlo needs to be update accordingly once this is merged.

4 years agoPrefer llvm-skip-rebuild flag value over config.toml
Matthew Healy [Thu, 9 Jan 2020 22:13:57 +0000 (23:13 +0100)]
Prefer llvm-skip-rebuild flag value over config.toml

4 years agoMatch llvm-skip-rebuild flag
Matthew Healy [Thu, 9 Jan 2020 21:51:38 +0000 (22:51 +0100)]
Match llvm-skip-rebuild flag

4 years agoFix some rebasing fallout.
Michael Woerister [Fri, 10 Jan 2020 09:32:16 +0000 (10:32 +0100)]
Fix some rebasing fallout.

4 years agoUpdate measureme to 0.7.1 in order to fix compilation error on big-endian platforms.
Michael Woerister [Fri, 3 Jan 2020 11:01:53 +0000 (12:01 +0100)]
Update measureme to 0.7.1 in order to fix compilation error on big-endian platforms.

4 years agoRun 'x.py fmt'.
Michael Woerister [Fri, 3 Jan 2020 10:49:14 +0000 (11:49 +0100)]
Run 'x.py fmt'.

4 years agoself-profile: Fix issue with handling query blocking.
Michael Woerister [Wed, 18 Dec 2019 15:39:06 +0000 (16:39 +0100)]
self-profile: Fix issue with handling query blocking.

4 years agoInitial support for recording query keys in self-profiling data.
Michael Woerister [Tue, 17 Dec 2019 13:44:07 +0000 (14:44 +0100)]
Initial support for recording query keys in self-profiling data.

4 years agoUse 'relaxed' memory ordering for simple atomic counters in dep-graph.
Michael Woerister [Fri, 13 Dec 2019 13:46:10 +0000 (14:46 +0100)]
Use 'relaxed' memory ordering for simple atomic counters in dep-graph.

4 years agoself-profile: Switch to new approach for event_id generation that enables query-invoc...
Michael Woerister [Fri, 13 Dec 2019 13:44:08 +0000 (14:44 +0100)]
self-profile: Switch to new approach for event_id generation that enables query-invocation-specific event_ids.

4 years agoImprove E0185 wording
Guillaume Gomez [Fri, 10 Jan 2020 09:05:49 +0000 (10:05 +0100)]
Improve E0185 wording

4 years agoRebase fallout
Oliver Scherer [Thu, 9 Jan 2020 14:32:14 +0000 (15:32 +0100)]
Rebase fallout

4 years agoRemove an outdated comment
Oliver Scherer [Thu, 9 Jan 2020 13:46:32 +0000 (14:46 +0100)]
Remove an outdated comment

4 years agoAdd regression tests for promotion mir expansion
Oliver Scherer [Thu, 9 Jan 2020 09:33:49 +0000 (10:33 +0100)]
Add regression tests for promotion mir expansion

4 years agoErrors in promoteds may only cause lints not hard errors
Oliver Scherer [Wed, 8 Jan 2020 20:31:08 +0000 (21:31 +0100)]
Errors in promoteds may only cause lints not hard errors

4 years agoPromoteds also need param envs.
Oliver Scherer [Wed, 8 Jan 2020 19:50:59 +0000 (20:50 +0100)]
Promoteds also need param envs.

This also allows us to use the `const_eval` query again without causing cycles

4 years agoDo not store lint_root
Santiago Pastorino [Wed, 1 Jan 2020 15:35:50 +0000 (12:35 -0300)]
Do not store lint_root

4 years agoAdd span_bug that notes that shuffle indices must be constant
Santiago Pastorino [Thu, 19 Dec 2019 17:14:36 +0000 (14:14 -0300)]
Add span_bug that notes that shuffle indices must be constant