mirror of
https://github.com/serde-rs/serde.git
synced 2025-09-30 22:41:31 +00:00
Fix missing absolute paths in deserialize_seq
This commit is contained in:
parent
c650a92bf7
commit
e0eea551b4
@ -418,8 +418,8 @@ fn deserialize_seq(
|
|||||||
};
|
};
|
||||||
let assign = quote! {
|
let assign = quote! {
|
||||||
let #var = match #visit {
|
let #var = match #visit {
|
||||||
Some(__value) => __value,
|
_serde::export::Some(__value) => __value,
|
||||||
None => {
|
_serde::export::None => {
|
||||||
return _serde::export::Err(_serde::de::Error::invalid_length(#index_in_seq, &#expecting));
|
return _serde::export::Err(_serde::de::Error::invalid_length(#index_in_seq, &#expecting));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,7 @@ use self::serde::de::{DeserializeOwned, Deserializer};
|
|||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
use std::option::Option as StdOption;
|
||||||
use std::result::Result as StdResult;
|
use std::result::Result as StdResult;
|
||||||
|
|
||||||
// Try to trip up the generated code if it fails to use fully qualified paths.
|
// Try to trip up the generated code if it fails to use fully qualified paths.
|
||||||
@ -32,6 +33,12 @@ struct Result;
|
|||||||
struct Ok;
|
struct Ok;
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Err;
|
struct Err;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
struct Option;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
struct Some;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
struct None;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -56,7 +63,7 @@ fn test_gen() {
|
|||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct WithRef<'a, T: 'a> {
|
struct WithRef<'a, T: 'a> {
|
||||||
#[serde(skip_deserializing)]
|
#[serde(skip_deserializing)]
|
||||||
t: Option<&'a T>,
|
t: StdOption<&'a T>,
|
||||||
#[serde(serialize_with="ser_x", deserialize_with="de_x")]
|
#[serde(serialize_with="ser_x", deserialize_with="de_x")]
|
||||||
x: X,
|
x: X,
|
||||||
}
|
}
|
||||||
@ -77,9 +84,9 @@ fn test_gen() {
|
|||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct NoBounds<T> {
|
struct NoBounds<T> {
|
||||||
t: T,
|
t: T,
|
||||||
option: Option<T>,
|
option: StdOption<T>,
|
||||||
boxed: Box<T>,
|
boxed: Box<T>,
|
||||||
option_boxed: Option<Box<T>>,
|
option_boxed: StdOption<Box<T>>,
|
||||||
}
|
}
|
||||||
assert::<NoBounds<i32>>();
|
assert::<NoBounds<i32>>();
|
||||||
|
|
||||||
@ -175,8 +182,8 @@ fn test_gen() {
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct OptionStatic<'a> {
|
struct OptionStatic<'a> {
|
||||||
a: Option<&'a str>,
|
a: StdOption<&'a str>,
|
||||||
b: Option<&'static str>,
|
b: StdOption<&'static str>,
|
||||||
}
|
}
|
||||||
assert_ser::<OptionStatic>();
|
assert_ser::<OptionStatic>();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user