Skip to content

Fix MIR inlining panic in generic function #45723

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 1 commit into from
Nov 5, 2017
Merged

Conversation

sinkuu
Copy link
Contributor

@sinkuu sinkuu commented Nov 2, 2017

MIR inlining calls Instance::resolve with a substs containing param, and trans_apply_param_substs panics. This PR fixes it by making Instance::resolve return None if substs.has_param_types(), though I'm not sure if this is a right fix.

Fixes #45493.

@rust-highfive
Copy link
Contributor

r? @arielb1

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

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 2, 2017

@sinkuu

It's not the right fix - instead, it needs to use a variant of trans_apply_param_substs that doesn't panic if the substs have param types.

@sinkuu
Copy link
Contributor Author

sinkuu commented Nov 3, 2017

Added trans_apply_param_substs_opt.

@arielb1
Copy link
Contributor

arielb1 commented Nov 5, 2017

@sinkuu

You should just pass the param env to the variant of trans_apply_param_substs you use and use it, then you won't need to ignore errors - trait operations should not fail because we've already done type-checking, so we know that the code is type-correct.

@arielb1
Copy link
Contributor

arielb1 commented Nov 5, 2017

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

📌 Commit afb52e1 has been approved by arielb1

@kennytm kennytm 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 Nov 5, 2017
@bors
Copy link
Collaborator

bors commented Nov 5, 2017

⌛ Testing commit afb52e1 with merge 3b82e4c...

bors added a commit that referenced this pull request Nov 5, 2017
Fix MIR inlining panic in generic function

MIR inlining calls `Instance::resolve` with a substs containing param, and `trans_apply_param_substs` panics. ~~This PR fixes it by making `Instance::resolve` return `None` if `substs.has_param_types()`, though I'm not sure if this is a right fix.~~

Fixes #45493.
@bors
Copy link
Collaborator

bors commented Nov 5, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 3b82e4c to master...

@bors bors merged commit afb52e1 into rust-lang:master Nov 5, 2017
@sinkuu sinkuu deleted the ice_45493 branch November 5, 2017 23:12
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.

ICE: unexpected panic with mir-opt-level=3
5 participants