test for reachable private impl

This commit is contained in:
Michael Goulet 2023-05-08 21:43:03 +00:00
parent dfe31889e1
commit e315bbf736
2 changed files with 33 additions and 0 deletions

View 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()
}
}

View 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();
}