diff options
Diffstat (limited to 'vendor/darling-0.14.4/tests/compile-fail')
6 files changed, 121 insertions, 0 deletions
diff --git a/vendor/darling-0.14.4/tests/compile-fail/default_expr_wrong_type.rs b/vendor/darling-0.14.4/tests/compile-fail/default_expr_wrong_type.rs new file mode 100644 index 000000000..cd9a0fd1e --- /dev/null +++ b/vendor/darling-0.14.4/tests/compile-fail/default_expr_wrong_type.rs @@ -0,0 +1,12 @@ +use darling::FromMeta; + +#[derive(FromMeta)] +struct Receiver { + #[darling(default = "usize::default")] + not_u32: String, + + #[darling(multiple, default = "usize::default")] + also_not_u32: Vec<String>, +} + +fn main() {} diff --git a/vendor/darling-0.14.4/tests/compile-fail/default_expr_wrong_type.stderr b/vendor/darling-0.14.4/tests/compile-fail/default_expr_wrong_type.stderr new file mode 100644 index 000000000..a8b7c502b --- /dev/null +++ b/vendor/darling-0.14.4/tests/compile-fail/default_expr_wrong_type.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> tests/compile-fail/default_expr_wrong_type.rs:5:25 + | +5 | #[darling(default = "usize::default")] + | ^^^^^^^^^^^^^^^^ expected struct `String`, found `usize` + | +help: try using a conversion method + | +5 | #[darling(default = "usize::default".to_string())] + | ++++++++++++ +5 | #[darling(default = "usize::default".to_string())] + | ++++++++++++ + +error[E0308]: mismatched types + --> tests/compile-fail/default_expr_wrong_type.rs:8:35 + | +8 | #[darling(multiple, default = "usize::default")] + | ^^^^^^^^^^^^^^^^ expected struct `Vec`, found `usize` + | + = note: expected struct `Vec<String>` + found type `usize` diff --git a/vendor/darling-0.14.4/tests/compile-fail/not_impl_from_meta.rs b/vendor/darling-0.14.4/tests/compile-fail/not_impl_from_meta.rs new file mode 100644 index 000000000..f27d71639 --- /dev/null +++ b/vendor/darling-0.14.4/tests/compile-fail/not_impl_from_meta.rs @@ -0,0 +1,16 @@ +use darling::FromMeta; + +struct NotImplFm; + +#[derive(FromMeta)] +struct OuterFm { + inner: NotImplFm, +} + +#[derive(darling::FromDeriveInput)] +#[darling(attributes(hello))] +struct OuterFdi { + inner: NotImplFm, +} + +fn main() {} diff --git a/vendor/darling-0.14.4/tests/compile-fail/not_impl_from_meta.stderr b/vendor/darling-0.14.4/tests/compile-fail/not_impl_from_meta.stderr new file mode 100644 index 000000000..a166a6fcf --- /dev/null +++ b/vendor/darling-0.14.4/tests/compile-fail/not_impl_from_meta.stderr @@ -0,0 +1,33 @@ +error[E0277]: the trait bound `NotImplFm: FromMeta` is not satisfied + --> tests/compile-fail/not_impl_from_meta.rs:7:12 + | +7 | inner: NotImplFm, + | ^^^^^^^^^ the trait `FromMeta` is not implemented for `NotImplFm` + | + = help: the following other types implement trait `FromMeta`: + () + Arc<T> + AtomicBool + ExprArray + ExprPath + Flag + HashMap<String, V, S> + HashMap<proc_macro2::Ident, V, S> + and $N others + +error[E0277]: the trait bound `NotImplFm: FromMeta` is not satisfied + --> tests/compile-fail/not_impl_from_meta.rs:13:12 + | +13 | inner: NotImplFm, + | ^^^^^^^^^ the trait `FromMeta` is not implemented for `NotImplFm` + | + = help: the following other types implement trait `FromMeta`: + () + Arc<T> + AtomicBool + ExprArray + ExprPath + Flag + HashMap<String, V, S> + HashMap<proc_macro2::Ident, V, S> + and $N others diff --git a/vendor/darling-0.14.4/tests/compile-fail/skip_field_not_impl_default.rs b/vendor/darling-0.14.4/tests/compile-fail/skip_field_not_impl_default.rs new file mode 100644 index 000000000..f0d44c779 --- /dev/null +++ b/vendor/darling-0.14.4/tests/compile-fail/skip_field_not_impl_default.rs @@ -0,0 +1,18 @@ +use darling::FromMeta; + +#[derive(FromMeta)] +struct NoDefault(String); + +#[derive(FromMeta)] +struct Recevier { + #[darling(skip)] + skipped: NoDefault, + + #[darling(skip = true)] + explicitly_skipped: NoDefault, + + #[darling(skip = false)] + not_skipped_no_problem: NoDefault, +} + +fn main() {} diff --git a/vendor/darling-0.14.4/tests/compile-fail/skip_field_not_impl_default.stderr b/vendor/darling-0.14.4/tests/compile-fail/skip_field_not_impl_default.stderr new file mode 100644 index 000000000..de46982c2 --- /dev/null +++ b/vendor/darling-0.14.4/tests/compile-fail/skip_field_not_impl_default.stderr @@ -0,0 +1,21 @@ +error[E0277]: the trait bound `NoDefault: std::default::Default` is not satisfied + --> tests/compile-fail/skip_field_not_impl_default.rs:8:15 + | +8 | #[darling(skip)] + | ^^^^ the trait `std::default::Default` is not implemented for `NoDefault` + | +help: consider annotating `NoDefault` with `#[derive(Default)]` + | +4 | #[derive(Default)] + | + +error[E0277]: the trait bound `NoDefault: std::default::Default` is not satisfied + --> tests/compile-fail/skip_field_not_impl_default.rs:11:22 + | +11 | #[darling(skip = true)] + | ^^^^ the trait `std::default::Default` is not implemented for `NoDefault` + | +help: consider annotating `NoDefault` with `#[derive(Default)]` + | +4 | #[derive(Default)] + | |