-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Macro ambiguity with #![no_implicit_prelude] #151487
Copy link
Copy link
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-langRelevant to the language teamRelevant to the language teamregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Milestone
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-langRelevant to the language teamRelevant to the language teamregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
I tried this code:
I expected to see this happen: The code should compile (no name-resolution ambiguity).
Instead, this happened: The compiler reports an ambiguity error for unreachable!() claiming a conflict between a name from a glob import and an outer scope (the prelude).
Version it worked on
It most recently worked on: 1.93.0-beta.8
Version with regression
rustc --version --verbose:Notes / additional observations:
Rust Playground:
https://play.rust-lang.org/?version=nightly&edition=2024&gist=23b9e8aa365dc3f6b4bffb840ac0c700
Removing #![no_implicit_prelude] yields the same error.
Swapping order (define macro before mod foo) makes the code compile successfully.