-
Notifications
You must be signed in to change notification settings - Fork 69
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
Implement const equality and const wf #340
Labels
major-change
A proposal to make a major change to rustc
major-change-accepted
A major change proposal that was accepted
T-compiler
Add this label so rfcbot knows to poll the compiler team
Comments
lcnr
added
T-compiler
Add this label so rfcbot knows to poll the compiler team
major-change
A proposal to make a major change to rustc
labels
Aug 1, 2020
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. |
@rustbot second |
rustbot
added
the
final-comment-period
The FCP has started, most (if not all) team members are in agreement
label
Aug 1, 2020
spastorino
added
major-change-accepted
A major change proposal that was accepted
and removed
to-announce
Announce this issue on triage meeting
final-comment-period
The FCP has started, most (if not all) team members are in agreement
labels
Aug 5, 2020
This was referenced Sep 10, 2020
tmandry
added a commit
to tmandry/rust
that referenced
this issue
Sep 10, 2020
add the `const_evaluatable_checked` feature Implements a rather small subset of rust-lang/compiler-team#340 Unlike the MCP, this does not try to compare different constant, but instead only adds the constants found in where clauses to the predicates of a function. This PR adds the feature gate `const_evaluatable_checked`, without which nothing should change. r? @oli-obk @eddyb
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 18, 2020
compare generic constants using `AbstractConst`s This is a MVP of rust-lang/compiler-team#340. The changes in this PR should only be relevant if `feature(const_evaluatable_checked)` is enabled. ~~currently based on top of rust-lang#76559, so blocked on that.~~ r? `@oli-obk` cc `@varkor` `@eddyb`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
major-change
A proposal to make a major change to rustc
major-change-accepted
A major change proposal that was accepted
T-compiler
Add this label so rfcbot knows to poll the compiler team
Proposal
What
The goal is to implement a way to unify different
ConstKind::Unevaluated
and to check that all possible instances of const expressions evaluate sucessfully.
The implementation of this PR will not be used with
feature(min_const_generics)
and does not block its stabilization.It will however extend the possibilities and expressivity of const generics by a huge amount. For example the following will be possible thanks to these changes:
For more details on the intended design, see https://hackmd.io/OZG_XiLFRs2Xmw5s39jRzA?view.
How
Add a query running after
mir_const
/mir_validated
which tries to build anAbstractConst
in case the givenDefId
is a generic anonymous constant.AbstractConst
s will not support all mir expressions and are for now restricted to basic arithmetic, arbitrary function calls, and generic constants.This restriction is probably fairly close to simply walking the MIR and erroring when encountering a terminator other than
Goto
,Return
,Call
orAssert
.The exact subset which is allowed is not yet fully clear and will be fleshed out while implementing this.
These abstract consts will then be used to check if two
ConstKind::Unevaluated
unify by walking them while considering their substs.We implement const wf checks by not trying to satisfy
ConstEvaluatable
predicates for consts mentioned in the function signature or where clauses, but instead adding them to thecaller_bounds
of the given item.When we now have to satisfy a
ConstEvaluatable
predicate, we check if the given const can be unified with any of theConstEvaluatable
mentioned in thecaller_bounds
.Mentors or Reviewers
@oli-obk, for changes to the type system @varkor, @eddyb or @nikomatsakis
Process
The main points of the Major Change Process is as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: