From 83119f89bbafbf81613bef496dee49f0fe67a350 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Dec 2024 17:44:01 +0000 Subject: [PATCH] More tests --- .../ui/compile_fail/attr_getter.rs | 17 ++++ .../ui/compile_fail/attr_getter.stderr | 78 ++++++++++++------- 2 files changed, 65 insertions(+), 30 deletions(-) diff --git a/bon/tests/integration/ui/compile_fail/attr_getter.rs b/bon/tests/integration/ui/compile_fail/attr_getter.rs index 2a97d08d..5a6f85b1 100644 --- a/bon/tests/integration/ui/compile_fail/attr_getter.rs +++ b/bon/tests/integration/ui/compile_fail/attr_getter.rs @@ -75,6 +75,23 @@ struct NoDeref { x3: String, } +#[derive(Builder)] +struct CopyCloneExclusion { + #[builder(getter(copy, clone))] + x1: u32, +} + +#[derive(Builder)] +struct CopyDerefExclusion { + #[builder(getter(copy, deref))] + x1: u32, +} + +#[derive(Builder)] +struct CloneDerefExclusion { + #[builder(getter(clone, deref))] + x1: u32, +} fn main() { let builder = NegativeTest::builder(); diff --git a/bon/tests/integration/ui/compile_fail/attr_getter.stderr b/bon/tests/integration/ui/compile_fail/attr_getter.stderr index 55429f66..bf6acb13 100644 --- a/bon/tests/integration/ui/compile_fail/attr_getter.stderr +++ b/bon/tests/integration/ui/compile_fail/attr_getter.stderr @@ -22,6 +22,24 @@ error: `getter` attribute can't be specified together with `overwritable` 23 | #[builder(getter, overwritable)] | ^^^^^^ +error: `copy` can't be specified together with `clone` + --> tests/integration/ui/compile_fail/attr_getter.rs:80:22 + | +80 | #[builder(getter(copy, clone))] + | ^^^^ + +error: `copy` can't be specified together with `deref` + --> tests/integration/ui/compile_fail/attr_getter.rs:86:22 + | +86 | #[builder(getter(copy, deref))] + | ^^^^ + +error: `clone` can't be specified together with `deref` + --> tests/integration/ui/compile_fail/attr_getter.rs:92:22 + | +92 | #[builder(getter(clone, deref))] + | ^^^^^ + error[E0277]: the trait bound `String: std::marker::Copy` is not satisfied --> tests/integration/ui/compile_fail/attr_getter.rs:42:9 | @@ -161,9 +179,9 @@ note: tuple variant defined here = note: this error originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the member `Unset` was not set, but this method requires it to be set - --> tests/integration/ui/compile_fail/attr_getter.rs:82:13 + --> tests/integration/ui/compile_fail/attr_getter.rs:99:13 | -82 | builder.get_x1(); +99 | builder.get_x1(); | ^^^^^^ the member `Unset` was not set, but this method requires it to be set | = help: the trait `IsSet` is not implemented for `Unset` @@ -179,37 +197,37 @@ note: required by a bound in `NegativeTestBuilder::::get_x1` = note: this error originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the member `Unset` was not set, but this method requires it to be set - --> tests/integration/ui/compile_fail/attr_getter.rs:83:13 - | -83 | builder.get_x2(); - | ^^^^^^ the member `Unset` was not set, but this method requires it to be set - | - = help: the trait `IsSet` is not implemented for `Unset` - = help: the trait `IsSet` is implemented for `Set` + --> tests/integration/ui/compile_fail/attr_getter.rs:100:13 + | +100 | builder.get_x2(); + | ^^^^^^ the member `Unset` was not set, but this method requires it to be set + | + = help: the trait `IsSet` is not implemented for `Unset` + = help: the trait `IsSet` is implemented for `Set` note: required by a bound in `NegativeTestBuilder::::get_x2` - --> tests/integration/ui/compile_fail/attr_getter.rs:27:10 - | -27 | #[derive(Builder)] - | ^^^^^^^ required by this bound in `NegativeTestBuilder::::get_x2` + --> tests/integration/ui/compile_fail/attr_getter.rs:27:10 + | +27 | #[derive(Builder)] + | ^^^^^^^ required by this bound in `NegativeTestBuilder::::get_x2` ... -33 | x2: Option, - | -- required by a bound in this associated function - = note: this error originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info) +33 | x2: Option, + | -- required by a bound in this associated function + = note: this error originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the member `Unset` was not set, but this method requires it to be set - --> tests/integration/ui/compile_fail/attr_getter.rs:84:13 - | -84 | builder.get_x3(); - | ^^^^^^ the member `Unset` was not set, but this method requires it to be set - | - = help: the trait `IsSet` is not implemented for `Unset` - = help: the trait `IsSet` is implemented for `Set` + --> tests/integration/ui/compile_fail/attr_getter.rs:101:13 + | +101 | builder.get_x3(); + | ^^^^^^ the member `Unset` was not set, but this method requires it to be set + | + = help: the trait `IsSet` is not implemented for `Unset` + = help: the trait `IsSet` is implemented for `Set` note: required by a bound in `NegativeTestBuilder::::get_x3` - --> tests/integration/ui/compile_fail/attr_getter.rs:27:10 - | -27 | #[derive(Builder)] - | ^^^^^^^ required by this bound in `NegativeTestBuilder::::get_x3` + --> tests/integration/ui/compile_fail/attr_getter.rs:27:10 + | +27 | #[derive(Builder)] + | ^^^^^^^ required by this bound in `NegativeTestBuilder::::get_x3` ... -36 | x3: u32, - | -- required by a bound in this associated function - = note: this error originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info) +36 | x3: u32, + | -- required by a bound in this associated function + = note: this error originates in the derive macro `Builder` (in Nightly builds, run with -Z macro-backtrace for more info)