-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsT-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.
Description
rustc stable 1.58.1
The following code gives a strange error when just mentioning foo, without even calling it. As far as I can tell the bounds are well-formed, and the error can't be about passing the wrong type to foo because it isn't even getting called. Playground
trait Bar{}
trait Baz<T> {
type Output;
}
fn foo<F>(f: F)
where
for<'a> F: Baz<&'a u32>,
for<'a> <F as Baz<&'a u32>>::Output: Bar,
{
}
fn main() {
foo; // error[E0277]: the trait bound `for<'a> <_ as Baz<&'a u32>>::Output: Bar` is not satisfied
}Full error:
error[E0277]: the trait bound `for<'a> <_ as Baz<&'a u32>>::Output: Bar` is not satisfied
--> src/main.rs:14:5
|
14 | foo; // error[E0277]: the trait bound `for<'a> <_ as Baz<&'a u32>>::Output: Bar` is not satisfied
| ^^^ the trait `for<'a> Bar` is not implemented for `<_ as Baz<&'a u32>>::Output`
|
note: required by a bound in `foo`
--> src/main.rs:9:42
|
6 | fn foo<F>(f: F)
| --- required by a bound in this
...
9 | for<'a> <F as Baz<&'a u32>>::Output: Bar,
| ^^^ required by this bound in `foo`
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsT-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.