]> git.lizzy.rs Git - rust.git/blob - tests/ui/object-safety/issue-102762.rs
Rollup merge of #106605 - notriddle:notriddle/outdated-rustbook, r=GuillaumeGomez
[rust.git] / tests / ui / object-safety / issue-102762.rs
1 // compile-flags: --crate-type=lib
2 // This test checks that the `where_clauses_object_safety` lint does not cause
3 // other object safety *hard errors* to be suppressed, because we currently
4 // only emit one object safety error per trait...
5
6 use std::future::Future;
7 use std::pin::Pin;
8
9 pub trait Fetcher: Send + Sync {
10     fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>>
11     where
12         Self: Sync,
13     {
14         todo!()
15     }
16 }
17
18 fn fetcher() -> Box<dyn Fetcher> {
19     //~^ ERROR the trait `Fetcher` cannot be made into an object
20     todo!()
21 }
22
23 pub fn foo() {
24     let fetcher = fetcher();
25     let _ = fetcher.get();
26 }