-
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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Description
I tried this code:
trait TypeFn<T> {
type Output;
}
trait Boo {
type Arg;
type CallCopy<F: TypeFn<Self::Arg, Output: Copy>>;
}
impl Boo for () {
type Arg = ();
type CallCopy<F: TypeFn<Self::Arg, Output: Copy>> = F;
}
I expected to see this happen: The code compiles.
Instead, this happened: The code errored with
error[E0277]: the trait bound `F: TypeFn<()>` is not satisfied
--> error.rs:10:5
|
10 | type CallCopy<F: TypeFn<Self::Arg, Output: Copy>> = F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TypeFn<()>` is not implemented for `F`
error[E0276]: impl has stricter requirements than trait
--> error.rs:10:22
|
6 | type CallCopy<F: TypeFn<Self::Arg, Output: Copy>>;
| ------------------------------------------------- definition of `CallCopy` from trait
...
10 | type CallCopy<F: TypeFn<Self::Arg, Output: Copy>> = F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: TypeFn<()>`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0276, E0277.
For more information about an error, try `rustc --explain E0276`.
Meta
rustc --version --verbose
:
rustc 1.88.0 (6b00bc388 2025-06-23)
binary: rustc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5
The error persists on nightly:
rustc 1.90.0-nightly (e46629662 2025-07-17)
binary: rustc
commit-hash: e4662966273ed58b51f9ff8d682accc202aa1210
commit-date: 2025-07-17
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.