Nonsensical "trait bound is not satisfied" error on trait method definition
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
use std::ops::Deref;
// Imagine mapping ((T, U), V) to fn(T, U) -> V
trait SignatureToFnPtr {
type Ptr;
}
trait DerefsToFn<Args>
where
(Args, Self::Output): SignatureToFnPtr,
Self: Deref<Target = <(Args, Self::Output) as SignatureToFnPtr>::Ptr>,
{
type Output;
fn method(&self);
}
I expected to see this happen: the code compiles correctly.
Instead, this happened:
error[E0277]: the trait bound `(Args, <RustaceansAreAwesome as DerefsToFn<Args>>::Output): SignatureToFnPtr` is not satisfied
--> src/lib.rs:14:5
|
14 | fn method(&self);
| ^^^^^^^^^^^^^^^^^ the trait `SignatureToFnPtr` is not implemented for `(Args, <RustaceansAreAwesome as DerefsToFn<Args>>::Output)`
RustaceansAreAwesomelook like an implementation detail that shouldn't have leaked.(Args, Self::Output): SignatureToFnPtrshould follow from thewherebound on the trait definition.- The error is not shown if
fn method(&self)is replaced withfn method(self).
This looks like two different regressions in the two trait solvers. I bisected the old solver regression to #138174, @jnkel bisected the next solver regression to #156976. Tentatively marking as regression-from-stable-to-stable, but it's old enough that this might not be useful (the last version where this worked by default is nightly-2025-03-12)...
Meta
rustc --version --verbose:
rustc 1.100.0-nightly (f7d782a3b 2026-08-19)
binary: rustc
commit-hash: f7d782a3be46d6bb4b9792fe69a61db389ba1769
commit-date: 2026-08-19
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
@rustbot label +A-trait-system +T-compiler +regression-from-stable-to-stable
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Rust reproduction with the reported nightly version and compare behavior with the last working nightly. Read the trait-system regressions identified in #138174 and #156976 to understand the solver differences. Done means the reproduction no longer emits the leaked implementation detail or incorrect unsatisfied-bound error, while preserving the intended reference-receiver behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100