Trait resolution case seems like it should work, but doesn't

I have to following minimal example:

use std::iter::once;

trait TokenSpec {
    type Ident;

impl TokenSpec for String {
    type Ident = String;

struct Expr<I> {
    ident: I,

type Input = Expr<<String as TokenSpec>::Ident>;

fn foo() -> impl Iterator<Item = Input> {
    once(Expr { ident: "my_string".to_string() })

fn main() {
    let v: Vec<_> = foo().collect();
    println!("{:?}", v);

It fails to compile (playground) and I’m not sure why. The way I understand it, since String is not a type parameter, its associated type should just be substituted with the concrete type for the resolution process.

This seems like a bug (or limitation) with impl Trait to me because similar Box<Iterator = ...> code compiles.

I’d file an issue (please post the link here if you do) and see what the smart folks over there say.

Thanks! I always wait for your seal of approval before daring to think that my problem might be a compiler bug. :wink: