Skip to content

Commit c45231c

Browse files
committed
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()); |
1 parent 1fb612b commit c45231c

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

src/libstd/net/addr.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -694,42 +694,6 @@ impl PartialEq for SocketAddrV6 {
694694
&& self.inner.sin6_scope_id == other.inner.sin6_scope_id
695695
}
696696
}
697-
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
698-
impl PartialEq<SocketAddrV4> for SocketAddr {
699-
fn eq(&self, other: &SocketAddrV4) -> bool {
700-
match self {
701-
SocketAddr::V4(v4) => v4 == other,
702-
SocketAddr::V6(_) => false,
703-
}
704-
}
705-
}
706-
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
707-
impl PartialEq<SocketAddrV6> for SocketAddr {
708-
fn eq(&self, other: &SocketAddrV6) -> bool {
709-
match self {
710-
SocketAddr::V4(_) => false,
711-
SocketAddr::V6(v6) => v6 == other,
712-
}
713-
}
714-
}
715-
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
716-
impl PartialEq<SocketAddr> for SocketAddrV4 {
717-
fn eq(&self, other: &SocketAddr) -> bool {
718-
match other {
719-
SocketAddr::V4(v4) => self == v4,
720-
SocketAddr::V6(_) => false,
721-
}
722-
}
723-
}
724-
#[stable(feature = "socketaddr_ordering", since = "1.45.0")]
725-
impl PartialEq<SocketAddr> for SocketAddrV6 {
726-
fn eq(&self, other: &SocketAddr) -> bool {
727-
match other {
728-
SocketAddr::V4(_) => false,
729-
SocketAddr::V6(v6) => self == v6,
730-
}
731-
}
732-
}
733697
#[stable(feature = "rust1", since = "1.0.0")]
734698
impl Eq for SocketAddrV4 {}
735699
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1242,12 +1206,8 @@ mod tests {
12421206
// equality
12431207
assert_eq!(v4_1, v4_1);
12441208
assert_eq!(v6_1, v6_1);
1245-
assert_eq!(v4_1, SocketAddr::V4(v4_1));
1246-
assert_eq!(v6_1, SocketAddr::V6(v6_1));
12471209
assert_eq!(SocketAddr::V4(v4_1), SocketAddr::V4(v4_1));
12481210
assert_eq!(SocketAddr::V6(v6_1), SocketAddr::V6(v6_1));
1249-
assert!(v4_1 != SocketAddr::V6(v6_1));
1250-
assert!(v6_1 != SocketAddr::V4(v4_1));
12511211
assert!(v4_1 != v4_2);
12521212
assert!(v6_1 != v6_2);
12531213

0 commit comments

Comments
 (0)