-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Implement CompilerDesugaringKind enum #43832
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
src/librustc/hir/lowering.rs
Outdated
@@ -397,11 +397,12 @@ impl<'a> LoweringContext<'a> { | |||
} | |||
|
|||
fn allow_internal_unstable(&self, reason: &'static str, mut span: Span) -> Span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to directly pass the enum as an argument here?
Hi! Thanks for the pull request! We'll be checking in periodically to make sure @nikomatsakis or someone else reviews this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the right direction, but not quite what I had in mind. Please do let me know if my suggestion doesn't make sense or needs clarification!
src/libsyntax_pos/hygiene.rs
Outdated
} | ||
} | ||
|
||
impl<'a> From<&'a str> for CompilerDesugaringKind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat along the lines of what @oli-obk was suggesting, I didn't expect to have CompiledDesugaringKind::from
, but rather replace all places in the compiler where we use constant strings with direct references to the enum variants, and instead invoke as_symbol()
anywhere that we need to print things out.
Also, I apologize for delay, I was on vacation! |
It's not a problem, I was also on vacation until recently. |
@bors r+ -- looks good! |
📌 Commit ff047a8 has been approved by |
⌛ Testing commit ff047a8 with merge 03444c3f89265be27e9ea4929b38a548b8b321bc... |
💔 Test failed - status-travis |
Implement CompilerDesugaringKind enum This is the first step outlined in #35946. I think that the variants of `CompilerDesugaringKind` should be changed, I didn't know what the official names for `...` and `<-` are. I'm not to sure how tests for the compiler work, but I would imagine that tests should be added such that `Symbol::intern(s) == CompilerDesugaringKind::from(s).as_symbol()` for valid `s`.
☀️ Test successful - status-appveyor, status-travis |
This is the first step outlined in #35946. I think that the variants of
CompilerDesugaringKind
should be changed, I didn't know what the official names for...
and<-
are.I'm not to sure how tests for the compiler work, but I would imagine that tests should be added such that
Symbol::intern(s) == CompilerDesugaringKind::from(s).as_symbol()
for valids
.