Commit Graph

107703 Commits

Author SHA1 Message Date
Ralf Jung
63c77f1bd0 remove ScalarMaybeUndef::to_bits and make Scalar::to_bits private 2020-02-28 16:07:12 +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
Ralf Jung
1fec68277a remove check_raw after reducing it to one use only 2020-02-28 09:34:35 +01:00
Ralf Jung
e9ab099d6f get rid of to_ptr 2020-02-28 09:28:30 +01:00
Ralf Jung
f9644c16f3 add comment to check_data 2020-02-28 09:27:30 +01: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
Dylan DPC
b19e822b9b
Rollup merge of #69495 - matthiaskrgr:op_ref, r=oli-obk
don't take redundant references to operands
2020-02-28 01:55:43 +01:00
Dylan DPC
ffe4af5711
Rollup merge of #69491 - petrochenkov:symprint, r=Mark-Simulacrum
rustc_span: Add `Symbol::to_ident_string` for use in diagnostic messages

Covers the same error reporting use case (https://github.com/rust-lang/rust/pull/69387#discussion_r382999205) as the `Display` impl for `Ident`.
cc https://github.com/rust-lang/rust/issues/69053

Follow-up to https://github.com/rust-lang/rust/pull/69387.
r? @Mark-Simulacrum
2020-02-28 01:55:42 +01:00
Dylan DPC
ab45408a4c
Rollup merge of #69449 - JohnTitor:toolstate-ping, r=Mark-Simulacrum
Do not ping PR reviewers in toolstate breakage

As per https://github.com/rust-lang/rust/issues/69419#issuecomment-590470520

We should also remove author part?
2020-02-28 01:55:40 +01:00
Dylan DPC
84f5bcc41d
Rollup merge of #69430 - matthiaskrgr:noloop, r=varkor
librustc_typeck: remove loop that never actually loops
2020-02-28 01:55:39 +01:00
Dylan DPC
350491da19
Rollup merge of #69379 - jumbatm:llvm-sigsegv, r=pnkfelix
Fail on multiple declarations of `main`.

Closes #67946.

Previously, when inserting the entry function, we only checked for
duplicate _definitions_ of `main`.  However, it's possible to cause
problems even only having a duplicate _declaration_. For example,
shadowing `main` using an extern block isn't caught by the current
check, and causes an assertion failure down the line in in LLVM code.

r? @pnkfelix
2020-02-28 01:55:35 +01:00
Stein Somers
9f7b58f3c9 Make implementation of navigation simpler, safer and faster 2020-02-28 01:06:23 +01:00
Esteban Küber
c6cfcf999a Account for associated items when denying _ 2020-02-27 15:59:27 -08:00
Esteban Küber
a7b727dab3 Account for bounds when denying _ in type parameters 2020-02-27 15:59:26 -08:00
Esteban Küber
e6c85960d1 Revert "Backport only: avoid ICE on bad placeholder type"
This reverts commit 1cb555a1dc.
2020-02-27 15:59:08 -08:00
Stein Somers
4f6661a18d Fix and test implementation of BTreeMap's first_entry, last_entry, pop_first, pop_last 2020-02-28 00:13:32 +01:00
bors
fbc46b7d71 Auto merge of #69513 - tmiasko:revert-checked-unused, r=petrochenkov
Revert "Mark attributes consumed by `check_mod_attrs` as normal"

This reverts commit d78b22f35e.

Those changes were incompatible with incremental compilation since the
effect `check_mod_attrs` has with respect to marking the attributes as
used is neither persisted nor recomputed.
2020-02-27 23:04:51 +00:00
Matthias Krüger
7be94a8a95 don't use .into() to convert types into identical types.
example:
    let s: String = format!("hello").into();
2020-02-27 23:32:46 +01:00
Felix S. Klock II
cac4eeee24 Ignore untracked paths when running rustfmt on repository. 2020-02-27 15:52:09 -05:00
Albin Stjerna
6f40cdb380 - polonius: adapt to the new fact format
- update polonius-engine dependency to 0.12.0

- rustfmt the files failing tidy
2020-02-27 21:17:12 +01:00
Mazdak Farrokhzad
13d42f4784 error_derive_forbidden_on_non_adt: be more graceful 2020-02-27 20:09:14 +01:00
Dylan MacKenzie
75d256fc61 Remove now unused GenKill impl for old GenKillSet 2020-02-27 10:54:07 -08:00
Dylan MacKenzie
e1f8a22271 Rename RequiresStorage to MaybeRequiresStorage
...to be consistent with the naming of other dataflow analyses.
2020-02-27 10:54:07 -08:00
Dylan MacKenzie
ecad4341af Port RequiresStorage to new dataflow framework 2020-02-27 10:54:05 -08:00
Dylan MacKenzie
6d7ce880aa Add inherent visit_with method to dataflow::Results
This is more ergonomic than importing `dataflow::visit_results`
2020-02-27 10:53:00 -08:00
Dylan MacKenzie
5fa2c9e799 Port MaybeStorageLive to new dataflow framework 2020-02-27 10:53:00 -08:00
bors
6d69caba11 Auto merge of #68434 - varkor:astconv-mismatch-error, r=nikomatsakis
Move generic arg/param validation to `create_substs_for_generic_args` to resolve various const generics issues

This changes some diagnostics, but I think they're around as helpful as the previous ones, and occur infrequently regardless.

Fixes https://github.com/rust-lang/rust/issues/68257.
Fixes https://github.com/rust-lang/rust/issues/68398.

r? @eddyb
2020-02-27 18:38:19 +00:00
bors
49c68bd53f Auto merge of #68528 - ecstatic-morse:maybe-init-variants, r=oli-obk
Mark other variants as uninitialized after switch on discriminant

During drop elaboration, which builds the drop ladder that handles destruction during stack unwinding, we attempt to remove MIR `Drop` terminators that will never be reached in practice. This reduces the number of basic blocks that are passed to LLVM, which should improve performance. In #66753, a user pointed out that unreachable `Drop` terminators are common in functions like `Option::unwrap`, which move out of an `enum`. While discussing possible remedies for that issue, @eddyb suggested moving const-checking after drop elaboration. This would allow the former, which looks for `Drop` terminators and replicates a small amount of drop elaboration to determine whether a dropped local has been moved out, leverage the work done by the latter.

However, it turns out that drop elaboration is not as precise as it could be when it comes to eliminating useless drop terminators. For example, let's look at the code for `unwrap_or`.

```rust
fn unwrap_or<T>(opt: Option<T>, default: T) -> T {
    match opt {
        Some(inner) => inner,
        None => default,
    }
}
```

`opt` never needs to be dropped, since it is either moved out of (if it is `Some`) or has no drop glue (if it is `None`), and `default` only needs to be dropped if `opt` is `Some`. This is not reflected in the MIR we currently pass to codegen.

![pasted_image](https://user-images.githubusercontent.com/29463364/73384403-109a0d80-4280-11ea-8500-0637b368f2dc.png)

@eddyb also suggested the solution to this problem. When we switch on an enum discriminant, we should be marking all fields in other variants as definitely uninitialized. I implemented this on top of alongside a small optimization (split out into #68943) that suppresses drop terminators for enum variants with no fields (e.g. `Option::None`). This is the resulting MIR for `unwrap_or`.

![after](https://user-images.githubusercontent.com/29463364/73384823-e432c100-4280-11ea-84bd-d0bcc3b777b4.png)

In concert with #68943, this change speeds up many [optimized and debug builds](https://perf.rust-lang.org/compare.html?start=d55f3e9f1da631c636b54a7c22c1caccbe4bf0db&end=0077a7aa11ebc2462851676f9f464d5221b17d6a). We need to carefully investigate whether I have introduced any miscompilations before merging this. Code that never drops anything would be very fast indeed until memory is exhausted.
2020-02-27 15:17:47 +00:00
Björn Steinbrink
c1de0b1b70 Remove unneeded calls to format!() 2020-02-27 15:25:19 +01:00
Matthias Krüger
31b9764a14 docs: note that find(f) is equivalent to filter(f).next() in the iterator docs. 2020-02-27 15:08:21 +01:00
Matthias Krüger
b6f0567450 librustc_typeck: remove loop that never actually loops 2020-02-27 15:01:56 +01:00
Matthias Krüger
7c84ba1124 use char instead of &str for single char patterns 2020-02-27 14:57:22 +01:00