Commit Graph

107616 Commits

Author SHA1 Message Date
Dylan MacKenzie
52ad1e73ce Don't bug when taking discriminant of generator 2020-02-28 12:07:20 -08:00
Esteban Küber
2fb35adc48 Ignore output for some platforms with diverging test output
Get around #53081.
2020-02-28 12:01:29 -08:00
Esteban Küber
a9a99df0a2 Do not suggest implementing traits if present in predicates 2020-02-28 11:37:59 -08:00
Esteban Küber
61bc7a3462 Reword message 2020-02-28 11:37:59 -08:00
Esteban Küber
a29f6916d8 Reduce verbosity when suggesting restricting type params 2020-02-28 11:37:59 -08:00
Esteban Küber
c764a82310 keep predicate order and tweak output 2020-02-28 11:37:59 -08:00
Esteban Küber
7c29441ef2 Review comments: split requirement text to multiple lines for readability 2020-02-28 11:37:59 -08:00
Esteban Küber
01286408c1 Account for arbitrary self types in E0599 2020-02-28 11:37:59 -08:00
Esteban Küber
392d853589 Suggest constraining type parameters 2020-02-28 11:37:59 -08:00
Esteban Küber
1e7bcc733a Tweak wording 2020-02-28 11:37:59 -08:00
Esteban Küber
0387f0d19b Mention the full path of the implementing trait 2020-02-28 11:37:59 -08:00
Esteban Küber
89e96e9bc5 Point at closure definitions 2020-02-28 11:37:59 -08:00
Esteban Küber
9a64c3f5cb Show information of chain of bound obligations
When the obligation that couldn't be fulfilled is specific to a nested
obligation, maintain both the nested and parent obligations around for
more accurate and detailed error reporting.
2020-02-28 11:37:59 -08:00
Esteban Küber
8119d0853d Track all predicates in errors, not just trait obligations
Surface associated type projection bounds that could not be fulfilled in
E0599 errors. Always present the list of unfulfilled trait bounds,
regardless of whether we're pointing at the ADT or trait that didn't
satisfy it.
2020-02-28 11:37:59 -08:00
Esteban Küber
ad4777dbca Deduplicate information in E0599 2020-02-28 11:37:59 -08:00
Esteban Küber
8993b99ae2 On single local candidate, use span label 2020-02-28 11:37:58 -08:00
Esteban Küber
5e8707f39d Reduce vebosity of E0599 2020-02-28 11:37:58 -08:00
Esteban Küber
f037d5ca1b Add more context to E0599 errors
Point at the intermediary unfullfilled trait bounds.
2020-02-28 11:37:58 -08:00
bors
0eb878d2aa Auto merge of #69555 - Centril:rollup-e53lxz4, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #68989 (Update RELEASES.md for 1.42.0)
 - #69340 (instantiate_value_path: on `SelfCtor`, avoid unconstrained tyvars)
 - #69384 (parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`)
 - #69452 (typeck: use `Pattern` obligation cause more for better diagnostics)
 - #69481 (use char instead of &str for single char patterns)
 - #69522 (error_derive_forbidden_on_non_adt: be more graceful)
 - #69538 (Stabilize `boxed_slice_try_from`)
 - #69539 (late resolve, visit_fn: bail early if there's no body.)
 - #69541 (Remove unneeded calls to format!())
 - #69547 (remove redundant clones, references to operands, explicit boolean comparisons and filter(x).next() calls.)

Failed merges:

r? @ghost
2020-02-28 17:53:10 +00:00
Matthias Krüger
1622b6ef73 simplify condition in start_executing_work() 2020-02-28 18:09:29 +01:00
Mazdak Farrokhzad
13e4c6c51f
Rollup merge of #69547 - matthiaskrgr:more_misc, r=Mark-Simulacrum
remove redundant clones, references to operands, explicit boolean comparisons and filter(x).next() calls.
2020-02-28 17:17:38 +01:00
Mazdak Farrokhzad
61b091b440
Rollup merge of #69541 - dotdash:format, r=Mark-Simulacrum
Remove unneeded calls to format!()
2020-02-28 17:17:36 +01:00
Mazdak Farrokhzad
b95945c8d6
Rollup merge of #69539 - Centril:fix-69401, r=petrochenkov
late resolve, visit_fn: bail early if there's no body.

Fixes https://github.com/rust-lang/rust/issues/69401 which was injected by b2c6eeb713 in https://github.com/rust-lang/rust/pull/68788.

r? @petrochenkov
2020-02-28 17:17:34 +01:00
Mazdak Farrokhzad
e4cedc9df2
Rollup merge of #69538 - JohnTitor:boxed-slice-try-from, r=Centril
Stabilize `boxed_slice_try_from`

Closes #69202
2020-02-28 17:17:33 +01:00
Mazdak Farrokhzad
87cc521b02
Rollup merge of #69522 - Centril:fix-69341, r=petrochenkov
error_derive_forbidden_on_non_adt: be more graceful

Fixes #69341 which was injected by #67052.

r? @petrochenkov
2020-02-28 17:17:31 +01:00
Mazdak Farrokhzad
07d9ed2c09
Rollup merge of #69481 - matthiaskrgr:single_char, r=ecstatic-morse
use char instead of &str for single char patterns
2020-02-28 17:17:30 +01:00
Mazdak Farrokhzad
a245221497
Rollup merge of #69452 - Centril:typeck-pat, r=estebank
typeck: use `Pattern` obligation cause more for better diagnostics

r? @estebank
2020-02-28 17:17:28 +01:00
Mazdak Farrokhzad
3828fa2852
Rollup merge of #69384 - petrochenkov:nounnorm, r=Centril
parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`

So, after https://github.com/rust-lang/rust/pull/69006, its follow-ups and an attempt to remove `Parser::prev_span` I came to the conclusion that the unnormalized token and its span is what you want in most cases, so it should be default.

Normalization only makes difference in few cases where we are checking against `token::Ident` or `token::Lifetime` specifically.
This PR uses `normalized_token` for those cases.

Using normalization explicitly means that people writing code should remember about `NtIdent` and `NtLifetime` in general. (That is alleviated by the fact that `token.ident()` and `fn parse_ident_*` are already written.)
Remembering about `NtIdent`, was, however, already the case, kind of, because the implicit normalization was performed only for the current/previous token, but not for things like `look_ahead`.
As a result, most of token classification methods in `token.rs` already take `NtIdent` into account (this PR fixes a few pre-existing minor mistakes though).

The next step is removing `normalized(_prev)_token` entirely and replacing it with `token.ident()` (mostly) and `token.normalize()` (occasionally).
I want to make it a separate PR for that and run it though perf.
`normalized_token` filled on every bump has both a potential to avoid repeated normalization, and to do unnecessary work in advance (it probably doesn't matter anyway, the normalization is very cheap).

r? @Centril
2020-02-28 17:17:26 +01:00
Mazdak Farrokhzad
76fe449282
Rollup merge of #69340 - Centril:self-ctor-normalize, r=nikomatsakis
instantiate_value_path: on `SelfCtor`, avoid unconstrained tyvars

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

On `Self(...)` (that is, a `Res::SelfCtor`), do not use `self.impl_self_ty(...)`. The problem with that method is that it creates unconstrained inference variables for type parameters in the `impl` (e.g. `impl<T> S0<T>`). These variables then eventually get substituted for something else when they come in contact with the expected type (e.g. `S0<u8>`) or merely the arguments passed to the tuple constructor (e.g. the `0` in `Self(0)`).

Instead of using `self.impl_self_ty(...)`, we instead merely use `let ty = self.normalize_ty(span, tcx.at(span).type_of(impl_def_id));` to get the rewritten `res`.

r? @eddyb
2020-02-28 17:17:25 +01:00
Mazdak Farrokhzad
bbf6eec281
Rollup merge of #68989 - XAMPPRocky:relnotes-1.42.0, r=Mark-Simulacrum
Update RELEASES.md for 1.42.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.42.0/RELEASES.md)

r? @Mark-Simulacrum
cc @rust-lang/release
2020-02-28 17:17:23 +01:00
Guillaume Gomez
e2738285ea Wording improvement 2020-02-28 16:01:04 +01:00
Guillaume Gomez
8ce9460b7a Update UI tests 2020-02-28 16:01:04 +01:00
Guillaume Gomez
f439de36af Add explanation for E0747 2020-02-28 16:01:04 +01:00
Guillaume Gomez
bae5f3976b Add E0747 error code 2020-02-28 16:01:04 +01:00
bors
eaa02f599f Auto merge of #69148 - estebank:cold-as-ice, r=oli-obk
Account for bounds and asociated items when denying `_`

Fix #68801, #69204. Follow up to #67597 and #68071.

Output for the original ICE report:

```
    Checking vinoteca v5.0.0 (/Users/ekuber/workspace/vinoteca)
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
  --> src/producers.rs:43:70
   |
43 | pub fn top<Table: diesel::Table + diesel::query_dsl::InternalJoinDsl<_, diesel::query_source::joins::Inner, _>>(table: Table, limit: usize, connection: DbConn) -> RestResult<Vec<TopWineType>> {
   |                                                                      ^ not allowed in type signatures       ^ not allowed in type signatures

error: aborting due to previous error
```
2020-02-28 14:24:57 +00:00
Matthias Krüger
9523c89f18 use is_empty() instead of len() == x to determine if structs are empty. 2020-02-28 15:16:27 +01:00
Mateusz Mikuła
3713ed67fd Improve MinGW detection when cross compiling 2020-02-28 14:15:06 +01:00
Matthias Krüger
ff9341a9e3 remove redundant clones, references to operands, explicit boolean comparisons and filter(x).next() calls. 2020-02-28 13:45:30 +01:00
Matthias Krüger
0c5d497603 use to_vec() instead of .iter().cloned().collect() to convert slices to vecs. 2020-02-28 13:21:25 +01:00
Remy Rakic
1b0bb35ca3 Unrevert "Remove checked_add in Layout::repeat" 2020-02-28 12:22:28 +01:00
Pulkit Goyal
299a0d559f docs: add mention of async blocks in move keyword docs
Fixes #69298
2020-02-28 16:47:29 +05:30
bors
e2223c94bf Auto merge of #68827 - ssomers:btree_navigation_revisited, r=Mark-Simulacrum
BTreeMap navigation done safer & faster

It turns out that there was a faster way to do the tree navigation code bundled in #67073, by moving from edge to KV and from KV to next edge separately. It extracts most of the code as safe functions, and contains the duplication of handles within the short wrapper functions.

This somehow hits a sweet spot in the compiler because it reports boosts all over the board:
```
>cargo benchcmp pre3.txt posz4.txt --threshold 5
 name                                           pre3.txt ns/iter  posz4.txt ns/iter  diff ns/iter   diff %  speedup
 btree::map::first_and_last_0                   40                37                           -3   -7.50%   x 1.08
 btree::map::first_and_last_100                 58                44                          -14  -24.14%   x 1.32
 btree::map::iter_1000                          8,920             3,419                    -5,501  -61.67%   x 2.61
 btree::map::iter_100000                        1,069,290         411,615                -657,675  -61.51%   x 2.60
 btree::map::iter_20                            169               58                         -111  -65.68%   x 2.91
 btree::map::iter_mut_1000                      8,701             3,303                    -5,398  -62.04%   x 2.63
 btree::map::iter_mut_100000                    1,034,560         405,975                -628,585  -60.76%   x 2.55
 btree::map::iter_mut_20                        165               58                         -107  -64.85%   x 2.84
 btree::set::clone_100                          1,831             1,562                      -269  -14.69%   x 1.17
 btree::set::clone_100_and_clear                1,831             1,565                      -266  -14.53%   x 1.17
 btree::set::clone_100_and_into_iter            1,917             1,541                      -376  -19.61%   x 1.24
 btree::set::clone_100_and_pop_all              2,609             2,441                      -168   -6.44%   x 1.07
 btree::set::clone_100_and_remove_all           4,598             3,927                      -671  -14.59%   x 1.17
 btree::set::clone_100_and_remove_half          2,765             2,551                      -214   -7.74%   x 1.08
 btree::set::clone_10k                          191,610           164,616                 -26,994  -14.09%   x 1.16
 btree::set::clone_10k_and_clear                192,003           164,616                 -27,387  -14.26%   x 1.17
 btree::set::clone_10k_and_into_iter            200,037           163,010                 -37,027  -18.51%   x 1.23
 btree::set::clone_10k_and_pop_all              267,023           250,913                 -16,110   -6.03%   x 1.06
 btree::set::clone_10k_and_remove_all           536,230           464,100                 -72,130  -13.45%   x 1.16
 btree::set::clone_10k_and_remove_half          453,350           430,545                 -22,805   -5.03%   x 1.05
 btree::set::difference_random_100_vs_100       1,787             801                        -986  -55.18%   x 2.23
 btree::set::difference_random_100_vs_10k       2,978             2,696                      -282   -9.47%   x 1.10
 btree::set::difference_random_10k_vs_100       111,075           54,734                  -56,341  -50.72%   x 2.03
 btree::set::difference_random_10k_vs_10k       246,380           175,980                 -70,400  -28.57%   x 1.40
 btree::set::difference_staggered_100_vs_100    1,789             951                        -838  -46.84%   x 1.88
 btree::set::difference_staggered_100_vs_10k    2,798             2,606                      -192   -6.86%   x 1.07
 btree::set::difference_staggered_10k_vs_10k    176,452           97,401                  -79,051  -44.80%   x 1.81
 btree::set::intersection_100_neg_vs_10k_pos    34                32                           -2   -5.88%   x 1.06
 btree::set::intersection_100_pos_vs_100_neg    30                27                           -3  -10.00%   x 1.11
 btree::set::intersection_random_100_vs_100     1,537             613                        -924  -60.12%   x 2.51
 btree::set::intersection_random_100_vs_10k     2,793             2,649                      -144   -5.16%   x 1.05
 btree::set::intersection_random_10k_vs_10k     222,127           147,166                 -74,961  -33.75%   x 1.51
 btree::set::intersection_staggered_100_vs_100  1,447             622                        -825  -57.01%   x 2.33
 btree::set::intersection_staggered_100_vs_10k  2,606             2,382                      -224   -8.60%   x 1.09
 btree::set::intersection_staggered_10k_vs_10k  143,620           58,790                  -84,830  -59.07%   x 2.44
 btree::set::is_subset_100_vs_100               1,349             488                        -861  -63.83%   x 2.76
 btree::set::is_subset_100_vs_10k               1,720             1,428                      -292  -16.98%   x 1.20
 btree::set::is_subset_10k_vs_10k               135,984           48,527                  -87,457  -64.31%   x 2.80
```
The `first_and_last` ones are noise (they don't do iteration), the others seem genuine.
As always, approved by Miri.

Also, a separate commit with some more benchmarks of mutable behaviour (which also benefit).

r? @cuviper
2020-02-28 09:32:34 +00:00
Mazdak Farrokhzad
85b585daaf late resolve, visit_fn: bail early if there's no body. 2020-02-28 07:58:37 +01:00
bors
bfc32dd106 Auto merge of #68505 - skinny121:canonicalize-const-eval-inputs, r=nikomatsakis
Canonicalize inputs to const eval where needed

Canonicalize inputs to const eval, so that they can contain inference variables. Which enables invoking const eval queries even if the current param env has inference variable within it, which can occur during trait selection.

This is a reattempt of #67717, in a far less invasive way.

Fixes #68477

r? @nikomatsakis
cc @eddyb
2020-02-28 06:14:52 +00:00
Yuki Okushi
4e0bea326e Stabilize boxed_slice_try_from 2020-02-28 13:28:09 +09:00
bors
7497d93ef1 Auto merge of #69534 - Dylan-DPC:rollup-fwa2lip, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #69379 (Fail on multiple declarations of `main`.)
 - #69430 (librustc_typeck: remove loop that never actually loops)
 - #69449 (Do not ping PR reviewers in toolstate breakage)
 - #69491 (rustc_span: Add `Symbol::to_ident_string` for use in diagnostic messages)
 - #69495 (don't take redundant references to operands)
 - #69496 (use find(x) instead of filter(x).next())
 - #69501 (note that find(f) is equivalent to filter(f).next() in the docs.)
 - #69527 (Ignore untracked paths when running `rustfmt` on repository.)
 - #69529 (don't use .into() to convert types into identical types.)

Failed merges:

r? @ghost
2020-02-28 02:19:31 +00:00
Dylan DPC
02b96b3ecc
Rollup merge of #69529 - matthiaskrgr:clippy_identity_conversion, r=Mark-Simulacrum
don't use .into() to convert types into identical types.

This removes redundant `.into()` calls.

example: `let s: String = format!("hello").into();`
2020-02-28 01:55:49 +01:00
Dylan DPC
4c9e44fc5f
Rollup merge of #69527 - pnkfelix:issue-69291-dont-run-rustfmt-on-untracked-paths, r=Mark-Simulacrum
Ignore untracked paths when running `rustfmt` on repository.

This is a step towards resolving #69291

(It might be the only step necessary at the moment; I'm not yet sure.)
2020-02-28 01:55:48 +01:00
Dylan DPC
0291b6a289
Rollup merge of #69501 - matthiaskrgr:find_note, r=ecstatic-morse
note that find(f) is equivalent to filter(f).next() in the docs.

r? @ecstatic-morse
2020-02-28 01:55:46 +01:00
Dylan DPC
5b32dd034e
Rollup merge of #69496 - matthiaskrgr:filter_next, r=ecstatic-morse
use find(x) instead of filter(x).next()
2020-02-28 01:55:45 +01:00