Commit Graph

82358 Commits

Author SHA1 Message Date
bors
142bb27373 Auto merge of #53147 - ashtneoi:dont-suggest-ref, r=estebank
For move errors, suggest match ergonomics instead of `ref`

Partially fixes issue #52423. Also makes errors and suggestions more consistent between move-from-place and move-from-value errors.

Limitations:
- Only the first pattern in a match arm can have a "consider removing this borrow operator" suggestion.
- Suggestions don't always compile as-is (see the TODOs in the test for details).

Sorry for the really long test. I wanted to make sure I handled every case I could think of, and it turned out there were a lot of them.

Questions:
- Is there any particular applicability I should set on those suggestions?
- Are the notes about the `Copy` trait excessive?
2018-08-16 08:45:32 +00:00
Nicholas Nethercote
5745597e61 Speed up NLL with HybridIdxSetBuf.
`HybridIdxSetBuf` is a sparse-when-small but dense-when-large index set
that is very efficient for sets that (a) have few elements, (b) have
large `universe_size` values, and (c) are cleared frequently. Which
makes it perfect for the `gen_set` and `kill_set` sets used by the new
borrow checker.

This patch reduces the execution time of the five slowest NLL benchmarks
by 55%, 21%, 16%, 10% and 9%. It also reduces the max-rss of three
benchmarks by 53%, 33%, and 9%.
2018-08-16 17:52:36 +10:00
Eduard-Mihai Burtescu
32e17b5921 tests: prefer edition: directives to compile-flags:--edition. 2018-08-16 10:36:11 +03:00
Eduard-Mihai Burtescu
2c4402638e syntax: also warn about edition "umbrella" features being implied by --edition. 2018-08-16 10:35:45 +03:00
bors
996e26c23f Auto merge of #53295 - estebank:on-unimplemented, r=michaelwoerister
Various changes to `rustc_on_unimplemented`

- Add `from_method` and `from_desugaring` to formatting options
- Change wording of errors slightly
2018-08-16 06:34:13 +00:00
ashtneoi
0023dd9ba1 Split tests more and bless them again 2018-08-15 22:36:19 -07:00
ashtneoi
f335fb08c2 Move tests into their own directory 2018-08-15 22:35:56 -07:00
bors
fc323ba160 Auto merge of #53293 - petrochenkov:gramattr2, r=alexcrichton
syntax: Enforce attribute grammar in the parser

Also fix feature-gating for `unrestricted_attribute_tokens` that was introduced in https://github.com/rust-lang/rust/pull/53270, but was actually broken.

cc https://github.com/rust-lang/rust/pull/50911
2018-08-16 04:16:12 +00:00
Esteban Küber
c9274c73b2 fix broken test 2018-08-15 18:47:34 -07:00
bors
6c712b1492 Auto merge of #53289 - ljedrz:improve_lexer, r=michaelwoerister
A few cleanups and minor improvements for the lexer

- improve readability by adjusting the formatting of some function signatures and adding some newlines
- reorder some functions for easier reading
- remove redundant `'static` in `const`s
- remove some explicit `return`s
- read directly to a `String` in `gather_comments_and_literals`
- change `unwrap_or!` (macro) to `unwrap_or` (function)
- move an `assert!`ion from `try_next_token` (called in a loop) to `try_real_token` after all calls to `try_next_token`
- `#[inline]` some one-liner functions
- assign directly from an `if-else` expression
- refactor a `match` to `map_or`
- add a `token::is_irrelevant` function to detect tokens that are not "`real`"
2018-08-16 01:08:13 +00:00
Alex Crichton
fccc04d3e7 Start adding an aarch64-pc-windows-msvc target
This commit adds the necessary definitions for target specs and such as well as
the necessary support in libstd to compile basic `aarch64-pc-windows-msvc`
binaries. The target is not currently built on CI, but it can be built locally
with:

    ./configure --target=aarch64-pc-windows-msvc --set rust.lld
    ./x.py build src/libstd --target aarch64-pc-windows-msvc

Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?)
which hasn't been investigate yet. Otherwise though with libstd you can build a
hello world program (linked with LLD). I've not tried to execute it yet, but it
at least links!

Full support for this target is still a long road ahead, but this is hopefully a
good stepping stone to get started.

Points of note about this target are:

* Currently defaults to `panic=abort` as support is still landing in LLVM for
  SEH on AArch64.
* Currently defaults to LLD as a linker as I was able to get farther with it
  than I was with `link.exe`
2018-08-15 17:20:13 -07:00
Eduard-Mihai Burtescu
0f00979517 syntax: process all edition features before other features. 2018-08-16 02:49:56 +03:00
Eduard-Mihai Burtescu
494889ede1 Revert "Ignore test that fails on stage1"
This reverts commit 0e43e6fef2.
2018-08-16 02:11:44 +03:00
Eduard-Mihai Burtescu
83268ff494 syntax_ext: remove leftover span_err_if_not_stage0 macro. 2018-08-16 02:10:54 +03:00
ashtneoi
f4229b81b5 Re-bless test 2018-08-15 15:25:53 -07:00
ashtneoi
4c4e1ef2c5 Add files I forgot to commit earlier 2018-08-15 15:14:21 -07:00
ashtneoi
671d7e064f Change a method name and clarify a comment 2018-08-15 15:14:21 -07:00
ashtneoi
bd2b54c23c Bless tests 2018-08-15 15:14:21 -07:00
ashtneoi
a5b008c450 Test move-into-Fn/FnMut errors too 2018-08-15 15:14:21 -07:00
ashtneoi
6a24abbbc5 Fix compiletest JSON error message 2018-08-15 15:14:21 -07:00
ashtneoi
3c3a7bad49 Allocate fewer Strings at a time 2018-08-15 15:14:21 -07:00
ashtneoi
81c27c6af7 Add another FIXME about suggestions 2018-08-15 15:14:21 -07:00
ashtneoi
9a0020a879 Bless UI tests 2018-08-15 15:14:21 -07:00
ashtneoi
d6dbdee739 Remove incorrect space 2018-08-15 15:14:21 -07:00
ashtneoi
a583aa642e Remove unnecessary comment
Turns out I didn't read the original comment correctly and had some
confusion about how MIR uses temporaries.
2018-08-15 15:14:21 -07:00
ashtneoi
0a82abc47b Test patterns in tuples 2018-08-15 15:14:21 -07:00
ashtneoi
6cf4e14ac0 Coalesce var-is-not-Copy notes per move 2018-08-15 15:14:21 -07:00
ashtneoi
20ae08bda6 Dedup suggestions 2018-08-15 15:14:21 -07:00
ashtneoi
40b5118c8a Remove unnecessary underscore 2018-08-15 15:14:21 -07:00
ashtneoi
8135372ed1 Change TODOs to FIXMEs 2018-08-15 15:14:21 -07:00
ashtneoi
10aaba8dbe Make move errors more consistent with typeck errors 2018-08-15 15:14:21 -07:00
ashtneoi
701c74e067 Make move error suggestions clearer 2018-08-15 15:14:21 -07:00
ashtneoi
b05e9a7f77 Add backquotes around variable name 2018-08-15 15:14:21 -07:00
ashtneoi
8080bdf275 Fix move errors for index expressions
The suggestion logic gave up too early, which kept it from suggesting
borrowing index expressions.
2018-08-15 15:14:21 -07:00
ashtneoi
54ddb36ce7 Test move errors for index expressions 2018-08-15 15:14:21 -07:00
ashtneoi
1e87908c52 Accept whitespace between & and mut 2018-08-15 15:14:21 -07:00
ashtneoi
3a5812bdd9 Add more TODOs 2018-08-15 15:14:21 -07:00
ashtneoi
a05f82fd2d Suggest match ergonomics, not ref/ref mut 2018-08-15 15:14:21 -07:00
ashtneoi
7b10133297 Fix some random stuff 2018-08-15 15:10:43 -07:00
Felix S. Klock II
cd89fdbbc9 Removed ignore-test-compare-mode-nll from unboxed-closures tests
by strengthening the tests (by adding no-op references to the
closures doing the borrows after the conflicting borrows, thus
forcing the lifetimes to resemble lexical scopes even under NLL).
2018-08-15 23:47:29 +02:00
Felix S. Klock II
f8084c675e Removed ignore-test-compare-mode-nll from hashmap-lifetimes.rs
by strengthening the test there.
2018-08-15 23:47:28 +02:00
Felix S. Klock II
fb3ccb2aa2 Removed ignore-test-compare-mode-nll from borrowck-closures-two-mut-fail.rs
by strengthening the tests there.
2018-08-15 23:47:28 +02:00
Felix S. Klock II
dd9f84f2d3 Removed ignore-test-compare-mode-nll from borrowck-closures-unique.rs
by strengthening the tests there.

In almost all cases the strengthening amount to just encoding a use
that models the original lexical lifetime. A more invasive revision
was made in one case where it seems the actual issue is MIR-borrowck's
greater "knowledge" of unreachable code in the control flow...
2018-08-15 23:47:28 +02:00
Esteban Küber
1b5e29ae6f Do not emit "incorrect close delimiter" twice in the same place 2018-08-15 14:26:03 -07:00
Esteban Küber
2a74d7924a Tweak unclosed delimiter parser error 2018-08-15 13:18:34 -07:00
Esteban Küber
5a0a38a46f Do not suggest conversion method that is already there 2018-08-15 13:04:24 -07:00
bors
d767ee1161 Auto merge of #53400 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #52453 (improve diagnostics for tests with custom return values)
 - #53271 (use ? to simplify `TransitiveRelation.maybe_map`)
 - #53279 (Extend documentation of `rustc_on_unimplemented`)
 - #53342 (fix error for unsized packed struct field)
 - #53344 (Add doc examples for std::alloc::{alloc,alloc_zeroed}.)
 - #53368 (Ignore test that fails on stage1)
 - #53388 (Fix links' color)
 - #53396 (Fix since of Iterator::flatten to be a proper semver)

Failed merges:

r? @ghost
2018-08-15 19:39:54 +00:00
Pazzaz
b063bd4616 Test VecDeque append not dropping twice 2018-08-15 19:42:07 +02:00
Guillaume Gomez
b9a51ce2f6
Rollup merge of #53396 - matklad:fix-flatten-since, r=varkor
Fix since of Iterator::flatten to be a proper semver

r? @kennytm
2018-08-15 19:20:29 +02:00
Guillaume Gomez
7acfa8615a
Rollup merge of #53388 - GuillaumeGomez:fix-links-color, r=frewsxcv
Fix links' color

Fixes #53375.

Problem was coming from the minifier.

r? @frewsxcv
2018-08-15 19:20:28 +02:00