Commit Graph

107616 Commits

Author SHA1 Message Date
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
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
Matthias Krüger
896a081442 use find(x) instead of filter(x).next() 2020-02-27 14:50:54 +01:00
Ralf Jung
8d3b3063f6 avoid a negation in is_nonoverlapping 2020-02-27 09:45:32 +01:00
Ralf Jung
d1d0de94db disable debug assertion in ptr::write for now 2020-02-27 09:43:33 +01:00
bors
a8437cf213 Auto merge of #69507 - JohnTitor:rollup-jqf1gmw, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #69324 (Backport only: avoid ICE on bad placeholder type)
 - #69439 (resolve: `lifetimes.rs` -> `late/lifetimes.rs`)
 - #69473 (update llvm to silence gcc 9 warnings)
 - #69479 (clarify operator precedence)
 - #69480 (Clean up E0373 explanation)
 - #69500 (Simplify the signature of par_for_each_in)
 - #69505 (Enable setting diagnostic labels)

Failed merges:

r? @ghost
2020-02-27 08:29:24 +00:00
Yuki Okushi
c384acec29
Rollup merge of #69505 - Mark-Simulacrum:triagebot-diag-labels, r=Centril
Enable setting diagnostic labels
2020-02-27 14:38:11 +09:00
Yuki Okushi
7824a9d47d
Rollup merge of #69500 - cuviper:par_for_each_in-item, r=Mark-Simulacrum
Simplify the signature of par_for_each_in

Given `T: IntoIterator`/`IntoParallelIterator`, `T::Item` is
unambiguous, so we don't need the explicit trait casting.
2020-02-27 14:38:09 +09:00
Yuki Okushi
6e66bfd4cc
Rollup merge of #69480 - GuillaumeGomez:clean-up-e0373, r=Dylan-DPC
Clean up E0373 explanation

r? @Dylan-DPC
2020-02-27 14:38:08 +09:00
Yuki Okushi
d4700a83ce
Rollup merge of #69479 - matthiaskrgr:op_pred, r=Dylan-DPC
clarify operator precedence
2020-02-27 14:38:06 +09:00
Yuki Okushi
4cc0295be5
Rollup merge of #69473 - contrun:update-llvm, r=nikomatsakis
update llvm to silence gcc 9 warnings

Closes https://github.com/rust-lang/rust/issues/69078
2020-02-27 14:38:05 +09:00
Yuki Okushi
0d66c7c34c
Rollup merge of #69439 - petrochenkov:latelife, r=matthewjasper
resolve: `lifetimes.rs` -> `late/lifetimes.rs`

Lifetime resolution should ideally be merged into the late resolution pass, at least for named lifetimes.
Let's move it closer to it for a start.
2020-02-27 14:38:03 +09:00
Yuki Okushi
add9338673
Rollup merge of #69324 - estebank:ice-break-backport-bad-placeholder-type, r=Centril
Backport only: avoid ICE on bad placeholder type

 #69148 has a proper fix, but it is too big to backport.
This change avoids the ICE by actually emitting an appropriate error. The
output will be duplicated in some cases, but that's better than the
avoidable ICE.

r? @Centril
2020-02-27 14:38:02 +09:00
bors
d28560e660 Auto merge of #67332 - matthewjasper:drop-in-place-cgus, r=michaelwoerister
Don't instantiate so many copies of drop_in_place

Split out from #66703.

r? @ghost
2020-02-27 04:51:34 +00:00
Mark Rousskov
2c7c4460bb Enable setting diagnostic labels 2020-02-26 20:54:13 -05:00
Michael Mc Donnell
290ed0297f Use assert_ne in hash tests
The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
2020-02-26 17:34:56 -08:00
Tomasz Miąsko
34f83942f9 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 00:00:00 +00:00
Josh Stone
3d47ebeb0e Simplify the signature of par_for_each_in
Given `T: IntoIterator`/`IntoParallelIterator`, `T::Item` is
unambiguous, so we don't need the explicit trait casting.
2020-02-26 15:08:21 -08:00
Matthias Krüger
280e381b8d don't take redundant references to operands 2020-02-26 22:42:29 +01:00
bors
0c15adc530 Auto merge of #67742 - mark-i-m:describe-it, r=matthewjasper
Generalized article_and_description

r? @matthewjasper

The logic of finding the right word and article to print seems to be repeated elsewhere... this is an experimental method to unify this logic...
2020-02-26 20:50:56 +00:00
XAMPPRocky
526280a853
Merge branch 'master' into relnotes-1.42.0 2020-02-26 21:39:30 +01:00
Matthew Jasper
b944531146 Update codegen-units tests 2020-02-26 19:45:46 +00:00
Vadim Petrochenkov
6ce5ab6a7e rustc_span: Add Symbol::to_ident_string for use in diagnostic messages 2020-02-26 22:02:43 +03:00
Mazdak Farrokhzad
6672a04718 instantiate_value_path: .impl_self_ty -> .type_of 2020-02-26 19:25:48 +01:00
bors
abc3073c92 Auto merge of #69484 - Dylan-DPC:rollup-j6ripxy, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #68712 (Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference)
 - #69209 (Miscellaneous cleanup to formatting)
 - #69381 (Allow getting `no_std` from the config file)
 - #69434 (rustc_metadata: Use binary search from standard library)
 - #69447 (Minor refactoring of statement parsing)

Failed merges:

r? @ghost
2020-02-26 16:01:21 +00:00
Dylan DPC
ae383e2af8
Rollup merge of #69447 - Centril:minor-stmt-refactor, r=estebank
Minor refactoring of statement parsing

Extracted out of https://github.com/rust-lang/rust/pull/69445.

r? @estebank
2020-02-26 15:34:35 +01:00
Dylan DPC
c0760279b3
Rollup merge of #69434 - petrochenkov:metabs, r=Mark-Simulacrum
rustc_metadata: Use binary search from standard library

instead of a hand rolled one.

Noticed while reviewing https://github.com/rust-lang/rust/pull/68941.
2020-02-26 15:34:33 +01:00