Skip to content

Commit

Permalink
Fix wording in comments from PR 2558
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 22, 2024
1 parent d4486be commit 00460b8
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 101 deletions.
2 changes: 1 addition & 1 deletion serde_derive/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ fn wrap_serialize_with(
quote_spanned!(serialize_with.span()=> {
#[doc(hidden)]
struct __SerializeWith #wrapper_impl_generics #where_clause {
// If #field_tys is empty, `values` does not used
// If #field_tys is empty, this field is unused
#[allow(dead_code)]
values: (#(&'__a #field_tys, )*),
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! Ensures that error message points to the path in attribute
// Tests that type error 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 variants do not use the provided path, so it is forbidden here
// Newtype(#[serde(default = "main")] u8),
Tuple(u8, #[serde(default = "main")] i8),
Struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:9:33
|
4 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:10:33
|
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
9 | Tuple(u8, #[serde(default = "main")] i8),
| ^^^^^^ expected `i8`, found `()`
10 | Tuple(u8, #[serde(default = "main")] i8),
| ^^^^^^ expected `i8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:11:27
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:12:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
11 | #[serde(default = "main")]
12 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:14:27
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:15:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
14 | #[serde(default = "main")]
15 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()`
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//! Ensures that error message points to the path in attribute
// Tests that type error 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 variants do not use the provided path, so it is forbidden here
// Newtype(#[serde(default = "main")] u8),
Tuple(u8, #[serde(default = "main")] i8),
Struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:8:33
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:9:33
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
8 | Tuple(u8, #[serde(default = "main")] i8),
9 | Tuple(u8, #[serde(default = "main")] i8),
| ^^^^^^ expected `i8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:10:27
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:11:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
10 | #[serde(default = "main")]
11 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:13:27
--> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:14:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
13 | #[serde(default = "main")]
14 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()`
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! Ensures that error message points to the path in attribute
// Tests that type error 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 variants do not use the provided path, so it is forbidden here
// Newtype(#[serde(default = "main")] u8),
// Tuple variants does not supported in internally tagged enums
// Tuple variants are not supported in internally tagged enums
Struct {
#[serde(default = "main")]
f1: u8,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:11:27
--> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:12:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
11 | #[serde(default = "main")]
12 | #[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
--> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:15:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
14 | #[serde(default = "main")]
15 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()`
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! Ensures that error message points to the path in attribute
// Tests that type error 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 variants do not use the provided path, so it is forbidden here
// Newtype(#[serde(default = "main")] u8),
Tuple(u8, #[serde(default = "main")] i8),
Struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:9:33
|
4 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:10:33
|
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
9 | Tuple(u8, #[serde(default = "main")] i8),
| ^^^^^^ expected `i8`, found `()`
10 | Tuple(u8, #[serde(default = "main")] i8),
| ^^^^^^ expected `i8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:11:27
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:12:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
11 | #[serde(default = "main")]
12 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:14:27
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:15:27
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
14 | #[serde(default = "main")]
15 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Ensures that error message points to the path in attribute
// Tests that type error points to the path in attribute

use serde_derive::Deserialize;

#[derive(Deserialize)]
Expand Down
26 changes: 13 additions & 13 deletions test_suite/tests/ui/default-attribute/incorrect_type_newtype.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_newtype.rs:5:19
--> tests/ui/default-attribute/incorrect_type_newtype.rs:6:19
|
5 | #[serde(default = "main")]
6 | #[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
--> tests/ui/default-attribute/incorrect_type_newtype.rs:7:34
|
4 | #[derive(Deserialize)]
5 | #[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);
6 | #[serde(default = "main")]
7 | struct Newtype(#[serde(default = "main")] u8);
| ^^^^^^ expected `u8`, found `()`

error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_newtype.rs:5:19
--> tests/ui/default-attribute/incorrect_type_newtype.rs:6:19
|
5 | #[serde(default = "main")]
6 | #[serde(default = "main")]
| ^^^^^^ expected `Newtype`, found `()`
6 | struct Newtype(#[serde(default = "main")] u8);
7 | struct Newtype(#[serde(default = "main")] u8);
| ------- expected due to this

error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_newtype.rs:6:34
--> tests/ui/default-attribute/incorrect_type_newtype.rs:7:34
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| ----------- expected due to the type of this binding
5 | #[serde(default = "main")]
6 | struct Newtype(#[serde(default = "main")] u8);
6 | #[serde(default = "main")]
7 | struct Newtype(#[serde(default = "main")] u8);
| ^^^^^^ expected `u8`, found `()`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Ensures that error message points to the path in attribute
// Tests that type error points to the path in attribute

use serde_derive::Deserialize;

#[derive(Deserialize)]
Expand Down
34 changes: 17 additions & 17 deletions test_suite/tests/ui/default-attribute/incorrect_type_struct.stderr
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_struct.rs:5:19
--> tests/ui/default-attribute/incorrect_type_struct.rs:6:19
|
5 | #[serde(default = "main")]
6 | #[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
--> tests/ui/default-attribute/incorrect_type_struct.rs:8:23
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
7 | #[serde(default = "main")]
8 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`

error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_struct.rs:10:23
--> tests/ui/default-attribute/incorrect_type_struct.rs:11:23
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
10 | #[serde(default = "main")]
11 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()`

error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_struct.rs:5:19
--> tests/ui/default-attribute/incorrect_type_struct.rs:6:19
|
5 | #[serde(default = "main")]
6 | #[serde(default = "main")]
| ^^^^^^ expected `Struct`, found `()`
6 | struct Struct {
7 | struct Struct {
| ------ expected due to this

error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_struct.rs:7:23
--> tests/ui/default-attribute/incorrect_type_struct.rs:8:23
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| ----------- expected due to the type of this binding
...
7 | #[serde(default = "main")]
8 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`

error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_struct.rs:10:23
--> tests/ui/default-attribute/incorrect_type_struct.rs:11:23
|
4 | #[derive(Deserialize)]
5 | #[derive(Deserialize)]
| ----------- expected due to the type of this binding
...
10 | #[serde(default = "main")]
11 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Ensures that error message points to the path in attribute
// Tests that type error points to the path in attribute

use serde_derive::Deserialize;

#[derive(Deserialize)]
Expand Down
Loading

0 comments on commit 00460b8

Please sign in to comment.