-
Notifications
You must be signed in to change notification settings - Fork 13.3k
The parser should use some kind of hygiene or lang item for FullRange #20516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I suspect the easiest way to do this would be to add another "special ident", and expand to that. |
@cmr I already do that, but it is not as flexible as a lang item |
is this a dup of #21263? |
this is one strategy for implementing it. |
Maybe the libsyntax counterpart to lang items would be "lang macros". #[lang="range_full"]
// Implicitly exported, but not in the usual way
macro_rules! name_doesnt_matter {
() => ( $crate::ops::RangeFull )
} This opens the intriguing possibility of moving more sugar, such as Any sugar defined through lang macros could be redefined by Whether or not we find lang macros to be widely useful, it seems like a fine solution to the problem at hand. |
FullRange no longer exists and I believe this is no longer an issue. |
The parser currently assumes there is a struct called
FullRange
in scope in order to desugar full slices (&expr[]
->&expr[FullRange]
). This is a problem if there is no prelude (whereFullRange
is defined).We already have a lang item for
FullRange
, but unfortunately lang items can only be used from the compiler proper, not from libsyntax. The ideal solution is to fix that. Shorter term we might want to allow a full path to be specified via a macro or something, so we can be a bit more hygenic here.The text was updated successfully, but these errors were encountered: