Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #73325

Closed
wants to merge 25 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost

matthew-mcallister and others added 25 commits May 24, 2020 17:54
Namely closures and `async` blocks. We have to make a few modifications
to closures to make them compile.
These lead to inference regressions (mostly in tests) in code that looks
like:

    let socket = std::net::SocketAddrV4::new(std::net::Ipv4Addr::new(127, 0, 0, 1), 8080);
    assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());

That compiles as of stable 1.44.0 but fails in beta with:

    error[E0284]: type annotations needed
     --> src/main.rs:3:41
      |
    3 |     assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());
      |                                         ^^^^^ cannot infer type for type parameter `F` declared on the associated function `parse`
      |
      = note: cannot satisfy `<_ as std::str::FromStr>::Err == _`
    help: consider specifying the type argument in the method call
      |
    3 |     assert_eq!(socket, "127.0.0.1:8080".parse::<F>().unwrap());
      |
…p-elab, r=oli-obk

Check for live drops in constants after drop elaboration

Resolves rust-lang#66753.

This PR splits the MIR "optimization" pass series in two and introduces a query–`mir_drops_elaborated_and_const_checked`–that holds the result of the `post_borrowck_cleanup` analyses and checks for live drops. This query is invoked in `rustc_interface` for all items requiring const-checking, which means we now do `post_borrowck_cleanup` for items even if they are unused in the crate.

As a result, we are now more precise about when drops are live. This is because drop elaboration can e.g. eliminate drops of a local when all its fields are moved from. This does not mean we are doing value-based analysis on move paths, however; Storing a `Some(CustomDropImpl)` into a field of a local will still set the qualifs for that entire local.

r? @oli-obk
…rent-impl, r=estebank

Fix trait alias inherent impl resolution

Fixes rust-lang#60021 and fixes rust-lang#72415.

Obviously, the fix was very easy, but getting started with the testing and debugging rust compiler was an interesting experience. Now I can cross it off my bucket list!
…atthewjasper

On recursive ADT, provide indirection structured suggestion
…op, r=pnkfelix

Preserve `Expr`s that have `DefId`s in `ReplaceBodyWithLoop`

This PR fixes the last part of rust-lang#71104 by preserving expressions that are assigned their own `DefId`s (closures and `async` blocks) when passing them to `rustdoc`. This avoids having a `DefId` without a corresponding `HirId`.

The first commit in this PR makes `-Zunpretty=everybody_loops` actually work again, and the subsequent two are miscellaneous cleanup. They should probably get merged regardless of what we end up doing here.

Sample input:
```rust
fn foo() -> Box<i32> {
    let x = |a: i64| {
        const FOO: i64 = 1;
    };

    let a = 4;
    Box::new(a)
}
```

Sample output:
```rust
fn foo() -> Box<i32> {
    || -> !
        {
            const FOO: i64 = 1;
            loop  { }
        };
    loop  { }
}
```

r? @ghost
Revert heterogeneous SocketAddr PartialEq impls

Originally added in rust-lang#72239.

These lead to inference regressions (mostly in tests) in code that looks like:

```rust
let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());
```

That compiles as of stable 1.44.0 but fails in beta with:

```console
error[E0284]: type annotations needed
 --> src/main.rs:3:41
  |
3 |     assert_eq!(socket, "127.0.0.1:8080".parse().unwrap());
  |                                         ^^^^^ cannot infer type for type parameter `F` declared on the associated function `parse`
  |
  = note: cannot satisfy `<_ as std::str::FromStr>::Err == _`
help: consider specifying the type argument in the method call
  |
3 |     assert_eq!(socket, "127.0.0.1:8080".parse::<F>().unwrap());
  |
```

Closes rust-lang#73242.
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jun 13, 2020

📌 Commit a539574 has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 13, 2020
@Dylan-DPC-zz
Copy link
Author

will probably reroll in the morning

@Dylan-DPC-zz Dylan-DPC-zz deleted the rollup-da7fow4 branch June 14, 2020 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants