rust/tests/ui/issues/issue-35976.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
546 B
Rust
Raw Normal View History

2022-12-02 04:53:36 +00:00
//@ revisions: imported unimported
//@[imported] check-pass
mod private {
pub trait Future {
2022-12-02 04:53:36 +00:00
//[unimported]~^^ HELP perhaps add a `use` for it
fn wait(&self) where Self: Sized;
}
2019-05-28 18:46:13 +00:00
impl Future for Box<dyn Future> {
fn wait(&self) { }
}
}
2022-12-02 04:53:36 +00:00
#[cfg(imported)]
use private::Future;
2019-05-28 18:46:13 +00:00
fn bar(arg: Box<dyn private::Future>) {
2022-12-02 04:53:36 +00:00
// Importing the trait means that we don't autoderef `Box<dyn Future>`
arg.wait();
2022-12-02 04:53:36 +00:00
//[unimported]~^ ERROR the `wait` method cannot be invoked on a trait object
}
2022-12-02 04:53:36 +00:00
fn main() {}