Repository navigation
Closed
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.
Activity
nikomatsakis commentedon May 23, 2019
The problem seems to be here:
rust/src/librustc/traits/select.rs
Lines 2163 to 2171 in f688ba6
util::supertraitsyields up unnormalized trait references, in particular.istankovic commentedon Oct 20, 2023
The example compiles with 1.73.
fmease commentedon Sep 18, 2025
Might or might not need a regression test. Bisecting to the PR that fixed it might clear that up.
lukaslueg commentedon Oct 2, 2025
Compiles since nightly-2024-11-27
get_commits_between returning commits, len: 4
commit[0] 2024-11-25: Auto merge of #133247 - GuillaumeGomez:reduce-integer-display-impl, r=workingjubilee
commit[1] 2024-11-26: Auto merge of #133465 - ehuss:update-cargo, r=ehuss
commit[2] 2024-11-26: Auto merge of #132894 - frank-king:feature/where-refactor, r=cjgillot
commit[3] 2024-11-26: Auto merge of #133500 - GuillaumeGomez:rollup-4vcthwo, r=GuillaumeGomez
zakrad commentedon Jul 30, 2026
@rustbot claim
Rollup merge of rust-lang#160338 - zakrad:regr-test-61083, r=JohnTitor
Rollup merge of rust-lang#160338 - zakrad:regr-test-61083, r=JohnTitor
Rollup merge of rust-lang#160338 - zakrad:regr-test-61083, r=JohnTitor
Rollup merge of rust-lang#160338 - zakrad:regr-test-61083, r=JohnTitor
Rollup merge of rust-lang#160338 - zakrad:regr-test-61083, r=JohnTitor
Rollup merge of rust-lang#160338 - zakrad:regr-test-61083, r=JohnTitor
Unrolled build for #160338
Rollup merge of #160338 - zakrad:regr-test-61083, r=JohnTitor