-
Notifications
You must be signed in to change notification settings - Fork 183
Intern Vec<ProgramClause<I>> #370
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
|
|
@@ -1208,8 +1208,8 @@ pub struct ProgramClauseImplication<I: Interner> { | |
| pub conditions: Goals<I>, | ||
| } | ||
|
|
||
| #[derive(Clone, PartialEq, Eq, Hash, HasInterner)] | ||
| pub enum ProgramClause<I: Interner> { | ||
| #[derive(Clone, PartialEq, Eq, Hash, Fold, HasInterner)] | ||
| pub enum ProgramClauseData<I: Interner> { | ||
| Implies(ProgramClauseImplication<I>), | ||
| ForAll(Binders<ProgramClauseImplication<I>>), | ||
| } | ||
|
|
@@ -1227,17 +1227,42 @@ impl<I: Interner> ProgramClauseImplication<I> { | |
| } | ||
| } | ||
|
|
||
| impl<I: Interner> ProgramClause<I> { | ||
| pub fn into_from_env_clause(self, interner: &I) -> ProgramClause<I> { | ||
| impl<I: Interner> ProgramClauseData<I> { | ||
| pub fn into_from_env_clause(self, interner: &I) -> ProgramClauseData<I> { | ||
| match self { | ||
| ProgramClause::Implies(implication) => { | ||
| ProgramClause::Implies(implication.into_from_env_clause(interner)) | ||
| ProgramClauseData::Implies(implication) => { | ||
| ProgramClauseData::Implies(implication.into_from_env_clause(interner)) | ||
| } | ||
| ProgramClause::ForAll(binders_implication) => { | ||
| ProgramClause::ForAll(binders_implication.map(|i| i.into_from_env_clause(interner))) | ||
| ProgramClauseData::ForAll(binders_implication) => { | ||
| ProgramClauseData::ForAll(binders_implication.map(|i| i.into_from_env_clause(interner))) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| pub fn intern(self, interner: &I) -> ProgramClause<I> { | ||
| ProgramClause { | ||
| clause: interner.intern_program_clause(self), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord, HasInterner)] | ||
| pub struct ProgramClause<I: Interner> { | ||
| clause: I::InternedProgramClause, | ||
| } | ||
|
|
||
| impl<I: Interner> ProgramClause<I> { | ||
nikomatsakis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pub fn into_from_env_clause(self, interner: &I) -> ProgramClause<I> { | ||
| let program_clause_data = self.data(interner); | ||
| let new_clause = program_clause_data.clone().into_from_env_clause(interner); | ||
| ProgramClause { | ||
nikomatsakis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| clause: interner.intern_program_clause(new_clause), | ||
| } | ||
| } | ||
|
|
||
| pub fn data(&self, interner: &I) -> &ProgramClauseData<I> { | ||
| interner.program_clause_data(&self.clause) | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also I think we should add an |
||
|
|
||
| /// Wraps a "canonicalized item". Items are canonicalized as follows: | ||
|
|
||
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
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.
Nit: I think we we call this
internedin all the other structsThere 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.
We call it
internedexcept inGoalandGoalsIIRC. I think those should be renamed and everything should beinterned.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.
It looks like @tirr-c fixed the new cases in this PR, we can create an issue for the others