-
-
Notifications
You must be signed in to change notification settings - Fork 851
Closed
Description
I tried this code:
macro_rules! declare_in_macro {
($with:literal) => {
#[derive(serde::Serialize)]
pub struct S {
#[serde(with = $with)]
f: i32,
}
};
}
declare_in_macro!("display");
mod display {
pub fn serialize<S: serde::ser::Serializer>(_: &i32, _: S) -> Result<S::Ok, S::Error> {
unimplemented!()
}
}
with feature "derive":
- serde 1.0.210 compiles
- serde 1.0.211 fails with:
error[E0424]: expected value, found module `self` --> src/lib.rs:10:19 | 3 | #[derive(serde::Serialize)] | ---------------- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters ... 10 | declare_in_macro!("display"); | ^^^^^^^^^ `self` value is a keyword only available in methods with a `self` parameter error[E0425]: cannot find value `__s` in this scope --> src/lib.rs:10:19 | 10 | declare_in_macro!("display"); | ^^^^^^^^^ not found in this scope
Also reported at #2558 (comment)
shekhirin, ligustah, dd23, Turbo87, sffc and 2 more
Metadata
Metadata
Assignees
Labels
No labels