Create a more rigid overseer builder pattern that fails at compile time (#4753)

Introduces `Missing<Field>` and `Init<Field>` states, that are used in place of builder generics, and make this possible.
This commit is contained in:
Vsevolod Stakhov
2022-02-09 16:01:16 +00:00
committed by GitHub
parent 227e39bff6
commit 84f55cc8d5
20 changed files with 891 additions and 267 deletions
@@ -0,0 +1,10 @@
error[E0599]: no method named `sub0` found for struct `OverseerBuilder<Missing<_>, Init<AwesomeSubSys>, Missing<f64>>` in the current scope
--> tests/ui/err-08-duplicate-subsystem.rs:57:4
|
22 | #[overlord(signal=SigSigSig, error=OverseerError, event=Event, gen=AllMessages)]
| -------------------------------------------------------------------------------- method `sub0` not found for this
...
57 | .sub0(AwesomeSubSys::default()) // Duplicate subsystem
| ^^^^-------------------------- help: remove the arguments
| |
| field, not a method