-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as duplicate of#39412
Closed as duplicate of#39412
Copy link
Labels
A-hygieneArea: Macro hygieneArea: Macro hygieneA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.
Description
I tried this code:
macro_rules! my_type {
() => (&'_magic_lifetime T);
}
fn foo<'_magic_lifetime, T>(_x: my_type!()) {}
I expected to see this happen: compile error saying 'magic_lifetime
and T
are not defined, with a help message about macro hygiene, or at the very least a warning.
Instead, this happened: code compiles successfully with no warning.
Meta
rustc --version --verbose
:
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5
Metadata
Metadata
Assignees
Labels
A-hygieneArea: Macro hygieneArea: Macro hygieneA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.