Skip to content

Accept TyError in patterns to avoid ICE on bad input - #51696

Merged
bors merged 1 commit into
rust-lang:masterfrom
estebank:fuzzy-ice-ice
Jun 23, 2018
Merged

Accept TyError in patterns to avoid ICE on bad input#51696
bors merged 1 commit into
rust-lang:masterfrom
estebank:fuzzy-ice-ice

Conversation

@estebank

Copy link
Copy Markdown
Contributor

Fix#50585.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 22, 2018
@@ -505,7 +505,16 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
let def = self.tables.qpath_def(qpath, pat.hir_id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it might be less fragile to check at the assignment of the tables field, whether tables.tainted_by_errors is true and then just not recurse.

@estebankestebankJun 22, 2018

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm no. You're right. your original thing seemed better. I thought we could check before calling from_hir or new, but I just checked and that seems messy.

r=me with your original thing

@rust-highfive

This comment has been minimized.

@estebank

estebank commented Jun 22, 2018

Copy link
Copy Markdown
ContributorAuthor

There's a discrepancy in regular output and -Z unpretty=mir output:

error[E0308]: mismatched types
--> ../../src/test/compile-fail/issue-37665.rs:20:17
|
20 | let x: () = 0; //~ ERROR: mismatched types
| ^ expected (), found integral variable
|
= note: expected type `()`
found type `{integer}`
warning: variable does not need to be mutable
--> ../../src/test/compile-fail/issue-37665.rs:17:9
|
17 | let mut foo : String = "hello".to_string();
| ----^^^
| |
| help: remove this `mut`
|
= note: #[warn(unused_mut)] on by default

The warning appears only in the latter. This is true in current stable too.

@estebank

Copy link
Copy Markdown
ContributorAuthor

@bors r=oli-obk rollup

@bors

bors commented Jun 22, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit fe5710a has been approved by oli-obk

@borsbors 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 Jun 22, 2018
@bors

bors commented Jun 23, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit fe5710a with merge 2ea922a...

bors added a commit that referenced this pull request Jun 23, 2018
Accept `TyError` in patterns to avoid ICE on bad input
Fix#50585.
@bors

bors commented Jun 23, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: oli-obk
Pushing 2ea922a to master...

@bors
bors merged commit fe5710a into rust-lang:masterJun 23, 2018
emilyalbini added a commit to emilyalbini/rust that referenced this pull request Jun 26, 2018
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`
Fixrust-lang#50577. CC rust-lang#51696.
r? @oli-obk
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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.

5 participants

@estebank@rust-highfive@bors@oli-obk@nikomatsakis