Revert heterogeneous SocketAddr PartialEq impls
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()); |
This commit is contained in:
parent
1fb612bd15
commit
c45231ca55
@ -694,42 +694,6 @@ fn eq(&self, other: &SocketAddrV6) -> bool {
|
||||
&& self.inner.sin6_scope_id == other.inner.sin6_scope_id
|
||||
}
|
||||
}
|
||||
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
|
||||
impl PartialEq<SocketAddrV4> for SocketAddr {
|
||||
fn eq(&self, other: &SocketAddrV4) -> bool {
|
||||
match self {
|
||||
SocketAddr::V4(v4) => v4 == other,
|
||||
SocketAddr::V6(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
|
||||
impl PartialEq<SocketAddrV6> for SocketAddr {
|
||||
fn eq(&self, other: &SocketAddrV6) -> bool {
|
||||
match self {
|
||||
SocketAddr::V4(_) => false,
|
||||
SocketAddr::V6(v6) => v6 == other,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
|
||||
impl PartialEq<SocketAddr> for SocketAddrV4 {
|
||||
fn eq(&self, other: &SocketAddr) -> bool {
|
||||
match other {
|
||||
SocketAddr::V4(v4) => self == v4,
|
||||
SocketAddr::V6(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
|
||||
impl PartialEq<SocketAddr> for SocketAddrV6 {
|
||||
fn eq(&self, other: &SocketAddr) -> bool {
|
||||
match other {
|
||||
SocketAddr::V4(_) => false,
|
||||
SocketAddr::V6(v6) => self == v6,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Eq for SocketAddrV4 {}
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
@ -1242,12 +1206,8 @@ fn compare() {
|
||||
// equality
|
||||
assert_eq!(v4_1, v4_1);
|
||||
assert_eq!(v6_1, v6_1);
|
||||
assert_eq!(v4_1, SocketAddr::V4(v4_1));
|
||||
assert_eq!(v6_1, SocketAddr::V6(v6_1));
|
||||
assert_eq!(SocketAddr::V4(v4_1), SocketAddr::V4(v4_1));
|
||||
assert_eq!(SocketAddr::V6(v6_1), SocketAddr::V6(v6_1));
|
||||
assert!(v4_1 != SocketAddr::V6(v6_1));
|
||||
assert!(v6_1 != SocketAddr::V4(v4_1));
|
||||
assert!(v4_1 != v4_2);
|
||||
assert!(v6_1 != v6_2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user