Skip to content

Commit

Permalink
test for reachable private impl
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed May 8, 2023
1 parent dfe3188 commit e315bbf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/ui/reachable/auxiliary/foreign-priv-aux.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions tests/ui/reachable/foreign-priv.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit e315bbf

Please sign in to comment.