1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
mod private { pub trait Future { fn wait(&self) where Self: Sized; } impl Future for Box<dyn Future> { fn wait(&self) { } } } //use private::Future; fn bar(arg: Box<dyn private::Future>) { arg.wait(); //~^ ERROR the `wait` method cannot be invoked on a trait object } fn main() { }