101661 Commits

Author SHA1 Message Date
Tyler Mandry
959a563803
Rollup merge of #65977 - ohadravid:fix-incorrect-diagnostics-with-an-associated-type, r=estebank
Fix incorrect diagnostics for expected type in E0271 with an associated type

With code like the following code:

```rust
#[derive(Debug)]
struct Data {}

fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) {
    for item in iterator {
        println!("{:?}", item)
    }
}

fn main() {
    let v = vec![Data {}];

    do_stuff(v.into_iter());
}
```

the diagnostic (in nightly & stable) wrongly complains about the expected type:

```
error[E0271]: type mismatch resolving `<std::vec::IntoIter<Data> as std::iter::Iterator>::Item == &Data`
  --> src/main.rs:15:5
   |
5  | fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) {
   |    --------                             --------------- required by this bound in `do_stuff`
...
15 |     do_stuff(v.into_iter());
   |     ^^^^^^^^ expected struct `Data`, found &Data
   |
   = note: expected type `Data`
              found type `&Data`
```

This PR fixes this issue by flipping the expected/actual values where appropriate, so it looks like this:

```
error[E0271]: type mismatch resolving `<std::vec::IntoIter<Data> as std::iter::Iterator>::Item == &Data`
  --> main.rs:15:5
   |
5  | fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) {
   |    --------                             --------------- required by this bound in `do_stuff`
...
15 |     do_stuff(v.into_iter());
   |     ^^^^^^^^ expected &Data, found struct `Data`
   |
   = note: expected type `&Data`
              found type `Data`
```

This improves the output of a lot of existing tests (check out `associated-types-binding-to-type-defined-in-supertrait`!).

The only change which I wasn't too sure about is in the test `associated-types-overridden-binding-2`, but I think it's an improvement and the underlying problem is with handling of `trait_alias`.

Fix #57226, fix #64760, fix #58092.
2019-11-01 11:20:22 -07:00
Tyler Mandry
05de0d7c9f
Rollup merge of #65972 - braiins:vkr-arm-panicking, r=alexcrichton
Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets

If `__LITTLE_ENDIAN__` is missing, libunwind assumes big endian
and reads unwinding instructions wrong on ARM EHABI.

Fix #65765

Technical background in referenced bug.

I didn't run any automated tests, just built a simple panicking program using the fixed toolchain and panicking started to work. Tried with `catch_unwind()` and that seems to work now too. libunwind's log seems ok now, I can paste it if needed.
2019-11-01 11:20:21 -07:00
Tyler Mandry
9bf1613840
Rollup merge of #65963 - steveklabnik:update-submodules, r=Centril
update submodules to rust-lang

These are the repositories I've moved from rust-lang-nursery to
rust-lang, so we should update the submodules too.

I have not tested that this builds at all, so please make sure CI is green!
2019-11-01 11:20:20 -07:00
Tyler Mandry
723f0ef518
Rollup merge of #65960 - lzutao:doc-iter-example, r=Centril
doc: reword iter module example and mention other methods
2019-11-01 11:20:18 -07:00
Tyler Mandry
4160e5aaba
Rollup merge of #65946 - ecstatic-morse:refactor-promotion2, r=eddyb
Make `promote_consts` emit the errors when required promotion fails

A very minimal version of #65942.

This will cause a generic "argument X is required to be a constant" message for `simd_shuffle` LLVM intrinsics instead of the [custom one](caa1f8d7b3/src/librustc_mir/transform/qualify_consts.rs (L1616)). It may be possible to remove this special-casing altogether after rust-lang/stdarch#825.

r? @eddyb
2019-11-01 11:20:17 -07:00
Tyler Mandry
b7416348c8
Rollup merge of #65914 - estebank:type-alias-bounds-sugg, r=davidtwco
Use structured suggestion for unnecessary bounds in type aliases
2019-11-01 11:20:15 -07:00
Tyler Mandry
d75338e630
Rollup merge of #65902 - gilescope:issue62570, r=estebank
Make ItemContext available for better diagnositcs

Fix #62570
2019-11-01 11:20:14 -07:00
Tyler Mandry
48a9f59ae7
Rollup merge of #65857 - kinnison:kinnison/issue-55364, r=Manisheart,GuillaumeGomez
rustdoc: Resolve module-level doc references more locally

Module level docs should resolve intra-doc links as locally as
possible.  As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.

I'm hoping that this fixes #55364 though right now I'm not sure it's the right fix.

r? @GuillaumeGomez
2019-11-01 11:20:12 -07:00
Tyler Mandry
1918205891
Rollup merge of #65471 - GuillaumeGomez:long-err-explanation-E0578, r=Dylan-DPC
Add long error explanation for E0578

Part of #61137

r? @kinnison
2019-11-01 11:20:11 -07:00
Tyler Mandry
7297cd8d92
Rollup merge of #65470 - traxys:fix_65401, r=michaelwoerister
Don't hide ICEs from previous incremental compiles

I think this fixes #65401, the compiler does not fail to ICE after the first compilation, tested on the last snippet of [this comment](https://github.com/rust-lang/rust/issues/63154#issuecomment-541592381).
I am not very sure of the fix as I don't understand much of the structure of the compiler.
2019-11-01 11:20:09 -07:00
Tyler Mandry
9175247e72
Rollup merge of #65112 - jack-t:type-parens-lint, r=varkor
Add lint and tests for unnecessary parens around types

This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way.

The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` &mdash; I'm not totally sure it worked right, though &mdash; and I've tried to follow the instructions linked in the readme.

I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something.

There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.
2019-11-01 11:20:07 -07:00
Nadrieril
a96d7005c6 Clarifications suggested by varkor 2019-11-01 17:23:04 +00:00
Nadrieril
8956c1ed1d Factor out witness reconstruction 2019-11-01 17:23:04 +00:00
Nadrieril
b7fa9f12ca Factor out constructor subtraction 2019-11-01 17:23:04 +00:00
Nadrieril
92101b7655 Define a MissingConstructors struct for cleanliness 2019-11-01 17:23:03 +00:00
Nadrieril
cc4583dcd3 Wording 2019-11-01 17:23:03 +00:00
Nadrieril
d663c276da specialize conceptually operates on a single pattern 2019-11-01 17:23:02 +00:00
Nadrieril
57a656a46c Clarify some variable names 2019-11-01 17:23:01 +00:00
Nadrieril
175976e2a2 Refactor "wild constructor" construction 2019-11-01 17:22:32 +00:00
Nadrieril
b45458124e Extract constructor application as a Constructor method 2019-11-01 17:22:32 +00:00
Nadrieril
0c02c19ac8 Remove duplicate logic in compute_missing_constructors
This is equivalent to the previous code in terms of performance. The
expensive path is clearly identical. The fast path is also the same,
because in both cases we loop until we get a non-empty `refined_ctors`,
and then stop there. So the new code doesn't compute anything more
than the previous did.
2019-11-01 17:22:32 +00:00
Nadrieril
5e734bef41 Remove some redundancy 2019-11-01 17:22:32 +00:00
Nadrieril
23ca38ed95 Factor out some pattern-stack related functions 2019-11-01 17:22:29 +00:00
Nadrieril
403d6bd995 Abstract out pattern stacks to make the code more legible 2019-11-01 15:44:58 +00:00
Felix S. Klock II
6457914ff6 ui test formulation of regression test for issue 64872.
(Many thanks to alex for 1. making this even smaller than what I had
originally minimized, and 2. pointing out that there is precedent for
having ui tests with crate dependency chains of length > 2, thus
allowing me to avoid encoding this as a run-make test.)
2019-11-01 15:06:21 +01:00
Felix S. Klock II
d21f9b7fd6 targeted revert of PR rust-lang/rust#64324 (just undo change to dylib generics export).
Includes the anticipated fallout to run-make-fulldeps test suite from
this change. (We need to reopen issue 64319 as part of landing this.)
2019-11-01 15:05:45 +01:00
bors
01e5d91482 Auto merge of #65718 - eddyb:codegen-var-debuginfo, r=nikomatsakis
rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen.

These are all the codegen changes necessary for #56231.

The refactors were performed locally to codegen, and in several steps, to ease reviewing and avoid introducing changes in behavior (as I'm not sure our debuginfo tests cover enough).

r? @michaelwoerister cc @nagisa @rkruppe @oli-obk
2019-11-01 11:34:51 +00:00
Erin Power
5fb4111131
Updated RELEASES.md for 1.39.0 2019-11-01 09:30:21 +01:00
bors
253fc0ed74 Auto merge of #65698 - msizanoen1:dual-proc-macro-hash, r=petrochenkov
Dual proc macro hash

This PR changes current `-Z dual-proc-macro` mechanism from resolving only by name to including the hash of the host crate inside the transistive dependency information to prevent name conflicts.
Fix partially #62558
2019-11-01 06:35:40 +00:00
bors
472e6787f0 Auto merge of #65459 - ecstatic-morse:graphviz-subgraph, r=estebank
Fix `-Zunpretty=mir-cfg` to render multiple items

`-Zunpretty=mir-cfg` outputs DOT to stdout for all items being compiled. However, it puts all of these items in separate `digraph`s, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have tried `dot` and `xdot`) cannot render the output.

This PR checks to see if `write_mir_graphviz` will  process multiple items, and writes them each as a `subgraph` in a single, top-level `digraph`. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.`-Zunpretty=mir-cfg=item_name`).

Here's the output of `xdot` for a rust file containing three items:
![three-items](https://user-images.githubusercontent.com/29463364/66889712-4bf62200-ef98-11e9-83b5-60faa2a300dd.png)

The borders are a result of the nonstandard–but well-supported–[`cluster` prefix](https://graphviz.gitlab.io/_pages/doc/info/lang.html) (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.
2019-11-01 03:15:31 +00:00
Eduard-Mihai Burtescu
60a22665c8 rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen. 2019-10-31 20:25:57 +02:00
Eduard-Mihai Burtescu
1e42072673 rustc_codegen_ssa: hide address ops from the declare_local interface. 2019-10-31 20:25:56 +02:00
Eduard-Mihai Burtescu
c2e7743da8 rustc_codegen_ssa: move debuginfo scopes into FunctionDebugContext. 2019-10-31 20:25:55 +02:00
Eduard-Mihai Burtescu
06869b8d17 rustc_codegen_ssa: change set_var_name back to taking a &str. 2019-10-31 20:25:54 +02:00
Eduard-Mihai Burtescu
5f4ee36e03 rustc_codegen_ssa: move all set_var_name calls to mir::debuginfo. 2019-10-31 20:25:42 +02:00
Eduard-Mihai Burtescu
c58e6b5752 rustc_codegen_ssa: move local variable debuginfo to mir::debuginfo. 2019-10-31 20:00:16 +02:00
Eduard-Mihai Burtescu
5059a3c7d4 rustc_codegen_ssa: move debuginfo-related things to a new mir::debuginfo module. 2019-10-31 20:00:15 +02:00
Eduard-Mihai Burtescu
27e01a1f88 syntax: disable the new early feature-gatings added in #65742. 2019-10-31 19:34:06 +02:00
Eduard-Mihai Burtescu
803616a73d Revert "pre-expansion gate trait_alias."
This reverts commit 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1.
2019-10-31 19:08:13 +02:00
Eduard-Mihai Burtescu
56d7bb2133 Revert "pre-expansion gate associated_type_bounds"
This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
b05d36228e Revert "pre-expansion gate crate_visibility_modifier"
This reverts commit 04c661ba021730bc13d33c6d55cb9aad05026f36.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
8f1eb345ea Revert "pre-expansion gate const_generics"
This reverts commit 49cbfa1a6f6469ddbc0e88161e52104cc87aea9b.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
ada4a6430d Revert "pre-expansion gate decl_macro"
This reverts commit 1f470ceac2202ecffe8a15acc1139edb9ad4a03b.
2019-10-31 19:08:12 +02:00
Eduard-Mihai Burtescu
680089c2d9 Revert "pre-expansion gate box_patterns"
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
2019-10-31 19:08:11 +02:00
Eduard-Mihai Burtescu
4c48355c69 Revert "pre-expansion gate exclusive_range_pattern"
This reverts commit 665a876e307933c6480a6c55a3e38e88937aff2c.
2019-10-31 19:08:11 +02:00
Eduard-Mihai Burtescu
8645ac4218 Revert "pre-expansion gate try_blocks"
This reverts commit 1935ba658c576f14397c2c7a26a6642cf08f26a6.
2019-10-31 19:08:11 +02:00
Eduard-Mihai Burtescu
73bde2f0ce Revert "pre-expansion gate label_break_value"
This reverts commit 137ded8ab1edf5112c45e0b6854272ae2e9d3a6d.
2019-10-31 19:08:10 +02:00
Eduard-Mihai Burtescu
20bfff66a9 Revert "pre-expansion gate box_syntax"
This reverts commit e4ed8865786a787a7b0c045f7674569b6be0e9bc.
2019-10-31 19:08:10 +02:00
Eduard-Mihai Burtescu
4c947a26f2 Revert "pre-expansion gate type_ascription"
This reverts commit 15a6c09b6e8a977f2c6f5a73de01a20d00b37930.
2019-10-31 19:08:10 +02:00
Lzu Tao
7b72c2831c Stabilize float_to_from_bytes feature 2019-10-31 16:13:28 +00:00