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

Change treatment of zero-length filemaps #26816

Merged
merged 4 commits into from
Jul 21, 2015
Merged

Conversation

nrc
Copy link
Member

@nrc nrc commented Jul 6, 2015

See commits for details

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)


if parser.token == token::Eof && parser.span == codemap::DUMMY_SP {
parser.span = codemap::mk_sp(end_pos, end_pos);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this redundant? The Eof token should never be associated with a dummy span, given the change to advance_token().

Copy link
Member Author

Choose a reason for hiding this comment

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

This still holds sometimes where the file is empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean, the condition can hold in the case where codemap::DUMMY_SP is legitimately the end of the first file? In that case, the code still doesn't do anything, because the new position is still equal to codemap::DUMMY_SP.

@nrc
Copy link
Member Author

nrc commented Jul 12, 2015

@pnkfelix review ping

@jroesch
Copy link
Member

jroesch commented Jul 15, 2015

@nrc looks good to me r=me when you are done addressing comments

nrc added 4 commits July 21, 2015 21:55
So if a filemap's last byte is at position n in the codemap, then n+1 will not refer to any filemap, and the next filemap will begin an n+2.

This is useful for empty files, it means that every file (even empty ones) has a byte in the codemap.

Closes rust-lang#23301, rust-lang#26504
This basically only affects modules which are empty (or only contain comments).

Closes rust-lang#26755
@nrc
Copy link
Member Author

nrc commented Jul 21, 2015

@bors r=@jroesch

@bors
Copy link
Contributor

bors commented Jul 21, 2015

📌 Commit f47d20a has been approved by @jroesch

bors added a commit that referenced this pull request Jul 21, 2015
@bors
Copy link
Contributor

bors commented Jul 21, 2015

⌛ Testing commit f47d20a with merge e33b128...

@bors bors merged commit f47d20a into rust-lang:master Jul 21, 2015
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.

6 participants