100622 Commits

Author SHA1 Message Date
Esteban Küber
9ecd1d2767 Simplify code 2019-10-15 13:55:44 -07:00
Esteban Küber
9ed463a740 Do not suggest restriction on spans originating in macros 2019-10-15 13:55:44 -07:00
Esteban Küber
9c525ee95b review comments 2019-10-15 13:55:44 -07:00
Esteban Küber
8cabb42541 Remove trailing whitespace 2019-10-15 13:55:44 -07:00
Esteban Küber
39a9e2ecba Remove useless help 2019-10-15 13:55:44 -07:00
Esteban Küber
ab7d8f0f5a Deduplicate some code and apply review comments 2019-10-15 13:55:44 -07:00
Esteban Küber
bc744bca90 Suggest associated bound restrictions in impls 2019-10-15 13:55:44 -07:00
Esteban Küber
5cc99eed04 Handle missing projection restriction 2019-10-15 13:55:44 -07:00
Esteban Küber
daa8491648 Update NLL tests 2019-10-15 13:55:44 -07:00
Esteban Küber
b81df6b739 Consider trait aliases 2019-10-15 13:55:44 -07:00
Esteban Küber
ca1885de41 Update some tests involving Self 2019-10-15 13:55:43 -07:00
Esteban Küber
99ab45b91d Handle Self restriction needed 2019-10-15 13:55:43 -07:00
Esteban Küber
dbd75c8c40 Handle more cases involving impl and trait 2019-10-15 13:55:43 -07:00
Esteban Küber
5b7ffd9333 Handle more cases 2019-10-15 13:55:43 -07:00
Esteban Küber
190589f8a7 Use structured suggestion for restricting bounds
When a trait bound is not met and restricting a type parameter would
make the restriction hold, use a structured suggestion pointing at an
appropriate place (type param in param list or `where` clause).

Account for opaque parameters where instead of suggesting extending
the `where` clause, we suggest appending the new restriction:
`fn foo(impl Trait + UnmetTrait)`.
2019-10-15 13:55:43 -07:00
bors
237d54ff6c Auto merge of #65433 - Centril:rollup-rzvry15, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #64035 (Stabilize proc macros generating `macro_rules` items)
 - #65376 (syntax: misc extractions)
 - #65426 (Remove custom `PartialEq` impls for `LocalInternedString`.)
 - #65428 (Refactor: Rename `db` locals to `diag`)

Failed merges:

r? @ghost
2019-10-15 15:14:43 +00:00
Mazdak Farrokhzad
8370f14225 Remove unnecessary use crate::sess::ParseSess;. 2019-10-15 13:28:13 +02:00
Mazdak Farrokhzad
96d640971a
Rollup merge of #65428 - phansch:rename_db_var, r=Centril
Refactor: Rename `db` locals to `diag`

https://github.com/rust-lang/rust/pull/64272 replaced `DiagnosticBuilder` with `Diagnostic` in some places. This PR just renames the db variable from `db` to `diag` where it wasn't renamed.

r? @Mark-Simulacrum
2019-10-15 13:27:30 +02:00
Mazdak Farrokhzad
bc3e97a277
Rollup merge of #65426 - nnethercote:rm-custom-LocalInternedString-PartialEq-impls, r=petrochenkov
Remove custom `PartialEq` impls for `LocalInternedString`.

This is on-trend with the recent changes simplifying
`LocalInternedString` and reducing its use.

r? @petrochenkov
2019-10-15 13:27:29 +02:00
Mazdak Farrokhzad
d24c66fba3
Rollup merge of #65376 - Centril:syntax-extractions-1, r=petrochenkov
syntax: misc extractions

Part of https://github.com/rust-lang/rust/pull/65324.

r? @petrochenkov
2019-10-15 13:27:28 +02:00
Mazdak Farrokhzad
19d4e2f3e0
Rollup merge of #64035 - petrochenkov:stabmacgen, r=eddyb
Stabilize proc macros generating `macro_rules` items

Fn-like and attribute proc macros can now generate `macro_rules` items.

cc #54727
2019-10-15 13:27:27 +02:00
bors
437ca55f23 Auto merge of #65412 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/65356.
2019-10-15 11:23:12 +00:00
Mazdak Farrokhzad
ae156a56d4 syntax::parse::sess -> syntax::sess 2019-10-15 09:41:58 +02:00
Mazdak Farrokhzad
79d02867b8 move parse_lit to expr.rs 2019-10-15 09:27:52 +02:00
Mazdak Farrokhzad
52d0e86b9a syntax: extract sess.rs for ParseSess 2019-10-15 09:25:56 +02:00
Mazdak Farrokhzad
c29fe81ec4 move maybe_report_invalid_custom_discriminants to feature_gate 2019-10-15 09:22:13 +02:00
Vadim Petrochenkov
d80be3b4ff Test basic hygiene for macro_rules produced by transparent macros 2019-10-15 10:03:51 +03:00
Vadim Petrochenkov
b39e188dda Stabilize proc macros generating macro_rules items 2019-10-15 10:03:51 +03:00
Philipp Hansch
6c75e81561
Refactor: Rename db locals to diag
https://github.com/rust-lang/rust/pull/64272 replaced
`DiagnosticBuilder` with `Diagnostic` in some places. This commit just
renames the DB variable from `db` to `diag` where it wasn't renamed.
2019-10-15 08:19:43 +02:00
Nicholas Nethercote
57d33b155f Remove custom PartialEq impls for LocalInternedString.
This is on-trend with the recent changes simplifying
`LocalInternedString` and reducing its use.
2019-10-15 14:23:27 +11:00
bors
e369d87b01 Auto merge of #65422 - tmandry:rollup-r5u3mlc, r=tmandry
Rollup of 10 pull requests

Successful merges:

 - #65170 (rustc_metadata: Privatize private code and remove dead code)
 - #65260 (Optimize `LexicalResolve::expansion`.)
 - #65261 (Remove `Option` from `TokenStream`)
 - #65332 (std::fmt: reorder docs)
 - #65340 (Several changes to the codegen backend organization)
 - #65365 (Include const generic arguments in metadata)
 - #65398 (Bring attention to suggestions when the only difference is capitalization)
 - #65410 (syntax: add parser recovery for intersection- / and-patterns `p1 @ p2`)
 - #65415 (Remove an outdated test output file)
 - #65416 (Minor sync changes)

Failed merges:

r? @ghost
2019-10-15 00:54:10 +00:00
Tyler Mandry
9422feb433
Rollup merge of #65416 - spastorino:minor-sync-changes, r=Mark-Simulacrum
Minor sync changes

r? @Mark-Simulacrum
2019-10-14 17:52:45 -07:00
Tyler Mandry
ae5093d62d
Rollup merge of #65415 - petrochenkov:rmtest, r=varkor
Remove an outdated test output file

It was accidentally introduced during some rebase, but it's no longer necessary and `--bless` removes it, but it doesn't fail testing.
2019-10-14 17:52:44 -07:00
Tyler Mandry
1b182371e1
Rollup merge of #65410 - Centril:intersection-pat-recover, r=davidtwco,varkor
syntax: add parser recovery for intersection- / and-patterns `p1 @ p2`

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

The recovery comes in two flavors:

1. We know that `p2` is a binding so we can invert as `p2 @ p1`:

```rust
error: pattern on wrong side of `@`
  --> $DIR/intersection-patterns.rs:13:9
   |
LL |         Some(x) @ y => {}
   |         -------^^^-
   |         |         |
   |         |         binding on the right, should be to the left
   |         pattern on the left, should be to the right
   |         help: switch the order: `y @ Some(x)`
```

2. Otherwise we emit a generic diagnostic for the lack of support for intersection patterns:

```rust
error: left-hand side of `@` must be a binding
  --> $DIR/intersection-patterns.rs:23:9
   |
LL |         Some(x) @ Some(y) => {}
   |         -------^^^-------
   |         |         |
   |         |         also a pattern
   |         interpreted as a pattern, not a binding
   |
   = note: bindings are `x`, `mut x`, `ref x`, and `ref mut x`
```

For more on and-patterns, see e.g. https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/pattern-matching#and-pattern.

r? @davidtwco
cc @varkor @lzutao
2019-10-14 17:52:42 -07:00
Tyler Mandry
a14e35f382
Rollup merge of #65398 - estebank:capitalization-only, r=varkor
Bring attention to suggestions when the only difference is capitalization

CC #65386.
2019-10-14 17:52:41 -07:00
Tyler Mandry
8d1123d808
Rollup merge of #65365 - skinny121:const-args-metadata, r=varkor
Include const generic arguments in metadata

Fixes #64707
Fixes #61624
Fixes #64730

r? @varkor
2019-10-14 17:52:39 -07:00
Tyler Mandry
6241a4a108
Rollup merge of #65340 - bjorn3:cg_ssa_refactor4, r=eddyb
Several changes to the codegen backend organization

* Split functions from values in cg_ssa `BackendTypes`.
* Remove `is_const_integral` function from `ConstMethods`.
* Actually register the invalid monomorphization of intrinsic long diagnostic and remove the `diagnostics` method from `CodegenBackends`, as it was unused.
* Add cg_ssa and cg_utils provided methods to `default_provide`, so codegen backend don't have to do it themself.
2019-10-14 17:52:38 -07:00
Tyler Mandry
e38639fe12
Rollup merge of #65332 - RalfJung:fmt, r=cramertj
std::fmt: reorder docs

This moves the "Formatting Parameters" section up above right after the discussion of named and positional arguments. Then comes the "Syntax" section, summarizing the discussion of format string syntax.
And only *then* we get to "Formatting Traits" -- that section has some *huge* code examples, so it really should not interrupt the discussion of the grammar. Also users are much more likely to come here to learn about the format string grammar than to come here to learn about the `Binary` trait.
2019-10-14 17:52:37 -07:00
Tyler Mandry
6d28ed1ae6
Rollup merge of #65261 - nnethercote:rm-Option-from-TokenStream, r=petrochenkov
Remove `Option` from `TokenStream`

A code simplification.

r? @petrochenkov
2019-10-14 17:52:35 -07:00
Tyler Mandry
a9a4d4033d
Rollup merge of #65260 - nnethercote:optimize-LexicalResolve-expansion, r=nikomatsakis
Optimize `LexicalResolve::expansion`.

A win for `unicode_normalization`.

r? @nikomatsakis
2019-10-14 17:52:33 -07:00
Tyler Mandry
d2f87e384f
Rollup merge of #65170 - petrochenkov:cload, r=eddyb
rustc_metadata: Privatize private code and remove dead code

Also some minor cleanup and documentation improvements.

r? @eddyb
2019-10-14 17:52:32 -07:00
Esteban Küber
8bf6d35377 Tweak heuristics for less noise 2019-10-14 14:48:45 -07:00
Esteban Küber
6dd718ca79 Use heuristics for capitalization warning in suggestions 2019-10-14 14:32:10 -07:00
Santiago Pastorino
b9bc431bd2
Rename serial_join and serial_scope to join and scope 2019-10-14 18:05:07 -03:00
Santiago Pastorino
83560225ad
Move serial_scope and serial_join to parallel_compiler = false 2019-10-14 18:05:07 -03:00
Santiago Pastorino
068a8d163c
Minor comment tweaks 2019-10-14 18:05:07 -03:00
Vadim Petrochenkov
34bcfcabcc Remove an outdated test output file 2019-10-14 21:35:49 +03:00
ben
eb68bbb2b0 Include const generic arguments in metadata. 2019-10-15 07:24:19 +13:00
Mazdak Farrokhzad
16266a5405 pprust: p1@p2 -> p1 @ p2 2019-10-14 18:12:04 +02:00
Mazdak Farrokhzad
3a9f8deb1d recover_intersection_pat: adjust wording 2019-10-14 18:02:49 +02:00