]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agocanonicalize some lint imports
Mazdak Farrokhzad [Sun, 5 Jan 2020 09:58:44 +0000 (10:58 +0100)]
canonicalize some lint imports

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 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 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 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 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 agoAllow specifying LLVM args in target specifications
Jethro Beekman [Thu, 9 Jan 2020 15:40:40 +0000 (16:40 +0100)]
Allow specifying LLVM args in target specifications

4 years agonix syntax::errors & prefer rustc_errors over errors
Mazdak Farrokhzad [Thu, 9 Jan 2020 10:18:47 +0000 (11:18 +0100)]
nix syntax::errors & prefer rustc_errors over errors

4 years agoIntroduce `#![feature(half_open_range_patterns)]`.
Mazdak Farrokhzad [Wed, 11 Dec 2019 09:04:34 +0000 (10:04 +0100)]
Introduce `#![feature(half_open_range_patterns)]`.

This feature adds `X..`, `..X`, and `..=X` patterns.

4 years agoDo not ICE on unicode next point
Esteban Küber [Fri, 10 Jan 2020 06:10:18 +0000 (22:10 -0800)]
Do not ICE on unicode next point

Use `shrink_to_hi` instead of `next_point`
Fix #68000.

4 years agoAuto merge of #68078 - Centril:rollup-qvq052k, r=Centril
bors [Fri, 10 Jan 2020 02:09:41 +0000 (02:09 +0000)]
Auto merge of #68078 - Centril:rollup-qvq052k, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #66463 (Point at opaque and closure type definitions in type errors)
 - #67501 (Reduce special treatment for zsts)
 - #67820 (Parse the syntax described in RFC 2632)
 - #67922 (rustc_ast_lowering: misc cleanup & rustc dep reductions)
 - #68071 (Extend support of `_` in type parameters)
 - #68073 (expect `fn` after `const unsafe` / `const extern`)

Failed merges:

r? @ghost

4 years agoRollup merge of #68073 - Centril:fix-68062, r=estebank
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:36 +0000 (02:47 +0100)]
Rollup merge of #68073 - Centril:fix-68062, r=estebank

expect `fn` after `const unsafe` / `const extern`

Fixes #68062

r? @estebank @petrochenkov
cc @Aaron1011

4 years agoRollup merge of #68071 - estebank:ice-67995, r=Centril
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:34 +0000 (02:47 +0100)]
Rollup merge of #68071 - estebank:ice-67995, r=Centril

Extend support of `_` in type parameters

 - Account for `impl Trait<_>`.
 - Provide a reasonable `Span` for empty `Generics` in `impl`s.
 - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
 - Fix #67995. Follow up to #67597.

4 years agoRollup merge of #67922 - Centril:lowering-cleanup, r=petrochenkov
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:33 +0000 (02:47 +0100)]
Rollup merge of #67922 - Centril:lowering-cleanup, r=petrochenkov

rustc_ast_lowering: misc cleanup & rustc dep reductions

- The first two commits do some code simplification.
- The next three do some file splitting (getting `lib.rs` below the 3kloc tidy lint).
- The remaining commits reduce the number of `rustc::` imports. This works towards making lowering independent of the `rustc` crate.

r? @oli-obk cc @Zoxc

4 years agoRollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:32 +0000 (02:47 +0100)]
Rollup merge of #67820 - ecstatic-morse:const-trait, r=oli-obk

Parse the syntax described in RFC 2632

This adds support for both `impl const Trait for Ty` and `?const Trait` bound syntax from rust-lang/rfcs#2632 to the parser. For now, both modifiers end up in a newly-added `constness` field on `ast::TraitRef`, although this may change once the implementation is fleshed out.

I was planning on using `delay_span_bug` when this syntax is encountered during lowering, but I can't write `should-ice` UI tests. I emit a normal error instead, which causes duplicates when the feature gate is not enabled (see the `.stderr` files for the feature gate tests). Not sure what the desired approach is; Maybe just do nothing when the syntax is encountered with the feature gate is enabled?

@oli-obk I went with `const_trait_impl` and `const_trait_bound_opt_out` for the names of these features. Are these to your liking?

cc #67792 #67794

r? @Centril

4 years agoRollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJung
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:30 +0000 (02:47 +0100)]
Rollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJung

Reduce special treatment for zsts

addresses https://github.com/rust-lang/rust/pull/67467#discussion_r360650846

cc @RalfJung

4 years agoRollup merge of #66463 - estebank:point-at-closure-and-opaque-types, r=Centril
Mazdak Farrokhzad [Fri, 10 Jan 2020 01:47:29 +0000 (02:47 +0100)]
Rollup merge of #66463 - estebank:point-at-closure-and-opaque-types, r=Centril

Point at opaque and closure type definitions in type errors

Fixes #57266, fixes #67117.

4 years agoAdd test for `?const` in nested impl/dyn trait
Dylan MacKenzie [Mon, 6 Jan 2020 00:34:26 +0000 (16:34 -0800)]
Add test for `?const` in nested impl/dyn trait

4 years agoMake `bound_context` more like neighboring functions
Dylan MacKenzie [Mon, 6 Jan 2020 00:33:26 +0000 (16:33 -0800)]
Make `bound_context` more like neighboring functions

4 years agoAdd test for `?const` and `?` on the same bound
Dylan MacKenzie [Sun, 5 Jan 2020 05:47:11 +0000 (21:47 -0800)]
Add test for `?const` and `?` on the same bound

4 years agoCall all visit methods on trait definitions
Dylan MacKenzie [Sun, 5 Jan 2020 02:34:10 +0000 (18:34 -0800)]
Call all visit methods on trait definitions

4 years agoAdd tests for RFC 2632
Dylan MacKenzie [Fri, 3 Jan 2020 00:31:30 +0000 (16:31 -0800)]
Add tests for RFC 2632

4 years agoCheck for `?const` in invalid contexts during AST validation
Dylan MacKenzie [Sun, 5 Jan 2020 00:29:45 +0000 (16:29 -0800)]
Check for `?const` in invalid contexts during AST validation

4 years agoReject `const` in inherent impls
Dylan MacKenzie [Sat, 4 Jan 2020 00:32:01 +0000 (16:32 -0800)]
Reject `const` in inherent impls

4 years agoError when new syntax is lowered
Dylan MacKenzie [Fri, 3 Jan 2020 00:35:07 +0000 (16:35 -0800)]
Error when new syntax is lowered

This means the new syntax will always fail to compile, even when the
feature gate is enabled. These checks will be removed in a later PR
once the implementation is done.

4 years agoParse `?const Trait` bound syntax
Dylan MacKenzie [Thu, 2 Jan 2020 23:50:18 +0000 (15:50 -0800)]
Parse `?const Trait` bound syntax

The grammar also handles `?const ?Trait` even though this is
semantically redundant.

4 years agoParse `impl const Trait for Ty` syntax
Dylan MacKenzie [Thu, 2 Jan 2020 23:49:45 +0000 (15:49 -0800)]
Parse `impl const Trait for Ty` syntax

4 years agoAdd a `constness` field to `ast::TraitRef`
Dylan MacKenzie [Thu, 2 Jan 2020 23:47:27 +0000 (15:47 -0800)]
Add a `constness` field to `ast::TraitRef`

This is used for both the `?const` syntax in bounds as well as the `impl
const Trait` syntax. I also considered handling these separately by
adding a variant of `TraitBoundModifier` and a field to
`ItemKind::Impl`, but this approach was less intrusive.

4 years agoAdd `const_trait_bound_opt_out` feature gate
Dylan MacKenzie [Thu, 2 Jan 2020 23:46:30 +0000 (15:46 -0800)]
Add `const_trait_bound_opt_out` feature gate

4 years agoAdd `const_trait_impl` feature gate
Dylan MacKenzie [Thu, 2 Jan 2020 23:45:48 +0000 (15:45 -0800)]
Add `const_trait_impl` feature gate

4 years agorustbuild: Cleanup book generation
Oliver Middleton [Thu, 9 Jan 2020 23:45:06 +0000 (23:45 +0000)]
rustbuild: Cleanup book generation

The Cargo book can be generated the same way as the other books.

4 years agoreview comments: more tests
Esteban Küber [Thu, 9 Jan 2020 22:53:17 +0000 (14:53 -0800)]
review comments: more tests

4 years agoUpdate Clippy
Yuki Okushi [Wed, 8 Jan 2020 07:47:57 +0000 (16:47 +0900)]
Update Clippy

4 years agoAdd llvm-skip-rebuild to opts
Matthew Healy [Thu, 9 Jan 2020 21:19:33 +0000 (22:19 +0100)]
Add llvm-skip-rebuild to opts

4 years agoExtend support of `_` in type parameters
Esteban Küber [Thu, 9 Jan 2020 21:46:37 +0000 (13:46 -0800)]
Extend support of `_` in type parameters

 - Account for `impl Trait<_>`.
 - Provide a reasonable `Span` for empty `Generics` in `impl`s.
 - Account for `fn foo<_>(_: _) {}` to suggest `fn foo<T>(_: T) {}`.
 - Fix #67995.

4 years agoTweak timers
John Kåre Alsaker [Thu, 9 Jan 2020 22:19:20 +0000 (23:19 +0100)]
Tweak timers

4 years agoexpect `fn` after `const unsafe` / `const extern`
Mazdak Farrokhzad [Thu, 9 Jan 2020 22:00:28 +0000 (23:00 +0100)]
expect `fn` after `const unsafe` / `const extern`

4 years agoLabel unmarked time
John Kåre Alsaker [Thu, 9 Jan 2020 02:48:00 +0000 (03:48 +0100)]
Label unmarked time

4 years agoAuto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor
bors [Thu, 9 Jan 2020 19:21:58 +0000 (19:21 +0000)]
Auto merge of #68067 - JohnTitor:rollup-vsj5won, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #66254 (Make Layout::new const)
 - #67122 (Do not deduplicate diagnostics in UI tests)
 - #67358 (Add HashSet::get_or_insert_owned)
 - #67725 (Simplify into_key_slice_mut)
 - #67935 (Relax the Sized bounds on Pin::map_unchecked(_mut))
 - #67967 (Delay bug to prevent ICE in MIR borrowck)
 - #67975 (Export public scalar statics in wasm)
 - #68006 (Recognise riscv64 in compiletest)
 - #68040 (Cleanup)
 - #68054 (doc: add Null-unchecked version section to mut pointer as_mut method)

Failed merges:

 - #67258 (Introduce `X..`, `..X`, and `..=X` range patterns)

r? @ghost

4 years agoRollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj
Yuki Okushi [Thu, 9 Jan 2020 19:18:43 +0000 (04:18 +0900)]
Rollup merge of #68054 - tspiteri:null-unchecked-as_mut, r=cramertj

doc: add Null-unchecked version section to mut pointer as_mut method

The [`as_ref`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref-1) method already has a *Null-unchecked version* section, its example is a modification of the example in the main `as_ref` section. Similarly the example in this PR is a modification of the example in main [`as_mut`](https://doc.rust-lang.org/std/primitive.pointer.html#method.as_mut) section.

Fixes #68032.

4 years agoRollup merge of #68040 - sinkuu:unused, r=petrochenkov
Yuki Okushi [Thu, 9 Jan 2020 19:18:42 +0000 (04:18 +0900)]
Rollup merge of #68040 - sinkuu:unused, r=petrochenkov

Cleanup

4 years agoRollup merge of #68006 - infinity0:master, r=nikomatsakis
Yuki Okushi [Thu, 9 Jan 2020 19:18:40 +0000 (04:18 +0900)]
Rollup merge of #68006 - infinity0:master, r=nikomatsakis

Recognise riscv64 in compiletest

Otherwise tests can't run, fails with "Cannot determine Architecture from triple"

4 years agoRollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton
Yuki Okushi [Thu, 9 Jan 2020 19:18:39 +0000 (04:18 +0900)]
Rollup merge of #67975 - EmbarkStudios:export-statics-wasm, r=alexcrichton

Export public scalar statics in wasm

Fixes #67453

I am not sure which export level statics should get when exporting them in wasm. This small change fixes the issue that I had, but this might not be the correct way to implement this.