Commit graph

96993 commits

Author SHA1 Message Date
Mazdak Farrokhzad
a558668cf2
Rollup merge of #63051 - estebank:borrow-ice, r=matthewjasper
Avoid ICE when referencing desugared local binding in borrow error

To avoid leaking the names of local bindings from expressions like for loops, #60984 explicitly ignored them, but an assertion that `LocalKind::Var` *must* have a name would trigger an ICE.

Before this change, the binding generated by desugaring the for loop would leak into the diagnostic (#63027):
```
error[E0515]: cannot return value referencing local variable `__next`
  --> return-local-binding-from-desugaring.rs:LL:CC
   |
LL |     for ref x in xs {
   |         ----- `__next` is borrowed here
...
LL |     result
   |     ^^^^^^ returns a value referencing data owned by the current function
```

Ideally `LocalKind` would carry more information to more accurately explain the problem, but for now, in order to avoid the ICE (fix #63026), we accept `LocalKind::Var` without a name and produce the following output:

```
error[E0515]: cannot return value referencing local binding
  --> $DIR/return-local-binding-from-desugaring.rs:30:5
   |
LL |     for ref x in xs {
   |                  -- local binding introduced here
...
LL |     result
   |     ^^^^^^ returns a value referencing data owned by the current function
```
2019-07-28 11:11:12 +02:00
Mazdak Farrokhzad
48802974aa
Rollup merge of #62974 - RalfJung:crossbeam, r=alexcrichton
bump crossbeam-epoch dependency

The new crossbeam-epoch release depends on a memoffset with a whole bunch of soundness holes fixed.

The old memoffset is still indirectly depended on (at least) by rustc-rayon, though -- a crate that looks rather unmaintained (no change in more than a year).
2019-07-28 11:11:10 +02:00
Mazdak Farrokhzad
b405aa2d03
Rollup merge of #62806 - mati865:clippy, r=TimNN
Fix few Clippy warnings
2019-07-28 11:11:08 +02:00
Mazdak Farrokhzad
2826bdcfa6
Rollup merge of #62759 - mark-i-m:rustc-guide-toolstate-check, r=kennytm
Actually add rustc-guide to toolstate, don't fail builds for the guide

cc @ehuss

r? @kennytm
2019-07-28 11:11:06 +02:00
Mazdak Farrokhzad
75e23ff411
Rollup merge of #62550 - Centril:rest-patterns, r=petrochenkov
Implement RFC 2707 + Parser recovery for range patterns

Implement https://github.com/rust-lang/rfcs/pull/2707.

- Add a new basic syntactic pattern form `ast::PatKind::Rest` (parsed as `..` or `DOTDOT`) and simplify `ast::PatKind::{Slice, Tuple, TupleStruct}` as a result.

- Lower `ast::PatKind::Rest` in combination with the aforementioned `PatKind` variants as well as `PatKind::Ident`. The HIR remains unchanged for now (may be advisable to make slight adjustments later).

- Refactor `parser.rs` wrt. parsing sequences and lists of things in the process.

- Add parser recovery for range patterns of form `X..`, `X..=`, `X...`, `..Y`, `..=Y`, and `...Y`.
   This should make it easy to actually support these patterns semantically later if we so desire.

cc https://github.com/rust-lang/rust/issues/62254

r? @petrochenkov
2019-07-28 11:11:04 +02:00
Mazdak Farrokhzad
84c6d3088e
Allow rustbot to add F-* + requires-nightly. 2019-07-28 10:29:38 +02:00
Yuki Okushi
15307ca993 Move to src/test/ui/match/ 2019-07-28 16:51:21 +09:00
Yuki Okushi
29a00ef4a6 Add test for issue-50900 2019-07-28 16:26:01 +09:00
Mazdak Farrokhzad
d33696fcb4 borrowck-describe-lvalue: --bless --compare-mode=nll. 2019-07-28 07:04:16 +02:00
Mazdak Farrokhzad
87742073a0 And --bless tests accordingly for those exceptions. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
18ccd6a33c Add exceptions for ExprKind::Err/TyKind::Error. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
5f4dd1d19a Address comments re. off-topic errors. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
becdba80ea Address comments in lowering + parsing. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
397a027aa7 Use AstP more in lowering. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
59b5dae918 Update error_codes.rs with new subslice syntax. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
acc6a6d8cb --bless tests after rebase. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
1060513ddc Get out of bootstrapping pickle. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
984f9db946 Adjust documentation in HAIR. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
cec8649933 Update unstable book wrt. subslice patterns. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
7c0b1da2c1 Win some lose some; Unfortunately we lost recovery in one case. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
e3cdadd73f (pat, ..,) is now syntactically legal. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
06e5ae5c82 Account for better recovery in two cases. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
e725ea2215 Intersection patterns 'p1 @ p2' are not supported. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
91c8b53f45 --bless tests due to new subslice syntax. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
75da43dc87 Use new 'p @ ..' syntax in tests. 2019-07-28 06:53:39 +02:00
Mazdak Farrokhzad
891a736b02 Test parsing and recovery of all sorts of range patterns. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
f6c8234f9f And also --bless those recovery tests. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
2411134c78 Update tests wrt. recovery of range patterns. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
2f55354759 Recover on 'X..' / 'X..=' / 'X...' range patterns. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
974413fcc5 Recover on '..X' / '..=X' / '...X' range patterns. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
62b29a1e17 Adjust parsing of Slice, Tuple, TupleStruct patterns. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
7e1b671f8a Cleanup using the new parse_*_seq methods. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
7aeb4b7327 Add more parse_*_seq methods for code reuse. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
0a40ef23ad Cleanup parse_seq_* methods + record trailing separators. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
694b3c3ef2 Adjust lowering of Slice patterns.
- Make sure extra `x @ ..` do not cause ICEs.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
d5df1e0b0f Adjust lowering of Tuple/TupleStruct patterns.
- Make sure we ban duplicate '..'.
- Avoid ICEs on PatKind::Rest that doesn't generate HIR nodes.
2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
8ba5f49f6f Adjust and document 'Pat::to_ty' accordingly. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
b02941f2a6 Adjust pretty printing accordingly. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
12250a2017 Adjust feature gating of subslice patterns accordingly. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
633c9972ac Adjust 'ast::PatKind::{TupleStruct,Tuple,Slice}'. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
ff77ef2d70 Introduce 'ast::Pat::is_rest(&self) -> bool'. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
f7c75cc11a Add 'ast::PatKind::Rest'. 2019-07-28 06:53:38 +02:00
Mazdak Farrokhzad
bfdfa85e73 Add tests for Vec(Deque) array PartialEq impls. 2019-07-28 06:46:41 +02:00
Mazdak Farrokhzad
744ec8809d Use const generics for some VecDeque impls. 2019-07-28 06:33:54 +02:00
Mazdak Farrokhzad
8b57f689d5 Use const generics for some Vec/CCow impls. 2019-07-28 06:33:54 +02:00
Esteban Küber
01ba0e3718 review comments 2019-07-27 19:15:25 -07:00
bors
9a239ef4de Auto merge of #63057 - Centril:rollup-z3a3c6v, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #61207 (Allow lifetime elision in `Pin<&(mut) Self>`)
 - #62074 (squash of all commits for nth_back on ChunksMut)
 - #62771 (Break dependencies between `syntax_ext` and other crates)
 - #62883 (Refactoring use common code between option, result and accum)
 - #62949 (Re-enable assertions in PPC dist builder)
 - #62996 (tidy: Add a check for inline unit tests)
 - #63038 (Make more informative error on outer attribute after inner)
 - #63050 (ci: download awscli from our mirror)

Failed merges:

r? @ghost
2019-07-28 01:03:16 +00:00
Mazdak Farrokhzad
34c0f4698b
Rollup merge of #63050 - pietroalbini:vendor-awscli, r=Mark-Simulacrum
ci: download awscli from our mirror

This fixes multiple network issues we had when downloading awscli from PyPI on Azure Pipelines by vendoring awscli itself and its dependencies in our S3 bucket. Instructions on how to update the cache are present at the top of `src/ci/install-awscli.sh`.

r? @alexcrichton or @Mark-Simulacrum
fixes #62967
2019-07-28 03:01:55 +02:00
Mazdak Farrokhzad
5c7008540d
Rollup merge of #63038 - eupn:outer-attribute-diag, r=estebank
Make more informative error on outer attribute after inner

Fixes #61218.

?r @estebank
2019-07-28 03:01:53 +02:00
Mazdak Farrokhzad
c3c03098d8
Rollup merge of #62996 - petrochenkov:outest, r=Mark-Simulacrum
tidy: Add a check for inline unit tests

As described in https://github.com/rust-lang/rust/issues/61097.

There's a large whitelist right now, because in many crates the tests are not outlined yet.
~This PR only outlines tests in one crate (`rustc_lexer`) as an example.~

r? @Mark-Simulacrum
2019-07-28 03:01:51 +02:00