Skip to content

check predicates, well-formedness in the MIR type-checker #45827

Closed
@nikomatsakis

Description

@nikomatsakis

The MIR type-checker does not currently check that the predicates associated with values are met. For example, when you have a MIR rvalue that references a fn item, we should be checked that the where-clauses on that function are satisfied; similarly, we should check that when a struct rvalue is instantiated, its predicates are satisfied.

(More generally, to cope with NLL, I think we may need to ensure that the type of each variable is WF also when it is used, so that we enforce constraints at the right locations? But let's start with the basics.)

Before addressing this, we should fix #45889, which will introduce the check_rvalue method and build up a bit more infrastructure. The instructions in #45889 check that each field has a suitable type, but they don't check that the where-clauses declared on the struct are met. I'll leave some instructions here shortly once #45889 proceeds a bit further.

(Hint: a good first step is that we have to write-up a test case or 3!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions