-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Restrictions on imports of $crate are illogical #149811
Copy link
Copy link
Closed
Labels
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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The restriction against importing
$crateseems to be mis-implemented.Consider this program https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=05c4fba76e41533e7b3ac8940aab1c87
I think
use $crate as identifierought to be accepted. The{self as ..}isn't adding anything other than to bypass the restriction.Conversely
use $crate::{self}is madness but is currently accepted. There might be compatibility implications of forbidding it, I guess - maybe some macro does that by mistake. It seems harmless so maybe it would be best just to continue to allow it. IDK.