Skip to content

Commit 591607d

Browse files
committed
String: add a FIXME to from_utf16
1 parent 464c9da commit 591607d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/liballoc/string.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ impl String {
618618
/// ```
619619
#[stable(feature = "rust1", since = "1.0.0")]
620620
pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
621+
// This isn't done via collect::<Result<_, _>>() for performance reasons.
622+
// FIXME: the function can be simplified again when #48994 is closed.
621623
let mut ret = String::with_capacity(v.len());
622624
for c in decode_utf16(v.iter().cloned()) {
623625
if let Ok(c) = c {

0 commit comments

Comments
 (0)