-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Use the macro structure spans instead of the invocation #43352
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
82a3d26
to
db43a93
Compare
db43a93
to
09c712d
Compare
src/libsyntax_pos/lib.rs
Outdated
@@ -184,15 +185,32 @@ impl Span { | |||
result | |||
} | |||
|
|||
pub fn empty_ctxt(&self) -> bool { |
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 new function is unused.
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.
Removed.
src/libsyntax_pos/lib.rs
Outdated
self.hi | ||
} else { | ||
end.hi | ||
}; |
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.
Probably better to use standard min
and max
for clarity.
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.
Done.
src/libsyntax/tokenstream.rs
Outdated
@@ -241,6 +258,21 @@ impl TokenStream { | |||
} | |||
} | |||
|
|||
pub fn map_pos<F: FnMut(usize, TokenTree) -> TokenTree>(self, mut f: F) -> TokenStream { |
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.
I'd rename this into enumerate_map
(or map_enumerated
), to use the same naming conventions as Iterator
.
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.
Done.
src/libsyntax/ext/tt/macro_rules.rs
Outdated
// rhs has holes ( `$id` and `$(...)` that need filled) | ||
let tts = transcribe(cx, Some(named_matches), rhs); | ||
let mut tts = transcribe(cx, Some(named_matches), rhs.clone()); |
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.
Just to be sure, everything is under Rc
and cloning/mapping is cheap, right?
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.
All I need is the spans after this, so I'm cloning the spans first into their own Vec
.
Reviewed. |
@bors r+ |
📌 Commit 6772661 has been approved by |
☀️ Test successful - status-appveyor, status-travis |
Fix #42104, CC #2887.