macros: improve Span's expansion information by jseyfried · Pull Request #40597 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation44 Commits5 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

jseyfried

This PR improves Span's expansion information. More specifically:

r? @nrc

This was referenced

Mar 17, 2017

@jseyfried

jseyfried

@@ -22,7 +22,7 @@ macro_rules! indirect_line { () => ( line!() ) }
pub fn main() {
assert_eq!(line!(), 24);
assert_eq!(column!(), 4);
assert_eq!(column!(), 15);

Choose a reason for hiding this comment

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

c.f. #40649; technically a [breaking-change]

@bors

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

@bors

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

@bors

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

@bors

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

nrc

nrc approved these changes Mar 24, 2017

Member

@nrc nrc left a comment

Choose a reason for hiding this comment

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

r=me, assuming losing the command line span thing is fine.

This seems a good step in the right direction. I worry a bit that to is still too easy to create malformed spans, but it is def. better than mk_sp.

// Generic span to be used for code originating from the command line
pub const COMMAND_LINE_SP: Span = Span { lo: BytePos(0),
hi: BytePos(0),
expn_id: COMMAND_LINE_EXPN };

Choose a reason for hiding this comment

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

What do we do now for code from the command line?

Choose a reason for hiding this comment

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

Same as before -- DUMMY_SP. The only place COMMAND_LINE_SP was used was here, which only happens when naming a legacy plugin crate through a debugging command line option.

@jseyfried

@bors

📌 Commit 8c49446 has been approved by nrc

@jseyfried

@bors

📌 Commit 8ba347e has been approved by nrc

@bors

⌛ Testing commit 8ba347e with merge 2731d4d...

@bors

@jseyfried

@bors

bors added a commit that referenced this pull request

Mar 30, 2017

@bors

macros: improve Span's expansion information

This PR improves Span's expansion information. More specifically:

r? @nrc

@jseyfried

@bors

📌 Commit 8fde04b has been approved by nrc

@bors

This was referenced

Mar 30, 2017

@SergioBenitez

I'm seeing the following, which may be related to this:

warning: {warning message from a syntax extension} --> /a/nice/big/file/path/here.rs:10:21 | | and so on... | = note: this error originates in a macro outside of the current crate

The issue is that the "note:` refers to the warning as an "error". It should say: "this warning originates from a macro outside of the current crate".

@jseyfried

This was referenced

May 8, 2017