This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix derive for empty enums Update derive & ui tests clean up Apply suggestions from code review Co-authored-by: Bastian Köcher <[email protected]> rename variable
- Loading branch information
Showing
13 changed files
with
244 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
frame/support/test/tests/derive_no_bound_ui/default_empty_enum.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#[derive(frame_support::DefaultNoBound)] | ||
enum Empty {} | ||
|
||
fn main() {} |
5 changes: 5 additions & 0 deletions
5
frame/support/test/tests/derive_no_bound_ui/default_empty_enum.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: cannot derive Default for an empty enum | ||
--> tests/derive_no_bound_ui/default_empty_enum.rs:2:6 | ||
| | ||
2 | enum Empty {} | ||
| ^^^^^ |
11 changes: 11 additions & 0 deletions
11
frame/support/test/tests/derive_no_bound_ui/default_no_attribute.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
trait Config { | ||
type C; | ||
} | ||
|
||
#[derive(frame_support::DefaultNoBound)] | ||
enum Foo<T: Config> { | ||
Bar(T::C), | ||
Baz, | ||
} | ||
|
||
fn main() {} |
5 changes: 5 additions & 0 deletions
5
frame/support/test/tests/derive_no_bound_ui/default_no_attribute.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: no default declared, make a variant default by placing `#[default]` above it | ||
--> tests/derive_no_bound_ui/default_no_attribute.rs:6:6 | ||
| | ||
6 | enum Foo<T: Config> { | ||
| ^^^ |
13 changes: 13 additions & 0 deletions
13
frame/support/test/tests/derive_no_bound_ui/default_too_many_attributes.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
trait Config { | ||
type C; | ||
} | ||
|
||
#[derive(frame_support::DefaultNoBound)] | ||
enum Foo<T: Config> { | ||
#[default] | ||
Bar(T::C), | ||
#[default] | ||
Baz, | ||
} | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
frame/support/test/tests/derive_no_bound_ui/default_too_many_attributes.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error: multiple declared defaults | ||
--> tests/derive_no_bound_ui/default_too_many_attributes.rs:5:10 | ||
| | ||
5 | #[derive(frame_support::DefaultNoBound)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `frame_support::DefaultNoBound` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: first default | ||
--> tests/derive_no_bound_ui/default_too_many_attributes.rs:7:2 | ||
| | ||
7 | / #[default] | ||
8 | | Bar(T::C), | ||
| |_____________^ | ||
|
||
error: additional default | ||
--> tests/derive_no_bound_ui/default_too_many_attributes.rs:9:2 | ||
| | ||
9 | / #[default] | ||
10 | | Baz, | ||
| |_______^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#[derive(frame_support::DefaultNoBound)] | ||
union Foo { | ||
field1: u32, | ||
field2: (), | ||
} | ||
|
||
fn main() {} |
5 changes: 5 additions & 0 deletions
5
frame/support/test/tests/derive_no_bound_ui/default_union.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: Union type not supported by `derive(DefaultNoBound)` | ||
--> tests/derive_no_bound_ui/default_union.rs:2:1 | ||
| | ||
2 | union Foo { | ||
| ^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters