#![feature(type_alias_impl_trait)] #![allow(dead_code)] use std::fmt::Debug; type FooX = impl Debug; trait Foo { } impl Foo for () { } //~^ cannot implement trait on type alias impl trait fn foo() -> impl Foo { () } fn main() { }