mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
25 lines
544 B
Rust
25 lines
544 B
Rust
// revisions: imported unimported
|
|
//[imported] check-pass
|
|
|
|
mod private {
|
|
pub trait Future {
|
|
//[unimported]~^^ HELP perhaps add a `use` for it
|
|
fn wait(&self) where Self: Sized;
|
|
}
|
|
|
|
impl Future for Box<dyn Future> {
|
|
fn wait(&self) { }
|
|
}
|
|
}
|
|
|
|
#[cfg(imported)]
|
|
use private::Future;
|
|
|
|
fn bar(arg: Box<dyn private::Future>) {
|
|
// Importing the trait means that we don't autoderef `Box<dyn Future>`
|
|
arg.wait();
|
|
//[unimported]~^ ERROR the `wait` method cannot be invoked on a trait object
|
|
}
|
|
|
|
fn main() {}
|