Skip to content
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

Introducing TokenStreams and TokenSlices for procedural macros #34575

Merged
merged 1 commit into from
Jul 8, 2016

Conversation

cgswords
Copy link
Contributor

This pull request introduces TokenStreams and TokenSlices into the compiler in preparation for usage as part of RFC 1566 (procedural macros).

r? @nrc

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (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.

@@ -42,6 +42,7 @@ extern crate libc;
extern crate rustc_unicode;
pub extern crate rustc_errors as errors;
extern crate syntax_pos;
extern crate core;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this? What does core::iter give you that std::iter does not?

@@ -206,5 +210,1105 @@ impl TokenTree {
true);
macro_parser::parse(cx.parse_sess(), cx.cfg(), arg_rdr, mtch)
}

/// Check if this TokenTree is equal to the other, regardless of span information
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: comments should end with punctuation

match (self, other) {
(&TokenTree::Token(_, ref tk), &TokenTree::Token(_, ref tk2)) => tk == tk2,
(&TokenTree::Delimited(_, ref dl), &TokenTree::Delimited(_, ref dl2)) => {
if (*dl).delim == (*dl2).delim {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use && rather than if ... else { false }


/// Returns the token trees inside the delimiters.
pub fn subtrees(&self) -> &[TokenTree] {
&self.tts[..]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the [..] necessary?

@nrc
Copy link
Member

nrc commented Jul 7, 2016

OK, two very minor comments to address, then could you squash the commits please? r+ with that.

@bors
Copy link
Contributor

bors commented Jul 7, 2016

☔ The latest upstream changes (presumably #34652) made this pull request unmergeable. Please resolve the merge conflicts.

@cgswords cgswords force-pushed the tstream branch 2 times, most recently from f10f932 to ec6a3d9 Compare July 7, 2016 18:18
@cgswords
Copy link
Contributor Author

cgswords commented Jul 7, 2016

Took care of bors concern, too.

@nrc
Copy link
Member

nrc commented Jul 7, 2016

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 7, 2016

📌 Commit 7547596 has been approved by nrc

bors added a commit that referenced this pull request Jul 8, 2016
Introducing TokenStreams and TokenSlices for procedural macros

This pull request introduces TokenStreams and TokenSlices into the compiler in preparation for usage as part of RFC 1566 (procedural macros).

r? @nrc
@bors
Copy link
Contributor

bors commented Jul 8, 2016

⌛ Testing commit 7547596 with merge 182bcdb...

@bors bors merged commit 7547596 into rust-lang:master Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants