Skip to content

Avoid ICE in macro's diagnostics #68633

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

Merged
merged 2 commits into from
Feb 1, 2020

Conversation

JohnTitor
Copy link
Member

Fixes #68629

r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 29, 2020
"change the delimiters to curly braces",
vec![
(self.prev_span.with_hi(self.prev_span.lo() + BytePos(1)), '{'.to_string()),
(self.prev_span.with_lo(self.prev_span.hi() - BytePos(1)), '}'.to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like there's a missing Span method here (self.prev_span.shift_left(...))

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't find the shift_left method: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.Span.html
Am I still missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm saying that we could add a higher level operation to avoid dealing with primitives like this. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, so we can add this tweak as a pub method of Span, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that would be the idea, if we think it's a good one. cc also @petrochenkov

Copy link
Member Author

@JohnTitor JohnTitor Jan 30, 2020

Choose a reason for hiding this comment

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

I feel it'd be nice that we'll do it as follow-up work, how about?

Copy link
Contributor

Choose a reason for hiding this comment

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

Works for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

SourceMap::next_point let's you advance 1 char at a time (and is now unicode aware). We don't have a method to move left. It is in SourceMap instead of Span because you need to look at the underlying code for the span to be validated as not falling in the middle of a character.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this might work better with shrink_to_hi and shrink_to_lo instead of with_*.

@JohnTitor
Copy link
Member Author

I think it's ready to review, could you confirm the diagnostics are valid? @estebank

@estebank
Copy link
Contributor

@JohnTitor The output is fine 👍

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 31, 2020

📌 Commit b1c91ee has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 31, 2020
@bors
Copy link
Collaborator

bors commented Jan 31, 2020

⌛ Testing commit b1c91ee with merge cdd41ea...

bors added a commit that referenced this pull request Jan 31, 2020
@bors
Copy link
Collaborator

bors commented Feb 1, 2020

☀️ Test successful - checks-azure
Approved by: estebank
Pushing cdd41ea to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 1, 2020
@bors bors merged commit b1c91ee into rust-lang:master Feb 1, 2020
@rust-highfive
Copy link
Contributor

📣 Toolstate changed by #68633!

Tested on commit cdd41ea.
Direct link to PR: #68633

💔 rustc-guide on linux: test-pass → test-fail (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Feb 1, 2020
Tested on commit rust-lang/rust@cdd41ea.
Direct link to PR: <rust-lang/rust#68633>

💔 rustc-guide on linux: test-pass → test-fail (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra).
@JohnTitor JohnTitor deleted the avoid-ice-in-diagnostics branch February 1, 2020 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

internal compiler error: "byte index 15 is not a char boundary"
6 participants