-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-macromacro expansionmacro expansionC-bugCategory: bugCategory: bugS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
CC #8961
struct Options {
casei: Option<bool>,
}
const CASEI: Options = Options { casei: Some(true) };
macro_rules! toregex {
($name:ident, $options:expr) => {
#[test]
fn $name() {
if let Some(casei) = $options.casei {
foo(casei);
}
}
};
}
toregex!(re_casei, &CASEI);
fn foo(_c: bool) {}If you macro-expand toregex, it produces if let Some(casei) = &CASEI.casei, causing a compilation error and a and type mismatch. The correct expansion is if let Some(casei) = (&CASEI).casei.
Metadata
Metadata
Assignees
Labels
A-macromacro expansionmacro expansionC-bugCategory: bugCategory: bugS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now