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

Do not ICE on malformed suggestion spans #68256

Merged
merged 2 commits into from Jan 18, 2020
Merged

Conversation

@estebank
Copy link
Contributor

estebank commented Jan 15, 2020

Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being created is left unaddressed.

Fix #67567.

r? @petrochenkov

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Jan 15, 2020

The original report produces, the following, where we see we're already emitting an invalid span in the primary diagnostic window, but handling it gracefully there:

error: expected identifier, found `)`
  --> src/ice.rs:24:9
   |
24 |         }
   |         ^ expected identifier

error: mismatched closing delimiter: `}`
  --> src/ice.rs:24:9
   |
22 |         } else {
   |                - closing delimiter possibly meant for this
23 |             return Err(m1::E1::
   |                       - unclosed delimiter
24 |         }
   |         ^ mismatched closing delimiter

error[E0308]: mismatched types
  --> src/main.rs:1:1
   |
1  | / mod ice;
2  | | fn main() {
3  | | }
...  |
   |
   = note: expected enum `std::result::Result<ice::m1::S1, ()>`
            found struct `ice::m1::S1`

Fixing the syntax error in the original report produces reasonable spans:

error[E0308]: mismatched types
  --> src/ice.rs:19:20
   |
19 |               return m1::S1 {
   |  ____________________^
20 | |                 v1: format!(""),
21 | |             }
   | |_____________^ expected enum `std::result::Result`, found struct `ice::m1::S1`
   |
   = note: expected enum `std::result::Result<ice::m1::S1, ()>`
            found struct `ice::m1::S1`
help: try using a variant of the expected enum
   |
19 |             return Ok(m1::S1 {
20 |                 v1: format!(""),
21 |             })
   |

The underlying issue is that we're taking a span from main.rs and combining it (without checking) with an end point from ice.rs.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 16, 2020

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

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Jan 17, 2020

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 17, 2020

📌 Commit 03240e1 has been approved by petrochenkov

tmandry added a commit to tmandry/rust that referenced this pull request Jan 18, 2020
Do not ICE on malformed suggestion spans

Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being _created_ is left unaddressed.

Fix rust-lang#67567.

r? @petrochenkov
bors added a commit that referenced this pull request Jan 18, 2020
Rollup of 8 pull requests

Successful merges:

 - #66660 (Don't warn about snake case for field puns.)
 - #67712 (Stabilize `#![feature(slice_patterns)]` in 1.42.0)
 - #68093 (Fix deref impl typedef)
 - #68256 (Do not ICE on malformed suggestion spans)
 - #68279 (Clean up E0198 explanation)
 - #68312 (Add regression test for integer literals in generic arguments in where clauses)
 - #68314 (Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval)
 - #68317 (Clean up E0199 explanation)

Failed merges:

r? @ghost
tmandry added a commit to tmandry/rust that referenced this pull request Jan 18, 2020
Do not ICE on malformed suggestion spans

Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being _created_ is left unaddressed.

Fix rust-lang#67567.

r? @petrochenkov
bors added a commit that referenced this pull request Jan 18, 2020
Rollup of 9 pull requests

Successful merges:

 - #66660 (Don't warn about snake case for field puns.)
 - #68093 (Fix deref impl typedef)
 - #68204 (Use named fields for `{ast,hir}::ItemKind::Impl`)
 - #68256 (Do not ICE on malformed suggestion spans)
 - #68279 (Clean up E0198 explanation)
 - #68291 (Update sanitizer tests)
 - #68312 (Add regression test for integer literals in generic arguments in where clauses)
 - #68314 (Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for const eval)
 - #68317 (Clean up E0199 explanation)

Failed merges:

r? @ghost
@bors bors merged commit 03240e1 into rust-lang:master Jan 18, 2020
4 checks passed
4 checks passed
pr Build #20200117.9 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Jan 23, 2020

discussed at T-compiler meeting. approved for beta-backport.

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Jan 23, 2020

@estebank This PR does not backport to beta cleanly, and the set of merge conflicts. Can you prepare a commit that backports this onto origin/beta?

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Jan 23, 2020

Never mind. I forgot about the rustfmt changes on master, applying those to beta allowed this to backport cleanly atop them.

bors added a commit that referenced this pull request Jan 23, 2020
[beta] backports

This backports:
 * Do not ICE on malformed suggestion spans #68256
 * Distinguish between private items and hidden items in rustdoc #67875
 *  Revert parts of #66405. #67471

It also includes a few formatting commits to permit the backports to proceed cleanly (those are scoped to the relevant files, but still generate noise, of course). This was deemed easier than attempting to manually deal with the formatting.

r? @ghost
bors added a commit that referenced this pull request Jan 24, 2020
[beta] backports

This backports:
 * Do not ICE on malformed suggestion spans #68256
 * Distinguish between private items and hidden items in rustdoc #67875
 *  Revert parts of #66405. #67471

It also includes a few formatting commits to permit the backports to proceed cleanly (those are scoped to the relevant files, but still generate noise, of course). This was deemed easier than attempting to manually deal with the formatting.

r? @ghost
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jan 25, 2020
Do not ICE on multipart suggestions touching multiple files

When encountering a multipart suggestion with spans belonging to
different contexts, skip that suggestion.

Fix rust-lang#68449. Similar to rust-lang#68256.
bors added a commit that referenced this pull request Jan 25, 2020
Do not ICE on multipart suggestions touching multiple files

When encountering a multipart suggestion with spans belonging to
different contexts, skip that suggestion.

Fix #68449. Similar to #68256.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.