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)`
RustaceansAreAwesome look like an implementation detail that shouldn't have leaked.
(Args, Self::Output): SignatureToFnPtr should follow from the where bound on the trait definition.
- The error is not shown if
fn method(&self) is replaced with fn 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
I tried this code:
I expected to see this happen: the code compiles correctly.
Instead, this happened:
RustaceansAreAwesomelook like an implementation detail that shouldn't have leaked.(Args, Self::Output): SignatureToFnPtrshould follow from thewherebound on the trait definition.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:@rustbot label +A-trait-system +T-compiler +regression-from-stable-to-stable