]> git.proxmox.com Git - rustc.git/blob - tests/ui/impl-trait/in-trait/foreign.rs
New upstream version 1.73.0+dfsg1
[rustc.git] / tests / ui / impl-trait / in-trait / foreign.rs
1 // check-pass
2 // aux-build: rpitit.rs
3
4 extern crate rpitit;
5
6 use rpitit::{Foo, Foreign};
7 use std::sync::Arc;
8
9 // Implement an RPITIT from another crate.
10 struct Local;
11 impl Foo for Local {
12 fn bar(self) -> Arc<String> {
13 Arc::new(String::new())
14 }
15 }
16
17 fn generic(f: impl Foo) {
18 let x = &*f.bar();
19 }
20
21 fn main() {
22 // Witness an RPITIT from another crate.
23 let &() = Foreign.bar();
24
25 let x: Arc<String> = Local.bar();
26 }