-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Hi, I've encountered weird error for cases when automock attribute is forwarded or added by declarative macro:
The minimal example is following:
macro_rules! decl_trait {
(
#[$attr:meta]
$($t:tt)*
) => {
#[$attr]
$($t)*
};
}
decl_trait!(
#[async_trait::async_trait] // this works as expected
trait Foo {
async fn bar(&self);
}
);
decl_trait!(
#[mockall::automock] // compilation error: misparsing?
trait Bar {
fn bar(&self);
}
);
an error:
3 | #[$attr]
| ^^^^^^^^
| |
| `self` value is a keyword only available in methods with a `self` parameter
| this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
rustc 1.92.0 (ded5c06cf 2025-12-08)
mockall = '0.14'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels