#![feature(type_alias_impl_trait)] use std::fmt::Display; type Opaque = impl Sized + 'static; #[define_opaque(Opaque)] fn define() -> Opaque {} trait Trait { type Assoc: Display; } impl<'a> Trait for Opaque<&'a str> { //~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates type Assoc = &'a str; } // ======= Exploit ======= fn extend(s: T::Assoc) -> Box { Box::new(s) } fn main() { let val = extend::>(&String::from("blah blah blah")); println!("{}", val); }