mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-28 17:17:57 +00:00
Remove unsafe Deserialize impl for CStr
See also https://github.com/rust-lang/rust/issues/40248
This commit is contained in:
@@ -297,19 +297,6 @@ impl Deserialize for String {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Deserialize for Box<CStr> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer
|
||||
{
|
||||
use std::mem;
|
||||
let s = try!(CString::deserialize(deserializer));
|
||||
let slice = s.into_bytes_with_nul().into_boxed_slice();
|
||||
Ok(unsafe { mem::transmute::<Box<[u8]>, Box<CStr>>(slice) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Deserialize for CString {
|
||||
fn deserialize<D>(deserializer: D) -> Result<CString, D::Error>
|
||||
|
||||
Reference in New Issue
Block a user