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

Fix const evaluation ICE in rustdoc #47862

Merged
merged 1 commit into from
Feb 5, 2018

Conversation

GuillaumeGomez
Copy link
Member

Fixes #47860.

r? @eddyb

@eddyb
Copy link
Member

eddyb commented Jan 29, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Jan 29, 2018

📌 Commit c786dca has been approved by eddyb

@ollie27
Copy link
Member

ollie27 commented Jan 30, 2018

The same issue exists when cross crate inlining:

n = cx.tcx.const_eval(param_env.and((def_id, substs))).unwrap()

@eddyb
Copy link
Member

eddyb commented Jan 30, 2018

@ollie27 Oh, right. That would have to show "<error>" or similar.

@ollie27
Copy link
Member

ollie27 commented Jan 30, 2018

Would changing that line to this not work?

if let Ok(new_n) = cx.tcx.const_eval(param_env.and((def_id, substs))) {
    n = new_n;
}

@eddyb
Copy link
Member

eddyb commented Jan 30, 2018

Oh oops sorry you're right!

@bors r-

@GuillaumeGomez
Copy link
Member Author

Updated.

n = cx.tcx.const_eval(param_env.and((def_id, substs))).unwrap()
if let Ok(new_n) = cx.tcx.const_eval(param_env.and((def_id, substs))) {
n = new_n;
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you use the same trick in the other function? You just have to do this first, before const_eval:

let n = tcx.mk_const(ty::Const {
    val: ConstVal::Unevaluated(def_id, substs),
    ty: tcx.types.usize
});

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean instead of const_eval? Otherwise, this new assignement to n will never be used...

Copy link
Member

Choose a reason for hiding this comment

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

I mean it'd be this in the other place (line 2450) - rewrote it a bit since previous comment:

let n = cx.tcx.const_eval(param_env.and((def_id, substs))).unwrap_or_else(|_| {
    cx.tcx.mk_const(ty::Const {
        val: ConstVal::Unevaluated(def_id, substs),
        ty: cx.tcx.types.usize
    })
});

@kennytm kennytm added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 31, 2018
@GuillaumeGomez
Copy link
Member Author

Updated.

@eddyb
Copy link
Member

eddyb commented Feb 3, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Feb 3, 2018

📌 Commit 6b35d81 has been approved by eddyb

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 3, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Feb 3, 2018
…, r=eddyb

Fix const evaluation ICE in rustdoc

Fixes rust-lang#47860.

r? @eddyb
bors added a commit that referenced this pull request Feb 3, 2018
Rollup of 9 pull requests

- Successful merges: #47753, #47862, #47877, #47896, #47912, #47944, #47947, #47978, #47958
- Failed merges:
@bors
Copy link
Contributor

bors commented Feb 4, 2018

⌛ Testing commit 6b35d81 with merge edecd1a5251488e5b7001ad0eee516738f648149...

@bors
Copy link
Contributor

bors commented Feb 4, 2018

💔 Test failed - status-appveyor

@kennytm
Copy link
Member

kennytm commented Feb 4, 2018

@bors retry #46903

kennytm added a commit to kennytm/rust that referenced this pull request Feb 4, 2018
…, r=eddyb

Fix const evaluation ICE in rustdoc

Fixes rust-lang#47860.

r? @eddyb
kennytm added a commit to kennytm/rust that referenced this pull request Feb 4, 2018
…, r=eddyb

Fix const evaluation ICE in rustdoc

Fixes rust-lang#47860.

r? @eddyb
bors added a commit that referenced this pull request Feb 4, 2018
Rollup of 10 pull requests

- Successful merges: #47862, #47877, #47896, #47912, #47947, #47958, #47978, #47996, #47999, #47892
- Failed merges:
bors added a commit that referenced this pull request Feb 4, 2018
Rollup of 10 pull requests

- Successful merges: #47862, #47877, #47896, #47912, #47947, #47958, #47978, #47996, #47999, #47892
- Failed merges:
@bors
Copy link
Contributor

bors commented Feb 5, 2018

⌛ Testing commit 6b35d81 with merge e7e982a...

@bors bors merged commit 6b35d81 into rust-lang:master Feb 5, 2018
@bors
Copy link
Contributor

bors commented Feb 5, 2018

💥 Test timed out

@GuillaumeGomez GuillaumeGomez deleted the const-evaluation-ice branch February 5, 2018 09:26
@kennytm
Copy link
Member

kennytm commented Feb 8, 2018

@bors clean r- retry

(This PR was stuck in the queue as "failure" state.)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 8, 2018
@kennytm kennytm removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants