Skip to content

Termination rule should also apply to instantiating specifics #5167

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

Open
josh11b opened this issue Mar 21, 2025 · 0 comments
Open

Termination rule should also apply to instantiating specifics #5167

josh11b opened this issue Mar 21, 2025 · 0 comments

Comments

@josh11b
Copy link
Contributor

josh11b commented Mar 21, 2025

In this example:

interface I {
  let T:! type;
  default fn F() -> T;
}

fn I.F() -> T {
  class C {
    // `I` is complete, but `I.F`'s default
    // value is still being defined.
    impl as I where .T = i32 {}
  }
}

If the default definition of I.F is eveer used, it will lead to an infinite instantiation loop. This is because forming the specific for a given type U will trigger creation of a new class C(U), which itself has an impl of I that uses the default value of I.F.

We should apply the termination check to formation of specifics to detect this problem, since each instantiation is strictly more complex.

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

No branches or pull requests

1 participant