Skip to content

No error reported when a generic parameter doesn't meet the requirement of an associated type #78893

Open
@yshui

Description

@yshui

Code

I tried this code:

trait A {
    type T: Iterator<Item = i32>;
}

trait B {
    fn x(_: impl A<T = impl Send>);
}

I expected to see this happen:

error[E0277]: `impl Send` is not an iterator

Instead, this happened:

Code compiles

Version it worked on

It most recently worked on: 1.48.0-beta.8

Version with regression

rust nightly 2020-11-08 (likely not the earliest)

Metadata

Metadata

Assignees

Labels

A-associated-itemsArea: Associated items (types, constants & functions)A-trait-systemArea: Trait systemC-bugCategory: This is a bug.E-needs-testCall 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.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions