`todo!()` should prevent "unused_variables" warning

It does. (That's why it works with any concrete return type.)

That's the part that's missing. There's some discussion here.[1] Note that there are some thorny questions as that would mean ! implements Copy and Drop, implements other sets of mutually exclusive traits should we get those, implements Trait and !Trait given some version of negative implementations, etc.

Also it "should" implement a trait with "all" associated types for the desired result, or this still won't compile:

fn example() -> impl Iterator<Item = String> { todo!() }

  1. And elsewhere but that's the one I found off-hand. ↩︎

3 Likes