Skip to content

Commit 51bd916

Browse files
authored
Rollup merge of #46356 - daboross:patch-2, r=sfackler
Reject '2' as a binary digit in internals of b: number formatting The `radix!` macro generates an implementation of the private trait `GenericRadix`, and the code replaced changes Binary's implementation to no longer accept '2' as a valid digit to print. Granted, this code is literally only ever called from another method in this private trait, and that method has logic to never hand a '2' to the printing function. Even given this, the code's there, I thought it would be best to fix this for clarity of anyone reading it.
2 parents 9a93df9 + 2c98378 commit 51bd916

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcore/fmt/num.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ macro_rules! radix {
134134
}
135135
}
136136

137-
radix! { Binary, 2, "0b", x @ 0 ... 2 => b'0' + x }
137+
radix! { Binary, 2, "0b", x @ 0 ... 1 => b'0' + x }
138138
radix! { Octal, 8, "0o", x @ 0 ... 7 => b'0' + x }
139139
radix! { Decimal, 10, "", x @ 0 ... 9 => b'0' + x }
140140
radix! { LowerHex, 16, "0x", x @ 0 ... 9 => b'0' + x,

0 commit comments

Comments
 (0)