Fix wording in comments from PR 2558

This commit is contained in:
David Tolnay
2024-10-21 19:41:43 -07:00
parent d4486be2b9
commit 00460b8dee
15 changed files with 132 additions and 125 deletions
+1 -1
View File
@@ -1227,7 +1227,7 @@ fn wrap_serialize_with(
quote_spanned!(serialize_with.span()=> { quote_spanned!(serialize_with.span()=> {
#[doc(hidden)] #[doc(hidden)]
struct __SerializeWith #wrapper_impl_generics #where_clause { 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)] #[allow(dead_code)]
values: (#(&'__a #field_tys, )*), values: (#(&'__a #field_tys, )*),
phantom: _serde::__private::PhantomData<#this_type #ty_generics>, phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(tag = "tag", content = "content")] #[serde(tag = "tag", content = "content")]
enum Enum { 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), // Newtype(#[serde(default = "main")] u8),
Tuple(u8, #[serde(default = "main")] i8), Tuple(u8, #[serde(default = "main")] i8),
Struct { Struct {
@@ -1,35 +1,35 @@
error[E0308]: `match` arms have incompatible types error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:9:33 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:10:33
|
4 | #[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 `()`
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:11:27
| |
4 | #[derive(Deserialize)] 5 | #[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_adjacently_tagged.rs:14:27
|
4 | #[derive(Deserialize)]
| ----------- | -----------
| | | |
| this is found to be of type `i8` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
14 | #[serde(default = "main")] 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:12:27
|
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
12 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:15:27
|
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
15 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
enum Enum { 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), // Newtype(#[serde(default = "main")] u8),
Tuple(u8, #[serde(default = "main")] i8), Tuple(u8, #[serde(default = "main")] i8),
Struct { Struct {
@@ -1,35 +1,35 @@
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
8 | Tuple(u8, #[serde(default = "main")] i8), 9 | Tuple(u8, #[serde(default = "main")] i8),
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `u8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
10 | #[serde(default = "main")] 11 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()` | ^^^^^^ expected `u8`, found `()`
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
13 | #[serde(default = "main")] 14 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(tag = "tag")] #[serde(tag = "tag")]
enum Enum { 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), // Newtype(#[serde(default = "main")] u8),
// Tuple variants does not supported in internally tagged enums // Tuple variants are not supported in internally tagged enums
Struct { Struct {
#[serde(default = "main")] #[serde(default = "main")]
f1: u8, f1: u8,
@@ -1,23 +1,23 @@
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `u8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
11 | #[serde(default = "main")] 12 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()` | ^^^^^^ expected `u8`, found `()`
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
14 | #[serde(default = "main")] 15 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(untagged)] #[serde(untagged)]
enum Enum { 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), // Newtype(#[serde(default = "main")] u8),
Tuple(u8, #[serde(default = "main")] i8), Tuple(u8, #[serde(default = "main")] i8),
Struct { Struct {
@@ -1,35 +1,35 @@
error[E0308]: `match` arms have incompatible types error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:9:33 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:10:33
|
4 | #[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 `()`
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:11:27
| |
4 | #[derive(Deserialize)] 5 | #[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_untagged.rs:14:27
|
4 | #[derive(Deserialize)]
| ----------- | -----------
| | | |
| this is found to be of type `i8` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
14 | #[serde(default = "main")] 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:12:27
|
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `u8`
| `match` arms have incompatible types
...
12 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()`
error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:15:27
|
5 | #[derive(Deserialize)]
| -----------
| |
| this is found to be of type `i8`
| `match` arms have incompatible types
...
15 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
@@ -1,37 +1,37 @@
error[E0308]: mismatched types 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 `Newtype`, found `()`
| expected due to this | expected due to this
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `u8`
| `match` arms have incompatible types | `match` arms have incompatible types
5 | #[serde(default = "main")] 6 | #[serde(default = "main")]
6 | struct Newtype(#[serde(default = "main")] u8); 7 | struct Newtype(#[serde(default = "main")] u8);
| ^^^^^^ expected `u8`, found `()` | ^^^^^^ expected `u8`, found `()`
error[E0308]: mismatched types 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 `Newtype`, found `()`
6 | struct Newtype(#[serde(default = "main")] u8); 7 | struct Newtype(#[serde(default = "main")] u8);
| ------- expected due to this | ------- expected due to this
error[E0308]: mismatched types 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 | ----------- expected due to the type of this binding
5 | #[serde(default = "main")] 6 | #[serde(default = "main")]
6 | struct Newtype(#[serde(default = "main")] u8); 7 | struct Newtype(#[serde(default = "main")] u8);
| ^^^^^^ expected `u8`, found `()` | ^^^^^^ expected `u8`, found `()`
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
@@ -1,58 +1,58 @@
error[E0308]: mismatched types 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 `Struct`, found `()`
| expected due to this | expected due to this
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `u8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
7 | #[serde(default = "main")] 8 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()` | ^^^^^^ expected `u8`, found `()`
error[E0308]: `match` arms have incompatible types 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` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
... ...
10 | #[serde(default = "main")] 11 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
error[E0308]: mismatched types 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 `Struct`, found `()`
6 | struct Struct { 7 | struct Struct {
| ------ expected due to this | ------ expected due to this
error[E0308]: mismatched types 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 | ----------- expected due to the type of this binding
... ...
7 | #[serde(default = "main")] 8 | #[serde(default = "main")]
| ^^^^^^ expected `u8`, found `()` | ^^^^^^ expected `u8`, found `()`
error[E0308]: mismatched types 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 | ----------- expected due to the type of this binding
... ...
10 | #[serde(default = "main")] 11 | #[serde(default = "main")]
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
@@ -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; use serde_derive::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
@@ -1,37 +1,37 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_tuple.rs:5:19 --> tests/ui/default-attribute/incorrect_type_tuple.rs:6:19
| |
5 | #[serde(default = "main")] 6 | #[serde(default = "main")]
| ^^^^^^ | ^^^^^^
| | | |
| expected `Tuple`, found `()` | expected `Tuple`, found `()`
| expected due to this | expected due to this
error[E0308]: `match` arms have incompatible types error[E0308]: `match` arms have incompatible types
--> tests/ui/default-attribute/incorrect_type_tuple.rs:6:36 --> tests/ui/default-attribute/incorrect_type_tuple.rs:7:36
| |
4 | #[derive(Deserialize)] 5 | #[derive(Deserialize)]
| ----------- | -----------
| | | |
| this is found to be of type `i8` | this is found to be of type `i8`
| `match` arms have incompatible types | `match` arms have incompatible types
5 | #[serde(default = "main")] 6 | #[serde(default = "main")]
6 | struct Tuple(u8, #[serde(default = "main")] i8); 7 | struct Tuple(u8, #[serde(default = "main")] i8);
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`
error[E0308]: mismatched types error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_tuple.rs:5:19 --> tests/ui/default-attribute/incorrect_type_tuple.rs:6:19
| |
5 | #[serde(default = "main")] 6 | #[serde(default = "main")]
| ^^^^^^ expected `Tuple`, found `()` | ^^^^^^ expected `Tuple`, found `()`
6 | struct Tuple(u8, #[serde(default = "main")] i8); 7 | struct Tuple(u8, #[serde(default = "main")] i8);
| ----- expected due to this | ----- expected due to this
error[E0308]: mismatched types error[E0308]: mismatched types
--> tests/ui/default-attribute/incorrect_type_tuple.rs:6:36 --> tests/ui/default-attribute/incorrect_type_tuple.rs:7:36
| |
4 | #[derive(Deserialize)] 5 | #[derive(Deserialize)]
| ----------- expected due to the type of this binding | ----------- expected due to the type of this binding
5 | #[serde(default = "main")] 6 | #[serde(default = "main")]
6 | struct Tuple(u8, #[serde(default = "main")] i8); 7 | struct Tuple(u8, #[serde(default = "main")] i8);
| ^^^^^^ expected `i8`, found `()` | ^^^^^^ expected `i8`, found `()`