99862 Commits

Author SHA1 Message Date
Guillaume Gomez
e541b2ece9 Add E0551 long error explanation 2019-10-01 14:54:32 +02:00
bors
702b45e409 Auto merge of #64946 - Centril:rollup-66mj5o0, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #63674 (syntax: Support modern attribute syntax in the `meta` matcher)
 - #63931 (Stabilize macros in some more positions)
 - #64887 (syntax: recover trailing `|` in or-patterns)
 - #64895 (async/await: improve not-send errors)
 - #64896 (Remove legacy grammar)
 - #64907 (A small amount of tidying-up factored out from PR #64648)
 - #64928 (Add tests for some issues)
 - #64930 (Silence unreachable code lint from await desugaring)
 - #64935 (Improve code clarity)
 - #64937 (Deduplicate closure type errors)

Failed merges:

r? @ghost
2019-10-01 07:56:52 +00:00
Mazdak Farrokhzad
46bf6ad416
Rollup merge of #64937 - estebank:dedup-closure-err, r=Centril
Deduplicate closure type errors

Closure typing obligations flow in both direcitons to properly infer
types. Because of this, we will get 2 type errors whenever there's
an unfulfilled obligation. To avoid this, we deduplicate them in the
`InferCtxt`.
2019-10-01 09:55:39 +02:00
Mazdak Farrokhzad
5c6a8ee9dd
Rollup merge of #64935 - AnthonyMikh:librustc_errors/emmiter__code-clarity, r=estebank
Improve code clarity

No commit except 55b54285c811b6ab12bb0ba001126fd5b7d3bd09 address performance, just making the existing code more clear.

r? @estebank
2019-10-01 09:55:38 +02:00
Mazdak Farrokhzad
f4aa29fb1e
Rollup merge of #64930 - davidtwco:issue-61798-diverging-await, r=petrochenkov
Silence unreachable code lint from await desugaring

Fixes #61798.

This PR silences the unreachable code lint when it originates from within an await desugaring.
2019-10-01 09:55:37 +02:00
Mazdak Farrokhzad
dc1c1fe456
Rollup merge of #64928 - JohnTitor:add-some-tests, r=Centril
Add tests for some issues

Closes #50571
Closes #58022
Closes #58344
2019-10-01 09:55:35 +02:00
Mazdak Farrokhzad
24a84fae34
Rollup merge of #64907 - alexreg:tidy-up, r=Mark-Simulacrum
A small amount of tidying-up factored out from PR #64648

As requested by @Mark-Simulacrum, I put this in a separate commit to make it easier to review. (As far as I can tell, no violations of the policy here, and they are simply in a separate PR because they're not directly related to the import of that PR.)

r? @Mark-Simulacrum
2019-10-01 09:55:34 +02:00
Mazdak Farrokhzad
b8c5d3a427
Rollup merge of #64896 - XAMPPRocky:remove-grammar, r=Centril
Remove legacy grammar

Revival of #50835 & #55545

On the #wg-grammar discord there was agreement that enough progress has been made to be able to remove the legacy grammar.

r? @Centril @qmx

cc @rust-lang/wg-grammar
2019-10-01 09:55:33 +02:00
Mazdak Farrokhzad
25f774a4cf
Rollup merge of #64895 - davidtwco:issue-64130-async-error-definition, r=nikomatsakis
async/await: improve not-send errors

cc #64130.

```
note: future does not implement `std::marker::Send` because this value is used across an await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

r? @nikomatsakis
2019-10-01 09:55:31 +02:00
Mazdak Farrokhzad
f45de9a690
Rollup merge of #64887 - Centril:recover-trailing-vert, r=estebank
syntax: recover trailing `|` in or-patterns

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

For example (this also shows that we are sensitive to the typo `||`):

```
error: a trailing `|` is not allowed in an or-pattern
  --> $DIR/remove-leading-vert.rs:33:11
   |
LL |         A || => {}
   |         - ^^ help: remove the `||`
   |         |
   |         while parsing this or-pattern starting here
   |
   = note: alternatives in or-patterns are separated with `|`, not `||`
```

r? @estebank
2019-10-01 09:55:29 +02:00
Mazdak Farrokhzad
3bd34e04e3
Rollup merge of #63931 - petrochenkov:stabmac, r=Centril
Stabilize macros in some more positions

- Fn-like macros and attribute macros in `extern` blocks
- Fn-like procedural macros in type positions
- ~Attribute macros on inline modules~ (moved to https://github.com/rust-lang/rust/pull/64273)

Stabilization report: https://github.com/rust-lang/rust/pull/63931#issuecomment-526362396.

Closes https://github.com/rust-lang/rust/issues/49476
cc https://github.com/rust-lang/rust/issues/54727
2019-10-01 09:55:28 +02:00
Mazdak Farrokhzad
64130fd2c4
Rollup merge of #63674 - petrochenkov:meta2, r=Centril
syntax: Support modern attribute syntax in the `meta` matcher

Where "modern" means https://github.com/rust-lang/rust/pull/57367:
```
PATH
PATH `(` TOKEN_STREAM `)`
PATH `[` TOKEN_STREAM `]`
PATH `{` TOKEN_STREAM `}`
```

Unfortunately, `meta` wasn't future-proofed using the `FOLLOW` token set like other matchers (https://github.com/rust-lang/rust/issues/34011), so code like `$meta:meta {` or `$meta:meta [` may break, and we need a crater run to find out how often this happens in practice.

Closes https://github.com/rust-lang/rust/issues/49629 (by fully supporting `meta` rather than removing it.)
2019-10-01 09:55:26 +02:00
bors
42ec6831b0 Auto merge of #64932 - tmandry:rollup-7t8x1nz, r=tmandry
Rollup of 9 pull requests

Successful merges:

 - #64377 (Add long error explanation for E0493)
 - #64786 (Use https for curl when building for linux)
 - #64828 (Graphviz debug output for generic dataflow analysis)
 - #64838 (Add long error explanation for E0550)
 - #64891 (Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadata)
 - #64893 (Zero-initialize `vec![None; n]` for `Option<&T>`, `Option<&mut T>` and `Option<Box<T>>`)
 - #64911 (Fixed a misleading documentation issue #64844)
 - #64921 (Add test for issue-64662)
 - #64923 (Add missing links for mem::needs_drop)

Failed merges:

 - #64918 (Add long error explanation for E0551)

r? @ghost
2019-10-01 02:31:48 +00:00
Esteban Küber
13e9b3deb4 Deduplicate closure type errors
Closure typing obligations flow in both direcitons to properly infer
types. Because of this, we will get 2 type errors whenever there's
an unfulfilled obligation. To avoid this, we deduplicate them in the
`InferCtxt`.
2019-09-30 17:48:22 -07:00
AnthonyMikh
50c2a58d08
Fix borrowck errors
Reborrowing doesn't work for loops
2019-10-01 03:22:07 +03:00
AnthonyMikh
fdce4168fc
Hint type for .sum() 2019-10-01 03:04:01 +03:00
AnthonyMikh
515262cc13
Ascript type explicitly 2019-10-01 02:53:44 +03:00
AnthonyMikh
61bc38ecaa
Fix errors 2019-10-01 02:38:35 +03:00
AnthonyMikh
e5db5b34d7
(fmt) remove trailing whitespaces 2019-10-01 02:30:52 +03:00
David Wood
04fa9b1b3f
async/await: improve obligation errors
This commit improves obligation errors for async/await:

```
note: future does not implement `std::marker::Send` because this value is used across an
      await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

Signed-off-by: David Wood <david@davidtw.co>
2019-09-30 23:41:20 +01:00
AnthonyMikh
bb442881fc
Use pattern matching instead of indexing tuples 2019-10-01 01:12:36 +03:00
Vadim Petrochenkov
6ea4a52f47 Address review comments 2019-10-01 01:10:12 +03:00
AnthonyMikh
55b54285c8
Simplify a conditional in collect_annotations
Also avoid excessive cloning
2019-10-01 01:08:51 +03:00
Tyler Mandry
913c095bcf
Rollup merge of #64923 - lzutao:improve-doc-needs_drop, r=jonas-schievink
Add missing links for mem::needs_drop

r? @jonas-schievink
2019-09-30 14:38:32 -07:00
Tyler Mandry
e9d28796ec
Rollup merge of #64921 - JohnTitor:add-test-enum, r=varkor
Add test for issue-64662

Closes #64662
r? @varkor
2019-09-30 14:38:31 -07:00
Tyler Mandry
5560f8c664
Rollup merge of #64911 - hman523:64844, r=Dylan-DPC
Fixed a misleading documentation issue #64844

Made the suggested change from @steveklabnik on issue #64844
2019-09-30 14:38:28 -07:00
Tyler Mandry
a8ed9bfe02
Rollup merge of #64893 - SimonSapin:vec-of-option-box, r=sfackler
Zero-initialize `vec![None; n]` for `Option<&T>`, `Option<&mut T>` and `Option<Box<T>>`
2019-09-30 14:38:27 -07:00
Tyler Mandry
1cd9b4bc85
Rollup merge of #64891 - SimonSapin:vec-of-fat-raw-ptr, r=sfackler
Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadata

https://github.com/rust-lang/rust/pull/49496 introduced specialization based on:

```rust
unsafe impl<T: ?Sized> IsZero for *mut T {
    fn is_zero(&self) -> bool {
        (*self).is_null()
    }
}
```

… to call `RawVec::with_capacity_zeroed` for creating `Vec<*mut T>`, which is incorrect for fat pointers since `<*mut T>::is_null` only looks at the data component. That is, a fat pointer can be “null” without being made entirely of zero bits.

This commit fixes it by removing the `?Sized` bound on this impl (and the corresponding `*const T` one). This regresses `vec![x; n]` with `x` a null raw slice of length zero, but that seems exceptionally uncommon. (Vtable pointers are never null, so raw trait objects would not take the fast path anyway.)

An alternative to keep the `?Sized` bound (or even generalize to `impl<U: Copy> IsZero for U`) would be to cast to `&[u8]` of length `size_of::<U>()`, but the optimizer seems not to be able to propagate alignment information and sticks with comparing one byte at a time:

https://rust.godbolt.org/z/xQFkwL

----

Without the library change, the new test fails as follows:

```rust
---- vec::vec_macro_repeating_null_raw_fat_pointer stdout ----
[src/liballoc/tests/vec.rs:1301] ptr_metadata(raw_dyn) = 0x00005596ef95f9a8
[src/liballoc/tests/vec.rs:1306] ptr_metadata(vec[0]) = 0x0000000000000000
thread 'vec::vec_macro_repeating_null_raw_fat_pointer' panicked at 'assertion failed: vec[0] == null_raw_dyn', src/liballoc/tests/vec.rs:1307:5
```
2019-09-30 14:38:25 -07:00
Tyler Mandry
3add9790ab
Rollup merge of #64838 - GuillaumeGomez:long-err-explanation-e0550, r=oli-obk
Add long error explanation for E0550

Part of #61137
2019-09-30 14:38:24 -07:00
Tyler Mandry
686ad4da9e
Rollup merge of #64828 - ecstatic-morse:generic-dataflow-graphviz, r=oli-obk
Graphviz debug output for generic dataflow analysis

A follow up to #64566.

This outputs graphviz diagrams in the generic dataflow engine when `#[rustc_mir(borrowck_graphviz_postflow="suffix.dot")]` is set on an item. This code is based on [`dataflow/graphviz.rs`](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/dataflow/graphviz.rs), but displays different information since there are no "gen"/"kill" sets and transfer functions cannot be coalesced in the generic analysis. As a result, we show the dataflow state at the start and end of each block, as well as the changes resulting from each statement. I also render the state bitset in full  (`{_1,_2}`) instead of hex-encoded as the current renderer does (`06`).
2019-09-30 14:38:22 -07:00
Tyler Mandry
fb8f9b47eb
Rollup merge of #64786 - tmandry:patch-1, r=alexcrichton
Use https for curl when building for linux

I noticed that the dist-x86_64-linux builder uses http to fetch curl and doesn't do any signature verification. It should probably use https.

r? @alexcrichton @Mark-Simulacrum
2019-09-30 14:38:21 -07:00
Tyler Mandry
30ba6fd99c
Rollup merge of #64377 - GuillaumeGomez:E0493, r=estebank
Add long error explanation for E0493

Part of #61137.
2019-09-30 14:38:19 -07:00
AnthonyMikh
9d73176978
Remove redundant .iter_mut() 2019-10-01 00:10:23 +03:00
AnthonyMikh
7a807c5b14
Simplify EmitterWriter::emit_suggestion_default
Make function return early if source map is not present
2019-10-01 00:01:22 +03:00
AnthonyMikh
21724eda05
Update doc comment for style_or_override 2019-09-30 23:50:58 +03:00
AnthonyMikh
7b4c5c62aa
Simplify EmitterWriter::get_max_line_num 2019-09-30 23:47:51 +03:00
AnthonyMikh
6b6a79b190
Simplify EmitterWriter::get_multispan_max_line_num 2019-09-30 23:43:24 +03:00
AnthonyMikh
7dc953b493
Simplify code for special case of annotation 2019-09-30 23:33:17 +03:00
David Wood
870b47fee4
typeck: silence unreachable code from await
This commit silences the unreachable code lint when it originates from
within a await desugaring.

Signed-off-by: David Wood <david@davidtw.co>
2019-09-30 21:27:18 +01:00
Vadim Petrochenkov
957986d056 syntax: Support modern attribute syntax in the meta matcher 2019-09-30 22:58:22 +03:00
Yuki Okushi
9c73131fd0 Add test for #58344 2019-10-01 04:55:46 +09:00
Yuki Okushi
bc25746d48 Add test for #58022 2019-10-01 04:55:29 +09:00
Yuki Okushi
576c215ab9 Add test for #50571 2019-10-01 04:55:12 +09:00
Vadim Petrochenkov
535d4743a4 syntax: Split ast::Attribute into container and inner parts 2019-09-30 22:36:25 +03:00
Vadim Petrochenkov
5ae38bbc7c Stabilize proc macros in type positions 2019-09-30 21:59:35 +03:00
Vadim Petrochenkov
349259d55f Stabilize macros in extern blocks
Add some tests for macros in extern blocks, remove duplicate tests
2019-09-30 21:59:35 +03:00
Dylan MacKenzie
2b8e023b9d Stop printing Qualif results in debug logs
Now we can use the dataflow graphviz debugging.
2019-09-30 11:24:27 -07:00
Dylan MacKenzie
cf5f5c55be Use separate files for debugging Qualif dataflow results 2019-09-30 11:24:27 -07:00
Dylan MacKenzie
cd24cd4eec Update consumers of generic::Engine API 2019-09-30 11:24:27 -07:00
Dylan MacKenzie
d37c318677 Add graphviz debug output for generic dataflow 2019-09-30 11:24:27 -07:00