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

proc_macro: Tweak doc comments and negative literals #49545

Merged
merged 1 commit into from
Apr 1, 2018

Conversation

alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Mar 31, 2018

This commit tweaks the tokenization of a doc comment to use #[doc = "..."]
like macro_rules! does (instead of treating it as a Literal token).
Additionally it fixes treatment of negative literals in the compiler, for
exapmle Literal::i32(-1). The current fix is a bit of a hack around the
current compiler implementation, providing a fix at the proc-macro layer rather
than the libsyntax layer.

Closes #48889

This commit tweaks the tokenization of a doc comment to use `#[doc = "..."]`
like `macro_rules!` does (instead of treating it as a `Literal` token).
Additionally it fixes treatment of negative literals in the compiler, for
exapmle `Literal::i32(-1)`. The current fix is a bit of a hack around the
current compiler implementation, providing a fix at the proc-macro layer rather
than the libsyntax layer.
@alexcrichton
Copy link
Member Author

r? @eddyb

cc @dtolnay

tt!(TokenNode::Literal(self::Literal(Literal(Lit::Str_(c), None)))),
].into_iter().collect();
stack.push(tt!(TokenNode::Group(Delimiter::Bracket, stream)));
op!('#')
Copy link
Member

Choose a reason for hiding this comment

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

Oh this is easier than I expected. Can't wait to rebase over it!

@eddyb
Copy link
Member

eddyb commented Apr 1, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Apr 1, 2018

📌 Commit ec1a8f0 has been approved by eddyb

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 1, 2018
@bors
Copy link
Contributor

bors commented Apr 1, 2018

⌛ Testing commit ec1a8f0 with merge 85f0098...

bors added a commit that referenced this pull request Apr 1, 2018
proc_macro: Tweak doc comments and negative literals

This commit tweaks the tokenization of a doc comment to use `#[doc = "..."]`
like `macro_rules!` does (instead of treating it as a `Literal` token).
Additionally it fixes treatment of negative literals in the compiler, for
exapmle `Literal::i32(-1)`. The current fix is a bit of a hack around the
current compiler implementation, providing a fix at the proc-macro layer rather
than the libsyntax layer.

Closes #48889
@bors
Copy link
Contributor

bors commented Apr 1, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 85f0098 to master...

@bors bors merged commit ec1a8f0 into rust-lang:master Apr 1, 2018
@alexcrichton alexcrichton deleted the proc-macro-fixes branch April 1, 2018 15:15
yui-knk added a commit to yui-knk/rust that referenced this pull request Dec 2, 2018
Currently libproc_macro does not use `DotEq` token.
rust-lang#49545 changed libproc_macro
to not generate `DotEq` token.
kennytm added a commit to kennytm/rust that referenced this pull request Dec 3, 2018
…, r=petrochenkov

Remove not used `DotEq` token

Currently libproc_macro does not use `DotEq` token.
rust-lang#49545 changed libproc_macro
to not generate `DotEq` token.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Macros 2.0: Negative numbers as a single token
3 participants