Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub struct OtherType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// aux-build:priv_dep.rs | ||
#![feature(public_private_dependencies)] | ||
#![deny(leaked_private_dependency)] | ||
|
||
// This crate is a private dependency | ||
extern crate priv_dep; | ||
|
||
use priv_dep::OtherType; | ||
|
||
// Type from private dependency used in private | ||
// type - this is fine | ||
struct PrivateType { | ||
field: OtherType | ||
} | ||
|
||
pub struct PublicType { | ||
pub field: OtherType, | ||
//~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency] | ||
//~| WARNING this was previously accepted | ||
priv_field: OtherType, | ||
} | ||
|
||
impl PublicType { | ||
pub fn pub_fn(param: OtherType) {} | ||
//~^ ERROR type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface [leaked_private_dependency] | ||
//~| WARNING this was previously accepted | ||
|
||
fn priv_fn(param: OtherType) {} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
error: type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface | ||
--> $DIR/pub-priv1.rs:17:5 | ||
| | ||
LL | pub field: OtherType, | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/pub-priv1.rs:3:9 | ||
| | ||
LL | #![deny(leaked_private_dependency)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663> | ||
|
||
error: type `priv_dep::OtherType` from private dependency 'priv_dep' in public interface | ||
--> $DIR/pub-priv1.rs:24:5 | ||
| | ||
LL | pub fn pub_fn(param: OtherType) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #44663 <https://github.com/rust-lang/rust/issues/44663> | ||
|
||
error: aborting due to 2 previous errors | ||
|