Skip to content

Commit

Permalink
Ui tests with compile_error resolved at call site
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 8, 2023
1 parent 1aebdc2 commit e77db40
Show file tree
Hide file tree
Showing 92 changed files with 467 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test_suite/tests/ui/borrow/bad_lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: failed to parse borrowed lifetimes: "zzz"
--> tests/ui/borrow/bad_lifetimes.rs:5:22
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | struct Test<'a> {
5 | #[serde(borrow = "zzz")]
| ^^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/borrow/duplicate_lifetime.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate borrowed lifetime `'a`
--> tests/ui/borrow/duplicate_lifetime.rs:5:22
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | struct Test<'a> {
5 | #[serde(borrow = "'a + 'a")]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/borrow/duplicate_variant.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate serde attribute `borrow`
--> tests/ui/borrow/duplicate_variant.rs:9:15
|
6 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
...
9 | S(#[serde(borrow)] Str<'a>),
| ^^^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
10 changes: 10 additions & 0 deletions test_suite/tests/ui/borrow/empty_lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
error: at least one lifetime must be borrowed
--> tests/ui/borrow/empty_lifetimes.rs:5:22
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | struct Test<'a> {
5 | #[serde(borrow = "")]
| ^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error: at least one lifetime must be borrowed
--> tests/ui/borrow/empty_lifetimes.rs:7:22
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
...
7 | #[serde(borrow = " ")]
| ^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/borrow/no_lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
error: field `s` has no lifetimes to borrow
--> tests/ui/borrow/no_lifetimes.rs:5:5
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | struct Test {
5 | / #[serde(borrow)]
6 | | s: String,
| |_____________^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/borrow/struct_variant.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
error: #[serde(borrow)] may only be used on newtype variants
--> tests/ui/borrow/struct_variant.rs:8:5
|
6 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
7 | enum Test<'a> {
8 | / #[serde(borrow)]
9 | | S { s: Str<'a> },
| |____________________^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/borrow/wrong_lifetime.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
error: field `s` does not have lifetime 'b
--> tests/ui/borrow/wrong_lifetime.rs:5:5
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | struct Test<'a> {
5 | / #[serde(borrow = "'b")]
6 | | s: &'a str,
| |______________^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/conflict/adjacent-tag.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
error: enum tags `conflict` for type and content conflict with each other
--> tests/ui/conflict/adjacent-tag.rs:4:1
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | / #[serde(tag = "conflict", content = "conflict")]
5 | | enum E {
6 | | A,
7 | | B,
8 | | }
| |_^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/conflict/flatten-newtype-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
error: #[serde(flatten)] cannot be used on newtype structs
--> tests/ui/conflict/flatten-newtype-struct.rs:6:12
|
5 | #[derive(Serialize)]
| --------- in this derive macro expansion
6 | struct Foo(#[serde(flatten)] HashMap<String, String>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/conflict/flatten-tuple-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
error: #[serde(flatten)] cannot be used on tuple structs
--> tests/ui/conflict/flatten-tuple-struct.rs:6:17
|
5 | #[derive(Serialize)]
| --------- in this derive macro expansion
6 | struct Foo(u32, #[serde(flatten)] HashMap<String, String>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/conflict/from-try-from.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
error: #[serde(from = "...")] and #[serde(try_from = "...")] conflict with each other
--> tests/ui/conflict/from-try-from.rs:4:1
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | / #[serde(from = "u64", try_from = "u64")]
5 | | struct S {
6 | | a: u8,
7 | | }
| |_^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/conflict/internal-tag-alias.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error: variant field name `conflict` conflicts with internal tag
--> tests/ui/conflict/internal-tag-alias.rs:4:1
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | / #[serde(tag = "conflict")]
5 | | enum E {
6 | | A {
Expand All @@ -9,3 +11,5 @@ error: variant field name `conflict` conflicts with internal tag
9 | | },
10 | | }
| |_^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/conflict/internal-tag.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error: variant field name `conflict` conflicts with internal tag
--> tests/ui/conflict/internal-tag.rs:4:1
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | / #[serde(tag = "conflict")]
5 | | enum E {
6 | | A {
Expand All @@ -9,3 +11,5 @@ error: variant field name `conflict` conflicts with internal tag
9 | | },
10 | | }
| |_^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/default-attribute/enum.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: #[serde(default)] can only be used on structs with named fields
--> tests/ui/default-attribute/enum.rs:5:1
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | #[serde(default)]
5 | enum E {
| ^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/default-attribute/enum_path.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: #[serde(default = "...")] can only be used on structs with named fields
--> tests/ui/default-attribute/enum_path.rs:5:1
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | #[serde(default = "default_e")]
5 | enum E {
| ^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: #[serde(default)] can only be used on structs with named fields
--> tests/ui/default-attribute/nameless_struct_fields.rs:5:9
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | #[serde(default)]
5 | struct T(u8, u8);
| ^^^^^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: #[serde(default = "...")] can only be used on structs with named fields
--> tests/ui/default-attribute/nameless_struct_fields_path.rs:5:9
|
3 | #[derive(Deserialize)]
| ----------- in this derive macro expansion
4 | #[serde(default = "default_t")]
5 | struct T(u8, u8);
| ^^^^^^^^
|
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/duplicate-attribute/rename-and-ser.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: unknown serde field attribute `serialize`
--> tests/ui/duplicate-attribute/rename-and-ser.rs:5:27
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | struct S {
5 | #[serde(rename = "x", serialize = "y")]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate serde attribute `rename`
--> tests/ui/duplicate-attribute/rename-ser-rename-ser.rs:5:38
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | struct S {
5 | #[serde(rename(serialize = "x"), rename(serialize = "y"))]
| ^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate serde attribute `rename`
--> tests/ui/duplicate-attribute/rename-ser-rename.rs:6:13
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
...
6 | #[serde(rename = "y")]
| ^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/duplicate-attribute/rename-ser-ser.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate serde attribute `rename`
--> tests/ui/duplicate-attribute/rename-ser-ser.rs:5:37
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | struct S {
5 | #[serde(rename(serialize = "x", serialize = "y"))]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/duplicate-attribute/two-rename-ser.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate serde attribute `rename`
--> tests/ui/duplicate-attribute/two-rename-ser.rs:6:13
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
...
6 | #[serde(rename(serialize = "y"))]
| ^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: duplicate serde attribute `serialize_with`
--> tests/ui/duplicate-attribute/with-and-serialize-with.rs:5:25
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | struct S {
5 | #[serde(with = "w", serialize_with = "s")]
| ^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
4 changes: 4 additions & 0 deletions test_suite/tests/ui/enum-representation/content-no-tag.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
error: #[serde(tag = "...", content = "...")] must be used together
--> tests/ui/enum-representation/content-no-tag.rs:4:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(content = "c")]
| ^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: #[serde(tag = "...")] cannot be used with tuple variants
--> tests/ui/enum-representation/internal-tuple-variant.rs:6:5
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
...
6 | Tuple(u8, u8),
| ^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
error: untagged enum cannot have #[serde(tag = "...", content = "...")]
--> tests/ui/enum-representation/untagged-and-adjacent.rs:4:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
| ^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error: untagged enum cannot have #[serde(tag = "...", content = "...")]
--> tests/ui/enum-representation/untagged-and-adjacent.rs:5:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
5 | #[serde(tag = "t", content = "c")]
| ^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error: untagged enum cannot have #[serde(tag = "...", content = "...")]
--> tests/ui/enum-representation/untagged-and-adjacent.rs:5:20
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
5 | #[serde(tag = "t", content = "c")]
| ^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
error: untagged enum cannot have #[serde(content = "...")]
--> tests/ui/enum-representation/untagged-and-content.rs:4:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
| ^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error: untagged enum cannot have #[serde(content = "...")]
--> tests/ui/enum-representation/untagged-and-content.rs:5:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
5 | #[serde(content = "c")]
| ^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
error: enum cannot be both untagged and internally tagged
--> tests/ui/enum-representation/untagged-and-internal.rs:4:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
| ^^^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

error: enum cannot be both untagged and internally tagged
--> tests/ui/enum-representation/untagged-and-internal.rs:5:9
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
5 | #[serde(tag = "type")]
| ^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: #[serde(untagged)] can only be used on enums
--> tests/ui/enum-representation/untagged-struct.rs:5:1
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | #[serde(untagged)]
5 | struct S;
| ^^^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
5 changes: 5 additions & 0 deletions test_suite/tests/ui/expected-string/boolean.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
error: expected serde rename attribute to be a string: `rename = "..."`
--> tests/ui/expected-string/boolean.rs:5:22
|
3 | #[derive(Serialize)]
| --------- in this derive macro expansion
4 | struct S {
5 | #[serde(rename = true)]
| ^^^^
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
Loading

0 comments on commit e77db40

Please sign in to comment.