Skip to content

Commit

Permalink
be explicit in darling support
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Oct 24, 2024
1 parent c66e601 commit a3294a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions miniconf/tests/ui/internal_no_leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub enum EnumEmpty {#[tree(skip)] V}
#[derive(Tree)]
pub struct StructUnit;

#[derive(Tree)]
pub struct StructUnitTuple ();

#[derive(Tree)]
pub struct StructEmptyTuple (#[tree(skip)] ());

Expand Down
22 changes: 15 additions & 7 deletions miniconf/tests/ui/internal_no_leaf.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,28 @@ error: Internal nodes must have at least one leaf
7 | pub enum EnumEmpty {#[tree(skip)] V}
| ^^^^^^^^^

error: Unsupported shape `no fields`. Expected named fields or unnamed fields.
--> tests/ui/internal_no_leaf.rs:9:10
|
9 | #[derive(Tree)]
| ^^^^
|
= note: this error originates in the derive macro `Tree` (in Nightly builds, run with -Z macro-backtrace for more info)

error: Internal nodes must have at least one leaf
--> tests/ui/internal_no_leaf.rs:10:12
--> tests/ui/internal_no_leaf.rs:13:12
|
10 | pub struct StructUnit;
| ^^^^^^^^^^
13 | pub struct StructUnitTuple ();
| ^^^^^^^^^^^^^^^

error: Internal nodes must have at least one leaf
--> tests/ui/internal_no_leaf.rs:13:12
--> tests/ui/internal_no_leaf.rs:16:12
|
13 | pub struct StructEmptyTuple (#[tree(skip)] ());
16 | pub struct StructEmptyTuple (#[tree(skip)] ());
| ^^^^^^^^^^^^^^^^

error: Internal nodes must have at least one leaf
--> tests/ui/internal_no_leaf.rs:16:12
--> tests/ui/internal_no_leaf.rs:19:12
|
16 | pub struct StructEmpty {#[tree(skip)] _f: ()}
19 | pub struct StructEmpty {#[tree(skip)] _f: ()}
| ^^^^^^^^^^^
2 changes: 1 addition & 1 deletion miniconf_derive/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl TreeVariant {
}

#[derive(Debug, FromDeriveInput, Clone)]
#[darling(attributes(tree), supports(any), and_then=Self::parse)]
#[darling(attributes(tree), supports(struct_named, struct_newtype, struct_tuple, enum_newtype, enum_tuple, enum_unit), and_then=Self::parse)]
#[darling()]
pub struct Tree {
ident: syn::Ident,
Expand Down

0 comments on commit a3294a3

Please sign in to comment.