Skip to content

Commit ef3d5d8

Browse files
authored
Unrolled build for rust-lang#126906
Rollup merge of rust-lang#126906 - GrigorenkoPV:fixme-split_at_first, r=Mark-Simulacrum Small fixme in core now that split_first has no codegen issues rust-lang#109328 (comment) BTW, I have a crate implementing exactly this kind of an iterator: https://github.com/GrigorenkoPV/head-tail-iter and I was wondering if it would be worthwhile to try and make an ACP for it to get it included in std (or maybe itertools). My only doubt is that it kinda incentives writing O(n^2) algorithms and is not the hard to replace with a `while let` loop (just as in this PR).
2 parents 2975a21 + 39bf1dc commit ef3d5d8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

library/core/src/num/dec2flt/common.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ impl ByteSlice for [u8] {
3939
fn parse_digits(&self, mut func: impl FnMut(u8)) -> &Self {
4040
let mut s = self;
4141

42-
// FIXME: Can't use s.split_first() here yet,
43-
// see https://github.com/rust-lang/rust/issues/109328
44-
while let [c, s_next @ ..] = s {
42+
while let Some((c, s_next)) = s.split_first() {
4543
let c = c.wrapping_sub(b'0');
4644
if c < 10 {
4745
func(c);

library/core/src/num/dec2flt/parse.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ fn try_parse_19digits(s_ref: &mut &[u8], x: &mut u64) {
5151
let mut s = *s_ref;
5252

5353
while *x < MIN_19DIGIT_INT {
54-
// FIXME: Can't use s.split_first() here yet,
55-
// see https://github.com/rust-lang/rust/issues/109328
56-
if let [c, s_next @ ..] = s {
54+
if let Some((c, s_next)) = s.split_first() {
5755
let digit = c.wrapping_sub(b'0');
5856

5957
if digit < 10 {

0 commit comments

Comments
 (0)