-
Notifications
You must be signed in to change notification settings - Fork 39
Add more support to mir fn bodies #197
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3348d07
Support StorageLive and StorageDead
tiif 03e9eab
Add support for struct and field projection
tiif e40e514
UPDATE_EXPECT=1 for all the tests
tiif a2a68bd
fmt
tiif 3ac1307
get field information from decl instead of crate item
tiif 89725d8
Make the adt change pass
tiif 340b857
Get the adt id from the type directly
tiif a259587
Clean up
tiif d06c9ac
Add more checks and test
tiif 8d16309
invoke check place for field projection
tiif f117fcf
add fixme
tiif e464d6e
apply siggestions
tiif d60541a
Fix rebase error
tiif 96b5b08
Cherry-picked prove_sub to use Wcs::all_sub
tiif e207b38
UPDATE_EXPECT=1
tiif cde1c34
Use all_sub
tiif 5ea7e87
fix typo
tiif 364d779
Add comment on the difference between formality and minirust
tiif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use formality_core::judgment_fn; | ||
use formality_types::grammar::{Parameter, Relation, RigidTy, TyData, Wcs}; | ||
|
||
use crate::{ | ||
decls::Decls, | ||
prove::{prove, prove_after::prove_after, prove_normalize::prove_normalize}, | ||
}; | ||
|
||
use super::{constraints::Constraints, env::Env}; | ||
|
||
judgment_fn! { | ||
pub fn prove_sub( | ||
_decls: Decls, | ||
env: Env, | ||
assumptions: Wcs, | ||
a: Parameter, | ||
b: Parameter, | ||
) => Constraints { | ||
debug(a, b, assumptions, env) | ||
|
||
assert(a.kind() == b.kind()) | ||
|
||
trivial(a == b => Constraints::none(env)) | ||
|
||
( | ||
(prove_normalize(&decls, env, &assumptions, &x) => (c, y)) | ||
(prove_after(&decls, c, &assumptions, Relation::sub(y, &z)) => c) | ||
----------------------------- ("normalize-l") | ||
(prove_sub(decls, env, assumptions, x, z) => c) | ||
) | ||
|
||
( | ||
(prove_normalize(&decls, env, &assumptions, &y) => (c, z)) | ||
(prove_after(&decls, c, &assumptions, Relation::sub(&x, &z)) => c) | ||
----------------------------- ("normalize-r") | ||
(prove_sub(decls, env, assumptions, x, y) => c) | ||
) | ||
|
||
( | ||
(let RigidTy { name: a_name, parameters: a_parameters } = a) | ||
(let RigidTy { name: b_name, parameters: b_parameters } = b) | ||
(if a_name == b_name)! | ||
(prove(decls, env, assumptions, Wcs::all_sub(a_parameters, b_parameters)) => c) | ||
----------------------------- ("rigid") | ||
(prove_sub(decls, env, assumptions, TyData::RigidTy(a), TyData::RigidTy(b)) => c) | ||
) | ||
|
||
// FIXME: uncomment this when adding prove_outlives | ||
//( | ||
// (prove_outlives(decls, env, assumptions, a, b) => c) | ||
// ----------------------------- ("lifetime => outlives") | ||
// (prove_sub(decls, env, assumptions, a: Lt, b: Lt) => c) | ||
//) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right now we are checking for ADTs, but eventually we will want to do normalization here -- so probably this
check_place
function should become a judgment at that time