rust/tests/ui/impl-trait/in-trait/foreign.rs

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

27 lines
442 B
Rust
Raw Normal View History

2022-09-22 19:56:55 -05:00
// check-pass
// aux-build: rpitit.rs
extern crate rpitit;
2023-04-30 16:52:35 -05:00
use rpitit::{Foo, Foreign};
use std::sync::Arc;
// Implement an RPITIT from another crate.
struct Local;
2023-04-30 16:52:35 -05:00
impl Foo for Local {
fn bar(self) -> Arc<String> {
Arc::new(String::new())
}
}
fn generic(f: impl Foo) {
let x = &*f.bar();
}
2022-09-22 19:56:55 -05:00
fn main() {
// Witness an RPITIT from another crate.
2023-04-30 16:52:35 -05:00
let &() = Foreign.bar();
2023-04-30 16:52:35 -05:00
let x: Arc<String> = Local.bar();
2022-09-22 19:56:55 -05:00
}