-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-associated_type_defaults`#![feature(associated_type_defaults)]``#![feature(associated_type_defaults)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
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
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.F-associated_type_defaults`#![feature(associated_type_defaults)]``#![feature(associated_type_defaults)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.