Skip to content

Commit

Permalink
Merge #2850
Browse files Browse the repository at this point in the history
2850: fix: Add test for flattening struct in enum r=epage a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
  • Loading branch information
bors[bot] and pksunkara committed Oct 11, 2021
2 parents 562e64c + 685601e commit c2ebcf1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied
--> $DIR/flatten_on_subcommand.rs:3:12
--> $DIR/flatten_enum_in_struct.rs:3:12
|
3 | #[clap(flatten)]
| ^^^^^^^ the trait `clap::Args` is not implemented for `SubCmd`
Expand Down
10 changes: 10 additions & 0 deletions clap_derive/tests/ui/flatten_struct_in_enum.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#[derive(clap::Parser)]
enum Opt {
#[clap(flatten)]
Sub(SubCmd),
}

#[derive(clap::Parser)]
struct SubCmd {}

fn main() {}
26 changes: 26 additions & 0 deletions clap_derive/tests/ui/flatten_struct_in_enum.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
error[E0277]: the trait bound `SubCmd: Subcommand` is not satisfied
--> $DIR/flatten_struct_in_enum.rs:1:10
|
1 | #[derive(clap::Parser)]
| ^^^^^^^^^^^^ the trait `Subcommand` is not implemented for `SubCmd`
|
= note: required by `has_subcommand`
= note: this error originates in the derive macro `clap::Parser` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `SubCmd: Subcommand` is not satisfied
--> $DIR/flatten_struct_in_enum.rs:1:10
|
1 | #[derive(clap::Parser)]
| ^^^^^^^^^^^^ the trait `Subcommand` is not implemented for `SubCmd`
|
= note: required by `augment_subcommands`
= note: this error originates in the derive macro `clap::Parser` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `SubCmd: Subcommand` is not satisfied
--> $DIR/flatten_struct_in_enum.rs:1:10
|
1 | #[derive(clap::Parser)]
| ^^^^^^^^^^^^ the trait `Subcommand` is not implemented for `SubCmd`
|
= note: required by `augment_subcommands_for_update`
= note: this error originates in the derive macro `clap::Parser` (in Nightly builds, run with -Z macro-backtrace for more info)

0 comments on commit c2ebcf1

Please sign in to comment.