test for reachable private impl
This commit is contained in:
parent
dfe31889e1
commit
e315bbf736
21
tests/ui/reachable/auxiliary/foreign-priv-aux.rs
Normal file
21
tests/ui/reachable/auxiliary/foreign-priv-aux.rs
Normal file
@ -0,0 +1,21 @@
|
||||
trait PrivTrait {
|
||||
fn priv_fn(&self);
|
||||
}
|
||||
|
||||
pub struct ImplPrivTrait;
|
||||
|
||||
impl PrivTrait for ImplPrivTrait {
|
||||
fn priv_fn(&self) {}
|
||||
}
|
||||
|
||||
pub struct Wrapper<T>(T);
|
||||
|
||||
pub trait PubTrait {
|
||||
fn pub_fn(&self);
|
||||
}
|
||||
|
||||
impl<T: PrivTrait> PubTrait for Wrapper<T> {
|
||||
fn pub_fn(&self) {
|
||||
self.0.priv_fn()
|
||||
}
|
||||
}
|
12
tests/ui/reachable/foreign-priv.rs
Normal file
12
tests/ui/reachable/foreign-priv.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// aux-build:foreign-priv-aux.rs
|
||||
// build-pass
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
extern crate foreign_priv_aux;
|
||||
|
||||
use foreign_priv_aux::{ImplPrivTrait, PubTrait, Wrapper};
|
||||
|
||||
pub fn foo(x: Wrapper<ImplPrivTrait>) {
|
||||
x.pub_fn();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user