mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #96397 - AronParker:issue-96368-fix, r=dtolnay
Make EncodeWide implement FusedIterator [`EncodeUtf16`](https://doc.rust-lang.org/std/str/struct.EncodeUtf16.html) and [`EncodeWide`](https://doc.rust-lang.org/std/os/windows/ffi/struct.EncodeWide.html) currently serve similar purposes: They convert from UTF-8 to UTF-16 and WTF-8 to WTF-16, respectively. `EncodeUtf16` wraps a &str, whereas `EncodeWide` wraps an &OsStr. When Iteration has concluded, these iterators wrap an empty slice, which will forever yield `None` values. Hence, `EncodeUtf16` rightfully implements `FusedIterator`. However, `EncodeWide` in contrast does not, even though it serves an almost identical purpose. This PR attempts to fix that issue. I consider this change minor and non-controversial, hence why I have not added a RFC/FCP. Please let me know if the stability attribute is wrong or contains a wrong version number. Thanks in advance. Fixes https://github.com/rust-lang/rust/issues/96368
This commit is contained in:
commit
c4dd0d3bb7
@ -25,7 +25,7 @@ use crate::char;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::hash::{Hash, Hasher};
|
||||
use crate::iter::FromIterator;
|
||||
use crate::iter::{FromIterator, FusedIterator};
|
||||
use crate::mem;
|
||||
use crate::ops;
|
||||
use crate::rc::Rc;
|
||||
@ -899,6 +899,9 @@ impl<'a> Iterator for EncodeWide<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "encode_wide_fused_iterator", since = "1.62.0")]
|
||||
impl FusedIterator for EncodeWide<'_> {}
|
||||
|
||||
impl Hash for CodePoint {
|
||||
#[inline]
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
|
Loading…
Reference in New Issue
Block a user