summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-35976.rs
blob: aa6f74cb5d45ae0ffd98fd5d231cd79d67198f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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() {}