Skip to content

Commit 7b4bdc0

Browse files
committed
fix: windows
1 parent 2f0c05e commit 7b4bdc0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

library/std/src/sys/windows/os_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl Buf {
150150

151151
impl Slice {
152152
#[inline]
153-
pub fn from_str(s: &str) -> &Slice {
153+
pub const fn from_str(s: &str) -> &Slice {
154154
unsafe { mem::transmute(Wtf8::from_str(s)) }
155155
}
156156

library/std/src/sys_common/wtf8.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ impl Wtf8 {
507507
///
508508
/// Since WTF-8 is a superset of UTF-8, this always succeeds.
509509
#[inline]
510-
pub fn from_str(value: &str) -> &Wtf8 {
510+
pub const fn from_str(value: &str) -> &Wtf8 {
511511
unsafe { Wtf8::from_bytes_unchecked(value.as_bytes()) }
512512
}
513513

@@ -516,7 +516,7 @@ impl Wtf8 {
516516
/// Since the byte slice is not checked for valid WTF-8, this functions is
517517
/// marked unsafe.
518518
#[inline]
519-
unsafe fn from_bytes_unchecked(value: &[u8]) -> &Wtf8 {
519+
const unsafe fn from_bytes_unchecked(value: &[u8]) -> &Wtf8 {
520520
mem::transmute(value)
521521
}
522522

0 commit comments

Comments
 (0)