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

Add implied bounds #56

Closed
wants to merge 2 commits into from
Closed

Conversation

scalexm
Copy link
Member

@scalexm scalexm commented Sep 12, 2017

These commits add implied bounds on structs and remove WF conditions for type parameters in WF predicates, e.g. before this PR we had:

WF(T: Clone) :- WF(T)

and after this PR:

WF(T: Clone).

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few nits, really just requests for documentation.

src/lower/mod.rs Outdated
// we generate the following clause:
//
// for<?T> WF(Foo<?T>) :- WF(?T), (?T: Eq), WF(?T: Eq).
macro_rules! well_formed {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a comment explaining what this does =)

}

// Here, we do know that `T: Clone`, so we can.
// Here, we do know that `T: Eq`, so we can.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: T: Eq<T>

}

impl<T: ExpandWhereClauses> WellFormed for ir::Binders<T> {
fn wf_clauses(&self, wf_predicate: ir::WellFormed, program: &ir::Program)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely prefer this to the macro, but I'd still like some comments. =)

src/lower/mod.rs Outdated
tys.chain(where_clauses.iter().cloned().casted()).collect()
}
consequence: wf_predicate.clone().cast(),
conditions: where_clauses.iter().cloned().casted().collect(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in particular it's not obvious to me what has changed in this commit other than tests, just looking at the code anyhow

@scalexm
Copy link
Member Author

scalexm commented Feb 5, 2018

Closing in favor of #82.

@scalexm scalexm closed this Feb 5, 2018
@scalexm scalexm deleted the implied-bounds branch November 29, 2018 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants