109279 Commits

Author SHA1 Message Date
Dylan DPC
6b6c470bee
Rollup merge of #69887 - GuillaumeGomez:cleanup-e0404, r=Dylan-DPC
clean up E0404 explanation

r? @Dylan-DPC
2020-03-27 15:09:54 +01:00
Dylan DPC
87fdf35572
Rollup merge of #65222 - Lucretiel:fold_self, r=kodrAus
Proposal: `fold_self` and `try_fold_self` for Iterators

This pull request proposes & implements two new methods on Iterators: `fold_self` and `try_fold_self`. These are variants of `fold` and `try_fold` that use the first element in the iterator as the initial accumulator.

Let me know if a public feature like this requires an RFC, or if this pull request is sufficient as place for discussion.
2020-03-27 15:09:48 +01:00
Guillaume Gomez
88100baa2c clean up E0404 explanation 2020-03-27 15:04:16 +01:00
PankajChaudhary5
0d90612952 Refactor changes 2020-03-27 19:16:32 +05:30
bors
0a2df62073 Auto merge of #69916 - oli-obk:mir_bless, r=eddyb
Enable blessing of mir opt tests

cc @rust-lang/wg-mir-opt
cc @RalfJung

Long overdue, but now you can finally just add a

```rust
// EMIT_MIR rustc.function_name.MirPassName.before.mir
```

(or `after.mir` since most of the time you want to know the MIR after a pass). A `--bless` invocation will automatically create the files for you.

I suggest we do this for all mir opt tests that have all of the MIR in their source anyway

If you use `rustc.function.MirPass.diff` you only get the diff that the MIR pass causes on the MIR.

Fixes #67865
2020-03-27 12:58:34 +00:00
Guillaume Gomez
346bc41086 Clean up E0463 explanation 2020-03-27 13:35:00 +01:00
bors
697d6b3f3f Auto merge of #70282 - ssomers:btreemap_gdb_pretty_print, r=Mark-Simulacrum
Test and fix gdb pretty printing more

Over time I had oversimplified the test case for #68098: it does not have an internal node to print so it did not test what it pretended to test. And then I also realized not spotting the same mistake reviewing #70111, and more likely to occur in the wild. Now, both test cases fail if you put back the flawed python code.

r? @Mark-Simulacrum
2020-03-27 09:54:02 +00:00
Mazdak Farrokhzad
2ddc35997c address some review comments 2020-03-27 09:29:38 +01:00
Camille GILLOT
2d7bbda966 Implement HashStable directly. 2020-03-27 08:33:37 +01:00
Camille GILLOT
222d010255 Cleanups. 2020-03-27 07:50:28 +01:00
Camille GILLOT
db5be1fe20 Move QueryContext to the parent module. 2020-03-27 07:43:11 +01:00
Mazdak Farrokhzad
2972bb37b8 parse: improve recovery for assoc eq constraints. 2020-03-27 07:39:15 +01:00
Mazdak Farrokhzad
f91de44d07 extract parse_generic_arg 2020-03-27 07:39:15 +01:00
Mazdak Farrokhzad
aa4999ec69 parse_angle_arg: parse constraints first 2020-03-27 07:39:14 +01:00
Mazdak Farrokhzad
abce4881e0 split parse_angle_args into loop / single step 2020-03-27 07:39:14 +01:00
Mazdak Farrokhzad
91194f795c parse: move constraint/arg restriction to ast_validation. 2020-03-27 07:39:14 +01:00
Camille GILLOT
4faf701d20 Remove the QueryGetter trait. 2020-03-27 07:35:32 +01:00
bors
b9ac29169a Auto merge of #69470 - mati865:deps, r=Mark-Simulacrum
Upgrade rustc and bootstrap dependencies
2020-03-27 06:31:49 +00:00
Mazdak Farrokhzad
6c643a070c suggest semi on expr mac!() good as stmt mac!(). 2020-03-27 07:02:50 +01:00
Mazdak Farrokhzad
c858593ed0 non-exhastive diagnostic: add note re. scrutinee type 2020-03-27 06:49:07 +01:00
PankajChaudhary5
28fe986ae3 fix suggested changes 2020-03-27 09:53:16 +05:30
bors
6c19a10e24 Auto merge of #68404 - Amanieu:llvm-asm, r=estebank
Rename asm! to llvm_asm!

As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850.

This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
2020-03-27 03:27:09 +00:00
dylan_DPC
268408f495 remove unused import 2020-03-27 03:21:15 +01:00
dylan_DPC
7e7c2f19a3 simplify test 2020-03-27 02:45:56 +01:00
Nicholas Nethercote
02840ca8ab Remove no_integrated_as mode.
Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.
2020-03-27 11:59:10 +11:00
bors
7b73d14b0b Auto merge of #70451 - Dylan-DPC:rollup-2g9oyht, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #69644 (Remove framework in `dataflow/mod.rs` in favor of "generic" one)
 - #69936 (Fix cycle error when emitting suggestion for mismatched `fn` type)
 - #70048 (Allow obtaining &mut OsStr)
 - #70344 (Decouple `rustc_hir::print` into `rustc_hir_pretty`)
 - #70435 (Add regression test for #66706)

Failed merges:

r? @ghost
2020-03-27 00:25:26 +00:00
Dylan DPC
fa15774a4b
Rollup merge of #70435 - Alexendoo:test-66706, r=Centril
Add regression test for #66706

Adds the two cases that no longer ICE (https://github.com/rust-lang/rust/issues/66706#issuecomment-604098436)
2020-03-27 01:23:55 +01:00
Dylan DPC
7041efcfc3
Rollup merge of #70344 - Centril:hir-pretty, r=eddyb
Decouple `rustc_hir::print` into `rustc_hir_pretty`

High level summary:
- The HIR pretty printer, `rustc_hir::print` is moved into a new crate `rustc_hir_pretty`.
- `rustc_ast_pretty` and `rustc_errors` are dropped as `rustc_hir` dependencies.
- The dependence on HIR pretty is generally reduced, leaving `rustc_save_analysis`, `rustdoc`, `rustc_metadata`, and `rustc_driver` as the remaining clients.

The main goal here is to reduce `rustc_hir`'s dependencies and its size such that it can start and finish earlier, thereby working towards https://github.com/rust-lang/rust/issues/65031.

r? @Zoxc
2020-03-27 01:23:53 +01:00
Dylan DPC
c0369c4523
Rollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnay
Allow obtaining &mut OsStr

```rust
impl DerefMut for OsString {...}              // type Target = OsStr
impl IndexMut<RangeFull> for OsString {...}   // type Output = OsStr
```

---

This change is pulled out of #69937 per @dtolnay

This implements `DerefMut for OsString` to allow obtaining a `&mut OsStr`. This also implements `IndexMut for OsString`, which is used by `DerefMut`. This pattern is the same as is used by `Deref`.

This is necessary to for methods like `make_ascii_lowercase` which need to mutate the underlying value.
2020-03-27 01:23:51 +01:00
Dylan DPC
f635c3757b
Rollup merge of #69936 - Aaron1011:fix/suggestion-cycle, r=varkor
Fix cycle error when emitting suggestion for mismatched `fn` type

Fixes #66667

Previously, we called `tcx.typeck_tables_of` when determining whether or
not to emit a suggestion for a type error. However, we might already be
type-checking the `DefId` we pass to `typeck_tables_of` (it could be
anywhere in the query stack).

Fortunately, we only need the function signature, not the entire
`TypeckTables`. By using `tcx.fn_sig`, we avoid the possibility of cycle
errors while retaining the ability to emit a suggestion.
2020-03-27 01:23:49 +01:00
Dylan DPC
0f6144a115
Rollup merge of #69644 - ecstatic-morse:unified-dataflow-cleanup, r=eddyb
Remove framework in `dataflow/mod.rs` in favor of "generic" one

This is the culmination of the work described in rust-lang/compiler-team#202. All dataflow analyses (including the one in `clippy`) have been ported to use the framework in `dataflow/generic`, which can efficiently handle both gen/kill and generic problems. This PR moves the framework in `dataflow/generic` to `dataflow/framework`, and removes the gen/kill framework in `dataflow/mod.rs`.

More comprehensive documentation for the new framework is tracked in rust-lang/rustc-guide#564.

`clippy` will need to change the path it uses to import the dataflow analysis traits.
2020-03-27 01:23:47 +01:00
Dylan MacKenzie
89d6009461 Make framework a private module 2020-03-26 16:20:00 -07:00
Dylan MacKenzie
fe0e7c3cba Update framework module docs 2020-03-26 16:20:00 -07:00
Dylan MacKenzie
7108cea14e Move BottomValue into framework/mod.rs 2020-03-26 16:20:00 -07:00
Dylan MacKenzie
a8cc89f975 Update imports from dataflow::generic to dataflow 2020-03-26 16:19:58 -07:00
Dylan MacKenzie
93ce5ff587 Update use statements in dataflow/mod.rs 2020-03-26 16:19:21 -07:00
Dylan MacKenzie
bae1114e75 Rename dataflow::generic to dataflow::framework 2020-03-26 16:19:21 -07:00
Dylan MacKenzie
9978afb5d6 Move MoveDataParamEnv to beginning of module 2020-03-26 16:19:21 -07:00
Dylan MacKenzie
15346ed53c Remove BitDenotation framework 2020-03-26 16:19:19 -07:00
Stein Somers
3d435d8023 Test and fix gdb pretty printing again 2020-03-26 23:09:20 +00:00
dylan_DPC
a9a2a319af fix docs 2020-03-26 23:18:37 +01:00
Timothée Gerber
6a744ea4d5 Create output dir in rustdoc markdown render 2020-03-26 23:06:17 +01:00
bors
62c6006450 Auto merge of #70441 - Dylan-DPC:rollup-qv7h2ph, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #70384 (Refactor object file handling)
 - #70397 (add 'fn write_u16s' to Memory)
 - #70413 (Fix incorrect pattern warning "unreachable pattern")
 - #70428 (`error_bad_item_kind`: add help text)
 - #70429 (Clean up E0459 explanation)
 - #70437 (Miri float->int casts: be explicit that this is saturating)

Failed merges:

r? @ghost
2020-03-26 20:45:47 +00:00
Dylan DPC
195147c7ae
Rollup merge of #70437 - RalfJung:miri-saturate, r=hanna-kruppe
Miri float->int casts: be explicit that this is saturating

r? @hanna-kruppe
Cc https://github.com/rust-lang/miri/issues/1264
2020-03-26 21:44:09 +01:00
Dylan DPC
e5c5e025ac
Rollup merge of #70429 - GuillaumeGomez:cleanup-e0459, r=Dylan-DPC
Clean up E0459 explanation

r? @Dylan-DPC
2020-03-26 21:44:08 +01:00
Dylan DPC
ef43cdee28
Rollup merge of #70428 - Centril:move-to-mod, r=petrochenkov
`error_bad_item_kind`: add help text

For example, this adds:
```
    = help: consider moving the `use` import out to a nearby module scope
```
r? @petrochenkov @estebank

Fixes https://github.com/rust-lang/rust/issues/37205.
2020-03-26 21:44:06 +01:00
Dylan DPC
c640b95662
Rollup merge of #70413 - AminArria:match-pattern-incorrect-warning, r=Centril,Nadrieril,varkor
Fix incorrect pattern warning "unreachable pattern"

Fixes #70372

Added `is_under_guard` parameter to `_match::is_useful` and only add it to the matrix if `false`

Tested with:
```rust
#![feature(or_patterns)]
fn main() {
    match (3,42) {
        (a,_) | (_,a) if a > 10 => {println!("{}", a)}
        _ => ()
    }

    match Some((3,42)) {
        Some((a, _)) | Some((_, a)) if a > 10 => {println!("{}", a)}
        _ => ()

    }

    match Some((3,42)) {
        Some((a, _) | (_, a)) if a > 10 => {println!("{}", a)}
        _ => ()
    }
}
```
2020-03-26 21:44:05 +01:00
Dylan DPC
de3d1e9fa9
Rollup merge of #70397 - JOE1994:write_wide_str, r=RalfJung
add 'fn write_u16s' to Memory

Added new function `Memory::write_u16s`. Needed in `MIRI` for implementing helper function to write wide_str to memory (for Windows).
2020-03-26 21:44:03 +01:00
Dylan DPC
b15423e72e
Rollup merge of #70384 - nnethercote:refactor-object-file-handling, r=alexcrichton
Refactor object file handling

Some preliminary clean-ups that grease the path to #66961.

r? @alexcrichton
2020-03-26 21:44:02 +01:00
Nathan West
9b429fd121 Add fold_self
- Added `Iterator::fold_first`, which is like `fold`, but uses the first element in the iterator as the initial accumulator
- Includes doc and doctest
- Rebase commit; see #65222 for details

Co-Authored-By: Tim Vermeulen <tvermeulen@me.com>
2020-03-26 20:41:57 +01:00