summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/in-trait/foreign.rs
blob: b0fbe3a3d4a741e3a6b15763d408e67c05427687 (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
25
26
// check-pass
// aux-build: rpitit.rs
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
// revisions: current next

extern crate rpitit;

use rpitit::{Foo, Foreign};
use std::sync::Arc;

// Implement an RPITIT from another crate.
struct Local;
impl Foo for Local {
    fn bar(self) -> Arc<String> { Arc::new(String::new()) }
}

fn generic(f: impl Foo) {
    let x = &*f.bar();
}

fn main() {
    // Witness an RPITIT from another crate.
    let &() = Foreign.bar();

    let x: Arc<String> = Local.bar();
}