-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.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.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.
Description
This example does not compile, but I believe it ought to (playground):
use std::vec::Vec;
trait Foo<T> { }
trait Bar<T: Iterator>: Foo<T::Item> { }
fn a(x: &(impl Foo<u32> + ?Sized)) {
}
fn b(y: &dyn Bar<std::vec::IntoIter<u32>>) {
a(y)
}
fn main() {
}
we get the error:
error[E0277]: the trait bound `dyn Bar<std::vec::IntoIter<u32>>: Foo<u32>` is not satisfied
--> src/main.rs:12:5
|
12 | a(y)
| ^ the trait `Foo<u32>` is not implemented for `dyn Bar<std::vec::IntoIter<u32>>`
|
note: required by `a`
--> src/main.rs:7:1
|
7 | fn a(x: &(impl Foo<u32> + ?Sized)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note that changing b
like so compiles (playground):
fn b(y: &(impl Bar<std::vec::IntoIter<u32>> + ?Sized)) { }
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.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.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.