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

Revert heterogeneous SocketAddr PartialEq impls #73304

Merged
merged 2 commits into from
Jun 15, 2020
Merged

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jun 13, 2020

Originally added in #72239.

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

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:

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 #73242.

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());
      |
@dtolnay dtolnay added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jun 13, 2020
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 13, 2020
@mati865
Copy link
Contributor

mati865 commented Jun 13, 2020

Seems like it'd be worth to add test for it?

@LeSeulArtichaut LeSeulArtichaut added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jun 13, 2020
@Mark-Simulacrum
Copy link
Member

@dtolnay -- would you want to unilaterally accept this for beta backport or perhaps we should do a libs team FCP here since this is reverting a previously FCP-d decision?

@Mark-Simulacrum
Copy link
Member

r? @Mark-Simulacrum

r=me with regards to the patch itself though once we have libs team approval

@dtolnay
Copy link
Member Author

dtolnay commented Jun 13, 2020

Added test.

@dtolnay
Copy link
Member Author

dtolnay commented Jun 13, 2020

would you want to unilaterally accept this for beta backport or perhaps we should do a libs team FCP here since this is reverting a previously FCP-d decision?

I think I'll unilaterally accept this revert. Procedurally I guess I am "retracting my approval for this part of #72239".

@dtolnay
Copy link
Member Author

dtolnay commented Jun 13, 2020

@bors r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Jun 13, 2020

📌 Commit 204c236 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 13, 2020
@dtolnay dtolnay added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jun 13, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jun 13, 2020
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 pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jun 14, 2020
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.
@RalfJung
Copy link
Member

@bors rollup

RalfJung added a commit to RalfJung/rust that referenced this pull request Jun 15, 2020
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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 15, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#72707 (Use min_specialization in the remaining rustc crates)
 - rust-lang#72740 (On recursive ADT, provide indirection structured suggestion)
 - rust-lang#72879 (Miri: avoid tracking current location three times)
 - rust-lang#72938 (Stabilize Option::zip)
 - rust-lang#73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM)
 - rust-lang#73104 (Example about explicit mutex dropping)
 - rust-lang#73139 (Add methods to go from a nul-terminated Vec<u8> to a CString)
 - rust-lang#73296 (Remove vestigial CI job msvc-aux.)
 - rust-lang#73304 (Revert heterogeneous SocketAddr PartialEq impls)
 - rust-lang#73331 (extend network support for HermitCore)

Failed merges:

r? @ghost
@bors bors merged commit 202499f into rust-lang:master Jun 15, 2020
@dtolnay dtolnay deleted the socketeq branch August 23, 2020 22:50
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[regression] type inference on parse()
9 participants