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