Skip to content

lazy norm, infinitely sized types, and the occurs check #133

Open
@lcnr

Description

@lcnr

for type Alias = Vec<Alias>;, equating Alias with Vec<Alias> may succeed:

  • normalizes-to(Alias, Vec<Alias>) -> Vec<Alias>
    • equate(Vec<Alias>, Vec<Alias>) ok via structural equality fast-path

This would cause the occurs check to be incomplete as ?0 eq Vec<?0> can be proven by instantiating ?0 with Alias. The occurs check is strictly required:

trait From<T> {}
impl<T> From<T> for T {}
impl<T> From<T> for Box<T> {}

This issue is pretty much purely theoretical as we're eagerly replacing all aliases inside of the normalized type with infer vars when equating it with the expected term. I don't necessarily believe we need to handle this until somebody crafts an example where this causes 'overlap' of impls allowed due to the occurs check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions