rust/tests/ui/impl-trait/in-trait/foreign.rs
2023-09-07 00:49:09 +00:00

28 lines
476 B
Rust

// check-pass
// aux-build: rpitit.rs
extern crate rpitit;
use rpitit::{Foo, Foreign};
use std::sync::Arc;
// Implement an RPITIT from another crate.
struct Local;
impl Foo for Local {
#[allow(refining_impl_trait)]
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();
}