Skip to content

Commit 4ced0db

Browse files
committed
Auto merge of rust-lang#112817 - compiler-errors:rollup-0eqomra, r=compiler-errors
Rollup of 8 pull requests Successful merges: - rust-lang#112232 (Better error for non const `PartialEq` call generated by `match`) - rust-lang#112499 (Fix python linting errors) - rust-lang#112596 (Suggest correct signature on missing fn returning RPITIT/AFIT) - rust-lang#112606 (Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses) - rust-lang#112781 (Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds) - rust-lang#112787 (Add gha problem matcher) - rust-lang#112799 (Clean up "doc(hidden)" check) - rust-lang#112803 (Format the examples directory of cg_clif) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 90ccdde + 18084d3 commit 4ced0db

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

core/src/net/ip_addr.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,14 +1770,8 @@ impl fmt::Display for Ipv6Addr {
17701770
f.write_str("::")
17711771
} else if self.is_loopback() {
17721772
f.write_str("::1")
1773-
} else if let Some(ipv4) = self.to_ipv4() {
1774-
match segments[5] {
1775-
// IPv4 Compatible address
1776-
0 => write!(f, "::{}", ipv4),
1777-
// IPv4 Mapped address
1778-
0xffff => write!(f, "::ffff:{}", ipv4),
1779-
_ => unreachable!(),
1780-
}
1773+
} else if let Some(ipv4) = self.to_ipv4_mapped() {
1774+
write!(f, "::ffff:{}", ipv4)
17811775
} else {
17821776
#[derive(Copy, Clone, Default)]
17831777
struct Span {

core/src/unicode/printable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def print_singletons(uppers, lowers, uppersname, lowersname):
119119
print("#[rustfmt::skip]")
120120
print("const {}: &[u8] = &[".format(lowersname))
121121
for i in range(0, len(lowers), 8):
122-
print(" {}".format(" ".join("{:#04x},".format(l) for l in lowers[i:i+8])))
122+
print(" {}".format(" ".join("{:#04x},".format(x) for x in lowers[i:i+8])))
123123
print("];")
124124

125125
def print_normal(normal, normalname):

core/tests/net/ip_addr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn ipv6_addr_to_string() {
139139

140140
// ipv4-compatible address
141141
let a1 = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0xc000, 0x280);
142-
assert_eq!(a1.to_string(), "::192.0.2.128");
142+
assert_eq!(a1.to_string(), "::c000:280");
143143

144144
// v6 address with no zero segments
145145
assert_eq!(Ipv6Addr::new(8, 9, 10, 11, 12, 13, 14, 15).to_string(), "8:9:a:b:c:d:e:f");
@@ -316,7 +316,7 @@ fn ip_properties() {
316316

317317
check!("::", unspec);
318318
check!("::1", loopback);
319-
check!("::0.0.0.2", global);
319+
check!("::2", global);
320320
check!("1::", global);
321321
check!("fc00::");
322322
check!("fdff:ffff::");
@@ -607,7 +607,7 @@ fn ipv6_properties() {
607607

608608
check!("::1", &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], loopback);
609609

610-
check!("::0.0.0.2", &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2], global | unicast_global);
610+
check!("::2", &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2], global | unicast_global);
611611

612612
check!("1::", &[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], global | unicast_global);
613613

core/tests/net/socket_addr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn ipv6_socket_addr_to_string() {
3434
// IPv4-compatible address.
3535
assert_eq!(
3636
SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0xc000, 0x280), 8080, 0, 0).to_string(),
37-
"[::192.0.2.128]:8080"
37+
"[::c000:280]:8080"
3838
);
3939

4040
// IPv6 address with no zero segments.

std/src/net/socket_addr/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn ipv6_socket_addr_to_string() {
8585
// IPv4-compatible address.
8686
assert_eq!(
8787
SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0xc000, 0x280), 8080, 0, 0).to_string(),
88-
"[::192.0.2.128]:8080"
88+
"[::c000:280]:8080"
8989
);
9090

9191
// IPv6 address with no zero segments.

0 commit comments

Comments
 (0)