Rust 2021 Edition Planning

Rust 2020 Roadmap Goal:

  • Follow-through on “unfinished business”
  • Prepare for a Rust 2021 Edition
  • Breaking changes in by October 2020

My hope for this meeting

  • We can try to sharpen a bit the things we think are top priorities and why, keeping “mid 2021” as a kind of time-frame

Ergonomics initiative and other “unfinished business” from Rust 2018


impl Trait

Still a number of things left to be resolved here:
  • impl Trait in traits
  • linked to associated types and generic associated types
  • requires a bit of design work
  • impl Trait in trait impls
  • some differences between RFC and the actual inference that we do

This can be a major enabler. For example, in at least some cases, it can enable async fn in traits (not the hardest ones), by permitting e.g.

trait Service {
  type Future: Future<...>;

  fn process_request(&mut self) -> Self::Future
}

impl Service for MyType {
  type Future = impl Future;
  fn process_request(&mut self) -> Self::Future { async move { .. } }
}

  • Smaller details:
  • turbofish is not allowed in method calls self.foo::<A, B>, needs to be decided
  • boats: my inclination would be to make impl Trait not specifiable
trait Foo {
  fn foo<T>(x: impl FnOnce() -> T);
}

self.foo::<u32> // error today, but it would be nice to support it
  • then you can use impl Trait for things you wouldn’t want to specify
  • downside: you can’t switch from foo<T: Debug>(t: T) to fn foo(t: impl Debug)
  • true today, wouldn’t always have worked before either
  • e.g., fn foo<A, B>(b: B, a: A) probably wouldn’t work?
  • door is also not forever closed, it we did permit it, they would have to be optional
  • scottmcm: implications of having to figure out the order doesn’t feel great to me, I’d rather say make it a real generic

Implicit mod submodule