From 772da4d9b626baf7fb9878a8af138bf260bd3f7a Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Tue, 7 Jun 2022 14:53:59 -0400 Subject: [PATCH] Inline Windows `OsStrExt::encode_wide` User crates currently produce much more code than necessary because the optimizer fails to make assumptions about this method. --- std/src/os/windows/ffi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/std/src/os/windows/ffi.rs b/std/src/os/windows/ffi.rs index a9493a94cac26..96bab59d3f8d7 100644 --- a/std/src/os/windows/ffi.rs +++ b/std/src/os/windows/ffi.rs @@ -129,6 +129,7 @@ pub trait OsStrExt: Sealed { #[stable(feature = "rust1", since = "1.0.0")] impl OsStrExt for OsStr { + #[inline] fn encode_wide(&self) -> EncodeWide<'_> { self.as_inner().inner.encode_wide() }