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

WF rules for structs #146

Closed
nikomatsakis opened this issue Oct 14, 2023 · 2 comments
Closed

WF rules for structs #146

nikomatsakis opened this issue Oct 14, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@nikomatsakis
Copy link
Contributor

In #145, @jackh726 added basic WF rules for ADTs:

(
(for_all(&decls, &env, &assumptions, &parameters, &prove_wf) => c)
--- ("ADT")
(prove_wf(decls, env, assumptions, RigidTy { name: RigidName::AdtId(_), parameters }) => c)
)

These rules effectively say that Foo<T0...Tn> is WF if T0..Tn are WF. That's necessary but not sufficient. They should also look up the where-clauses declared on Foo and prove that those hold.

@nikomatsakis nikomatsakis added the good first issue Good for newcomers label Oct 14, 2023
@nikomatsakis
Copy link
Contributor Author

Mentoring instructions

The Decls struct needs to be extended to include information about each ADT, similar to the existing trait_decls field. I imagine something like adt_decls: Vec<AdtDecl>. Like [TraitDecl], each AdtDecl would have a id: AdtId field and a binder field, the bound data for which stores the where-clauses (and eventually the field names and types). This would be populated based on the structs and enums appearing in the crates.

@shua
Copy link
Contributor

shua commented Jun 28, 2024

I guess this was completed in #148? I do see a check for where clauses on adts.

@lcnr lcnr closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants