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

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

Merged
merged 1 commit into from
Jun 23, 2018

Conversation

estebank
Copy link
Contributor

Fix #50585.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

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

@rust-highfive rust-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
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.

Copy link
Contributor Author

@estebank estebank Jun 22, 2018

Choose a reason for hiding this comment

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

Copy link
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
Copy link
Contributor Author

estebank commented Jun 22, 2018

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
Contributor Author

@bors r=oli-obk rollup

@bors
Copy link
Contributor

bors commented Jun 22, 2018

📌 Commit fe5710a has been approved by oli-obk

@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 Jun 22, 2018
@bors
Copy link
Contributor

bors commented Jun 23, 2018

⌛ 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
Copy link
Contributor

bors commented Jun 23, 2018

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

@bors bors merged commit fe5710a into rust-lang:master Jun 23, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Jun 26, 2018
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`

Fix rust-lang#50577. CC rust-lang#51696.

r? @oli-obk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

5 participants