Skip to content

Type parameters that appear in a trait object assoc type bindings are considered as "not constrained" #21363

Closed
@japaric

Description

@japaric

STR

#![crate_type = "lib"]
#![no_std]

trait Iterator {
    type Item;
}

impl<'a, T> Iterator for &'a mut (Iterator<Item=T> + 'a) {
//~^ error: the type parameter `T` is not constrained by the impl trait, self type, or predicates
    type Item = T;
}

T appears in Self (the trait object assoc type binding) so it should be considered as constrained, and this impl should be accepted. (Also I don't how we could impl<'a> Iterator for &'a mut (Iterator + 'a) { type Item = ??? } without the T type parameter)

Version

rustc 1.0.0-nightly (ed530d7a3 2015-01-16 22:41:16 +0000)

cc @nikomatsakis

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions