Skip to content

Conversation

matthewjasper
Copy link
Contributor

  • Don't ICE when a type containing a region is constrained by nothing
  • Don't ICE trying to normalize a type in a ParamEnv containing global bounds.

To explain what was happening in the issue-61311-normalize.rs case:

  • When borrow checking the the_fn in the last impl we would try to normalize Self::Proj (<Unit as HasProjFn>::Proj).
  • We would find the impl that we're checking and and check its where clause.
  • This would need us to check <Box<dyn Obj + 'static> as HasProj>::Proj: Bound
  • We find two possible implementations, the blanket impl and the bound in our ParamEnv.
  • The bound in our ParamEnv was canonicalized, so we don't see it as a global bound. As such we prefer it to the impl.
  • This means that we cannot normalize <Box<dyn Obj + 'static> as HasProj>::Proj to Unit.
  • The <Box<dyn Obj + 'static> as HasProj>::Proj: Bound bound, which looks like it should be in our ParamEnv has been normalized to Unit: Bound.
  • We fail to prove <Box<dyn Obj + 'static> as HasProj>::Proj: Bound.
  • We ICE, since we believe typeck have errored.

Closes #61311
Closes #61315
Closes #61320

r? @pnkfelix
cc @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 3, 2019
@pnkfelix
Copy link
Member

pnkfelix commented Jun 4, 2019

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 4, 2019

📌 Commit 794239d has been approved by pnkfelix

@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 4, 2019
Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019
…r=pnkfelix

Fix NLL typeck ICEs

* Don't ICE when a type containing a region is constrained by nothing
* Don't ICE trying to normalize a type in a `ParamEnv` containing global bounds.

To explain what was happening in the `issue-61311-normalize.rs` case:

* When borrow checking the `the_fn` in the last `impl` we would try to normalize `Self::Proj` (`<Unit as HasProjFn>::Proj`).
* We would find the `impl` that we're checking and and check its `where` clause.
* This would need us to check `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`
* We find two possible implementations, the blanket impl and the bound in our `ParamEnv`.
* The bound in our `ParamEnv` was canonicalized, so we don't see it as a global bound. As such we prefer it to the `impl`.
* This means that we cannot normalize `<Box<dyn Obj + 'static> as HasProj>::Proj` to `Unit`.
* The `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound` bound, which looks like it should be in our `ParamEnv` has been normalized to `Unit: Bound`.
* We fail to prove `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`.
* We ICE, since we believe typeck have errored.

Closes rust-lang#61311
Closes rust-lang#61315
Closes rust-lang#61320

r? @pnkfelix
cc @nikomatsakis
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Jun 4, 2019
…r=pnkfelix

Fix NLL typeck ICEs

* Don't ICE when a type containing a region is constrained by nothing
* Don't ICE trying to normalize a type in a `ParamEnv` containing global bounds.

To explain what was happening in the `issue-61311-normalize.rs` case:

* When borrow checking the `the_fn` in the last `impl` we would try to normalize `Self::Proj` (`<Unit as HasProjFn>::Proj`).
* We would find the `impl` that we're checking and and check its `where` clause.
* This would need us to check `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`
* We find two possible implementations, the blanket impl and the bound in our `ParamEnv`.
* The bound in our `ParamEnv` was canonicalized, so we don't see it as a global bound. As such we prefer it to the `impl`.
* This means that we cannot normalize `<Box<dyn Obj + 'static> as HasProj>::Proj` to `Unit`.
* The `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound` bound, which looks like it should be in our `ParamEnv` has been normalized to `Unit: Bound`.
* We fail to prove `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`.
* We ICE, since we believe typeck have errored.

Closes rust-lang#61311
Closes rust-lang#61315
Closes rust-lang#61320

r? @pnkfelix
cc @nikomatsakis
bors added a commit that referenced this pull request Jun 4, 2019
Rollup of 5 pull requests

Successful merges:

 - #61069 (Make MIR drop terminators borrow the dropped location)
 - #61453 (Remove unneeded feature attr from atomic integers doctests)
 - #61488 (Fix NLL typeck ICEs)
 - #61500 (Fix regression 61475)
 - #61523 (Hide gen_future API from documentation)

Failed merges:

r? @ghost
@bors bors merged commit 794239d into rust-lang:master Jun 5, 2019
@matthewjasper matthewjasper deleted the fix-nll-typeck-ices branch July 29, 2019 19:54
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
4 participants