diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index bace37ef1443b..e7dcd16fc78d2 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -785,8 +785,8 @@ impl str { // SAFETY: caller guarantees `mid` is on a char boundary. unsafe { ( - from_utf8_unchecked_mut(slice::from_raw_parts(ptr, mid)), - from_utf8_unchecked_mut(slice::from_raw_parts(ptr.add(mid), len - mid)), + from_utf8_unchecked(slice::from_raw_parts(ptr, mid)), + from_utf8_unchecked(slice::from_raw_parts(ptr.add(mid), len - mid)), ) } }