mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 02:41:04 +00:00
Add tests that ensures that error reported for a path for with and default attributes
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(tag = "tag", content = "content")]
|
||||||
|
enum Enum {
|
||||||
|
// Newtype variants does not use the provided path, so it is forbidden here
|
||||||
|
// Newtype(#[serde(default = "main")] u8),
|
||||||
|
Tuple(
|
||||||
|
u8,
|
||||||
|
#[serde(default = "main")] i8,
|
||||||
|
),
|
||||||
|
Struct {
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f1: u8,
|
||||||
|
f2: u8,
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f3: i8,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:11:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
11 | #[serde(default = "main")] i8,
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:14:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `u8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
14 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:17:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
17 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
enum Enum {
|
||||||
|
// Newtype variants does not use the provided path, so it is forbidden here
|
||||||
|
// Newtype(#[serde(default = "main")] u8),
|
||||||
|
Tuple(
|
||||||
|
u8,
|
||||||
|
#[serde(default = "main")] i8,
|
||||||
|
),
|
||||||
|
Struct {
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f1: u8,
|
||||||
|
f2: u8,
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f3: i8,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:10:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
10 | #[serde(default = "main")] i8,
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:13:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `u8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
13 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:16:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
16 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(tag = "tag")]
|
||||||
|
enum Enum {
|
||||||
|
// Newtype variants does not use the provided path, so it is forbidden here
|
||||||
|
// Newtype(#[serde(default = "main")] u8),
|
||||||
|
// Tuple variants does not supported in internally tagged enums
|
||||||
|
Struct {
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f1: u8,
|
||||||
|
f2: u8,
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f3: i8,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:11:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `u8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
11 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:14:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
14 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
enum Enum {
|
||||||
|
// Newtype variants does not use the provided path, so it is forbidden here
|
||||||
|
// Newtype(#[serde(default = "main")] u8),
|
||||||
|
Tuple(
|
||||||
|
u8,
|
||||||
|
#[serde(default = "main")] i8,
|
||||||
|
),
|
||||||
|
Struct {
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f1: u8,
|
||||||
|
f2: u8,
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f3: i8,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:11:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
11 | #[serde(default = "main")] i8,
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:14:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `u8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
14 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:17:27
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
17 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(default = "main")]
|
||||||
|
struct Newtype(#[serde(default = "main")] u8);
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_newtype.rs:5:19
|
||||||
|
|
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `Newtype`, found `()`
|
||||||
|
| expected due to this
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_newtype.rs:6:34
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `u8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
6 | struct Newtype(#[serde(default = "main")] u8);
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_newtype.rs:5:19
|
||||||
|
|
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `Newtype`, found `()`
|
||||||
|
6 | struct Newtype(#[serde(default = "main")] u8);
|
||||||
|
| ------- expected due to this
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_newtype.rs:6:34
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| ----------- expected due to the type of this binding
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
6 | struct Newtype(#[serde(default = "main")] u8);
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(default = "main")]
|
||||||
|
struct Struct {
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f1: u8,
|
||||||
|
f2: u8,
|
||||||
|
#[serde(default = "main")]
|
||||||
|
f3: i8,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_struct.rs:5:19
|
||||||
|
|
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `Struct`, found `()`
|
||||||
|
| expected due to this
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_struct.rs:7:23
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `u8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
7 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_struct.rs:10:23
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
10 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_struct.rs:5:19
|
||||||
|
|
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `Struct`, found `()`
|
||||||
|
6 | struct Struct {
|
||||||
|
| ------ expected due to this
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_struct.rs:7:23
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| ----------- expected due to the type of this binding
|
||||||
|
...
|
||||||
|
7 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `u8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_struct.rs:10:23
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| ----------- expected due to the type of this binding
|
||||||
|
...
|
||||||
|
10 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
//! Ensures that error message points to the path in attribute
|
||||||
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(default = "main")]
|
||||||
|
struct Tuple(
|
||||||
|
u8,
|
||||||
|
#[serde(default = "main")] i8,
|
||||||
|
);
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_tuple.rs:5:19
|
||||||
|
|
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^
|
||||||
|
| |
|
||||||
|
| expected `Tuple`, found `()`
|
||||||
|
| expected due to this
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_tuple.rs:8:23
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| -----------
|
||||||
|
| |
|
||||||
|
| this is found to be of type `i8`
|
||||||
|
| `match` arms have incompatible types
|
||||||
|
...
|
||||||
|
8 | #[serde(default = "main")] i8,
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_tuple.rs:5:19
|
||||||
|
|
|
||||||
|
5 | #[serde(default = "main")]
|
||||||
|
| ^^^^^^ expected `Tuple`, found `()`
|
||||||
|
6 | struct Tuple(
|
||||||
|
| ----- expected due to this
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> tests/ui/default-attribute/incorrect_type_tuple.rs:8:23
|
||||||
|
|
|
||||||
|
4 | #[derive(Deserialize)]
|
||||||
|
| ----------- expected due to the type of this binding
|
||||||
|
...
|
||||||
|
8 | #[serde(default = "main")] i8,
|
||||||
|
| ^^^^^^ expected `i8`, found `()`
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
mod w {
|
||||||
|
use serde::{Deserializer, Serializer};
|
||||||
|
|
||||||
|
pub fn deserialize<'de, D: Deserializer<'de>>(_: D) -> Result<(), D::Error> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
struct W(#[serde(with = "w")] u8, u8);
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
struct S(#[serde(serialize_with = "w::serialize")] u8, u8);
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
struct D(#[serde(deserialize_with = "w::deserialize")] u8, u8);
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
error[E0277]: the trait bound `&u8: Serializer` is not satisfied
|
||||||
|
--> tests/ui/with/incorrect_type.rs:14:10
|
||||||
|
|
|
||||||
|
14 | #[derive(Serialize, Deserialize)]
|
||||||
|
| ^^^^^^^^^ the trait `Serializer` is not implemented for `&u8`
|
||||||
|
15 | struct W(#[serde(with = "w")] u8, u8);
|
||||||
|
| --- required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the following other types implement trait `Serializer`:
|
||||||
|
&'a mut Formatter<'b>
|
||||||
|
FlatMapSerializer<'a, M>
|
||||||
|
_::_serde::__private::ser::content::ContentSerializer<E>
|
||||||
|
note: required by a bound in `w::serialize`
|
||||||
|
--> tests/ui/with/incorrect_type.rs:9:28
|
||||||
|
|
|
||||||
|
9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {
|
||||||
|
| ^^^^^^^^^^ required by this bound in `serialize`
|
||||||
|
|
||||||
|
error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||||
|
--> tests/ui/with/incorrect_type.rs:15:25
|
||||||
|
|
|
||||||
|
15 | struct W(#[serde(with = "w")] u8, u8);
|
||||||
|
| ^^^ unexpected argument #2 of type `__S`
|
||||||
|
|
|
||||||
|
note: function defined here
|
||||||
|
--> tests/ui/with/incorrect_type.rs:9:12
|
||||||
|
|
|
||||||
|
9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {
|
||||||
|
| ^^^^^^^^^ ----
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `&u8: Serializer` is not satisfied
|
||||||
|
--> tests/ui/with/incorrect_type.rs:15:25
|
||||||
|
|
|
||||||
|
15 | struct W(#[serde(with = "w")] u8, u8);
|
||||||
|
| ^^^ the trait `Serializer` is not implemented for `&u8`
|
||||||
|
|
|
||||||
|
= help: the following other types implement trait `Serializer`:
|
||||||
|
&'a mut Formatter<'b>
|
||||||
|
FlatMapSerializer<'a, M>
|
||||||
|
_::_serde::__private::ser::content::ContentSerializer<E>
|
||||||
|
|
||||||
|
error[E0308]: `?` operator has incompatible types
|
||||||
|
--> tests/ui/with/incorrect_type.rs:15:25
|
||||||
|
|
|
||||||
|
15 | struct W(#[serde(with = "w")] u8, u8);
|
||||||
|
| ^^^ expected `u8`, found `()`
|
||||||
|
|
|
||||||
|
= note: `?` operator cannot convert from `()` to `u8`
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `&u8: Serializer` is not satisfied
|
||||||
|
--> tests/ui/with/incorrect_type.rs:17:10
|
||||||
|
|
|
||||||
|
17 | #[derive(Serialize, Deserialize)]
|
||||||
|
| ^^^^^^^^^ the trait `Serializer` is not implemented for `&u8`
|
||||||
|
18 | struct S(#[serde(serialize_with = "w::serialize")] u8, u8);
|
||||||
|
| -------------- required by a bound introduced by this call
|
||||||
|
|
|
||||||
|
= help: the following other types implement trait `Serializer`:
|
||||||
|
&'a mut Formatter<'b>
|
||||||
|
FlatMapSerializer<'a, M>
|
||||||
|
_::_serde::__private::ser::content::ContentSerializer<E>
|
||||||
|
note: required by a bound in `w::serialize`
|
||||||
|
--> tests/ui/with/incorrect_type.rs:9:28
|
||||||
|
|
|
||||||
|
9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {
|
||||||
|
| ^^^^^^^^^^ required by this bound in `serialize`
|
||||||
|
|
||||||
|
error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||||
|
--> tests/ui/with/incorrect_type.rs:18:35
|
||||||
|
|
|
||||||
|
18 | struct S(#[serde(serialize_with = "w::serialize")] u8, u8);
|
||||||
|
| ^^^^^^^^^^^^^^ unexpected argument #2 of type `__S`
|
||||||
|
|
|
||||||
|
note: function defined here
|
||||||
|
--> tests/ui/with/incorrect_type.rs:9:12
|
||||||
|
|
|
||||||
|
9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {
|
||||||
|
| ^^^^^^^^^ ----
|
||||||
|
|
||||||
|
error[E0277]: the trait bound `&u8: Serializer` is not satisfied
|
||||||
|
--> tests/ui/with/incorrect_type.rs:18:35
|
||||||
|
|
|
||||||
|
18 | struct S(#[serde(serialize_with = "w::serialize")] u8, u8);
|
||||||
|
| ^^^^^^^^^^^^^^ the trait `Serializer` is not implemented for `&u8`
|
||||||
|
|
|
||||||
|
= help: the following other types implement trait `Serializer`:
|
||||||
|
&'a mut Formatter<'b>
|
||||||
|
FlatMapSerializer<'a, M>
|
||||||
|
_::_serde::__private::ser::content::ContentSerializer<E>
|
||||||
|
|
||||||
|
error[E0308]: `?` operator has incompatible types
|
||||||
|
--> tests/ui/with/incorrect_type.rs:21:37
|
||||||
|
|
|
||||||
|
21 | struct D(#[serde(deserialize_with = "w::deserialize")] u8, u8);
|
||||||
|
| ^^^^^^^^^^^^^^^^ expected `u8`, found `()`
|
||||||
|
|
|
||||||
|
= note: `?` operator cannot convert from `()` to `u8`
|
||||||
Reference in New Issue
Block a user