-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Remove [T]::array_chunks(_mut)
#143289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Remove [T]::array_chunks(_mut)
#143289
Conversation
if v.len() % 2 != 0 { | ||
let (chunks, []) = v.as_chunks::<2>() else { | ||
return Err(FromUtf16Error(())); | ||
} | ||
}; | ||
match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) { | ||
(true, ([], v, [])) => Self::from_utf16(v), | ||
_ => char::decode_utf16(v.array_chunks::<2>().copied().map(u16::from_le_bytes)) | ||
_ => char::decode_utf16(chunks.iter().copied().map(u16::from_le_bytes)) | ||
.collect::<Result<_, _>>() | ||
.map_err(|_| FromUtf16Error(())), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hooray for let
-else
and slice patterns meaning this can write "the chunks with no tail", rather than needing to have an explicit % 2
.
This comment has been minimized.
This comment has been minimized.
From #74985 (comment):
@rfcbot merge |
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Let me know when CI is passing an I can take a look. |
9c9725c
to
4814b93
Compare
This comment has been minimized.
This comment has been minimized.
4814b93
to
bc6d1c2
Compare
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
@@ -19,7 +19,7 @@ index 1e336bf..35e6f54 100644 | |||
-#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))] | |||
#![cfg_attr(test, feature(cfg_select))] | |||
#![feature(alloc_layout_extra)] | |||
#![feature(array_chunks)] | |||
#![feature(array_ptr_get)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Achievement Acquired: first CI failure from a .patch
file.
@jhpratt This is passing CI now, if you want to take a look, but no rush since it can't land in less than 10 days anyway. |
Since libs-api is proposing as much in #74985 (comment)
Closes #74985
Closes #76354