Summary
Below fails to compile:
let p_cmdline = unsafe { GetCommandLineW() };
OsString::from_wide(unsafe { windows_strings::PCWSTR::from_raw(p_cmdline).as_wide() });
It should have no problem since the validity of returned &[u16] does not depend on PCWSTR.
Or is that on purpose out of consideration?
(Now workaround is to use core::slice::from_raw_parts by myself.
Crate manifest
windows-strings = "0.5.1"
Crate code