Skip to content

Integrate projection types into method dispatch #20469

Closed
@nikomatsakis

Description

@nikomatsakis

Currently you must use UFCS form to invoke methods. Here is an example by @kinghajj:

#![feature(associated_types)]

trait Foo {
  fn foo(&self) -> ();
}

trait Bar {
  type F: Foo;
}

struct Wat<B: Bar> {
  fs: Vec<B::F>,
}

impl<B: Bar> Wat<B> {
  fn wat(&mut self) -> () {
    self.fs.pop().unwrap().foo();
  }
}

fn main() {
}

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions