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

Rollup of 6 pull requests #67917

Merged
merged 22 commits into from
Jan 6, 2020
Merged

Rollup of 6 pull requests #67917

merged 22 commits into from
Jan 6, 2020

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost

Dylan-DPC and others added 22 commits January 4, 2020 23:31
Fixes rust-lang#67639

`Instance.ty` assumes that we are in a fully monomorphic context (e.g.
codegen), and can therefore use an empty `ParamEnv` when performing
normalization. Howver, the MIR constant evaluator code ends up calling
`Instance.ty` as a result of us attemptign to 'speculatively'
const-evaluate generic functions during const propagation.

As a result,
we may end up with projections involving type parameters
(e.g. <T as MyTrait>::Bar>) in the type we are trying to normalize.
Normalization expects us to have proper predicates in the `ParamEnv` for
such projections, and will ICE if we don't.

This commit adds a new method `Instance.ty_env`, which takes a
`ParamEnv` for use during normalization. The MIR const-evaluator code is
changed to use this method, passing in the proper `ParamEnv` for the
context at hand.
Co-Authored-By: Wesley Wiser <wwiser@gmail.com>
This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.
spotted while reviewing the todo!macro docs
… r=oli-obk

Fix ICE involving calling `Instance.ty` during const evaluation

Fixes rust-lang#67639

`Instance.ty` assumes that we are in a fully monomorphic context (e.g.
codegen), and can therefore use an empty `ParamEnv` when performing
normalization. Howver, the MIR constant evaluator code ends up calling
`Instance.ty` as a result of us attemptign to 'speculatively'
const-evaluate generic functions during const propagation.

As a result,
we may end up with projections involving type parameters
(e.g. <T as MyTrait>::Bar>) in the type we are trying to normalize.
Normalization expects us to have proper predicates in the `ParamEnv` for
such projections, and will ICE if we don't.

This commit adds a new method `Instance.ty_env`, which takes a
`ParamEnv` for use during normalization. The MIR const-evaluator code is
changed to use this method, passing in the proper `ParamEnv` for the
context at hand.
…partial, r=Amanieu

change remove to have a PartialEq bound

Addresses [comment](rust-lang#67727 (comment)).

References rust-lang#40062

r? @Amanieu
Use `as_deref()` to replace `as_ref().map(...)`

Suggested by @lzutao
Silence `TooGeneric` error

This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.

Fixes rust-lang#66962.

r? @eddyb
macros: typo fix

spotted while reviewing the todo!macro docs
@Dylan-DPC-zz Dylan-DPC-zz added the rollup A PR which is a rollup label Jan 6, 2020
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Jan 6, 2020

📌 Commit 34716a3 has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 6, 2020
@bors
Copy link
Contributor

bors commented Jan 6, 2020

⌛ Testing commit 34716a3 with merge a80e63f...

bors added a commit that referenced this pull request Jan 6, 2020
Rollup of 6 pull requests

Successful merges:

 - #67800 (Fix ICE involving calling `Instance.ty` during const evaluation)
 - #67873 (change remove to have a PartialEq bound)
 - #67897 (Use `as_deref()` to replace `as_ref().map(...)`)
 - #67906 (Silence `TooGeneric` error)
 - #67912 (macros: typo fix)
 - #67915 (Use Self instead of $type)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented Jan 6, 2020

☀️ Test successful - checks-azure
Approved by: Dylan-DPC
Pushing a80e63f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup 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.

8 participants