Detect unused #[deftly] attributes
Users who misspell or misdirect these attributes don't get any kind of warning. This is not great.
We can't produce warnings, but we could produce errors. I think I can see how to do this for precanned templates. I don't think it is possible where truly-adhoc templates are involved.
Therefore any fix would make it necessary to declare on the driver whether truly-adhoc templates will (or may) follow, something like this perhaps:
#[derive(Adhoc)]
#[derive_adhoc(later)]
This would be a breaking change but I think that's tolerable.
I'm not sure about the word later
. Do we need a term for truly-adhoc templates? Other options would include a separate helper attribute eg #[derive_adhoc_later]
. Or some punctuation (I don't much like this).
My proposed semantics are to produce an error if the driver has #[adhoc(foo(bar))
unless any of the invoked templates mentions Xmeta(foo(bar))
(as expansion or condition) for the appropriate X
, anywhere in the template. (So it wouldn't depend on whether that part of the template was expanded; if that's a problem for a tamplate with complex attributes, it would be for the template to deal with.)