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

Overflow evaluating the requirement on associated_type_defaults bounded on the field it's being assigned #137434

Open
udoprog opened this issue Feb 22, 2025 · 0 comments
Labels
C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.

Comments

@udoprog
Copy link
Contributor

udoprog commented Feb 22, 2025

I tried this code:

#![feature(associated_type_defaults)]

trait Trait {
    type A;
}

trait Other<T>
where
    T: Trait<A = Self::A>,
{
    type A = T::A;
}

See playground.

I expected the associated type default to compile since the bound is valid when implementing the trait. In my mind type A = T::A should be compatible with the T: Trait<A = Self::A> constraint;

Instead, this happened:

error[E0275]: overflow evaluating the requirement `<Self as UnsizedVisitor<T>>::A == _`
  --> src/lib.rs:12:14
   |
12 |     type A = T::A;
   |              ^^^^

Meta

rustc --version --verbose:

binary: rustc
commit-hash: 794c12416b2138064af1f2746646973fafd9419d
commit-date: 2025-02-21
host: x86_64-pc-windows-msvc
release: 1.87.0-nightly
LLVM version: 20.1.0
@udoprog udoprog added the C-bug Category: This is a bug. label Feb 22, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 22, 2025
@udoprog udoprog changed the title Overflow evaluating the requirement on associated_type_defaults bounded on the field it's being assigned Overflow evaluating the requirement on associated_type_defaults bounded on the field it's being assigned Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.
Projects
None yet
Development

No branches or pull requests

2 participants