diff options
| author | Bryanskiy <ivakin.kir@gmail.com> | 2023-06-19 17:06:00 +0300 |
|---|---|---|
| committer | Bryanskiy <ivakin.kir@gmail.com> | 2023-08-02 13:40:28 +0300 |
| commit | e26614e6a7f8003dfd2a756db070c6d04ca34c6f (patch) | |
| tree | 22bc39fc5f1b096999c0d39a245e9b6261efcdc8 /compiler/rustc_error_codes/src | |
| parent | 5cbfee545543a8e3d91c54997c6bcd24d2054321 (diff) | |
| download | rust-e26614e6a7f8003dfd2a756db070c6d04ca34c6f.tar.gz rust-e26614e6a7f8003dfd2a756db070c6d04ca34c6f.zip | |
Replace old private-in-public diagnostic with type privacy lints
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0445.md | 8 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0446.md | 46 |
3 files changed, 30 insertions, 25 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index d104ff0891d..755e5e26ac6 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -607,6 +607,7 @@ E0794: include_str!("./error_codes/E0794.md"), // E0420, // merged into 532 // E0421, // merged into 531 // E0427, // merged into 530 +// E0445, // merged into 446 and type privacy lints // E0456, // plugin `..` is not available for triple `..` // E0465, // removed: merged with E0464 // E0467, // removed diff --git a/compiler/rustc_error_codes/src/error_codes/E0445.md b/compiler/rustc_error_codes/src/error_codes/E0445.md index e6a28a9c2c4..d47393194c5 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0445.md +++ b/compiler/rustc_error_codes/src/error_codes/E0445.md @@ -1,10 +1,10 @@ -A private trait was used on a public type parameter bound. +#### Note: this error code is no longer emitted by the compiler. -Erroneous code examples: +A private trait was used on a public type parameter bound. -```compile_fail,E0445 -#![deny(private_in_public)] +Previously erroneous code examples: +``` trait Foo { fn dummy(&self) { } } diff --git a/compiler/rustc_error_codes/src/error_codes/E0446.md b/compiler/rustc_error_codes/src/error_codes/E0446.md index 6ec47c4962c..ebbd83c683c 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0446.md +++ b/compiler/rustc_error_codes/src/error_codes/E0446.md @@ -1,16 +1,16 @@ -A private type was used in a public type signature. +A private type or trait was used in a public associated type signature. Erroneous code example: ```compile_fail,E0446 -#![deny(private_in_public)] -struct Bar(u32); - -mod foo { - use crate::Bar; - pub fn bar() -> Bar { // error: private type in public interface - Bar(0) - } +struct Bar; + +pub trait PubTr { + type Alias; +} + +impl PubTr for u8 { + type Alias = Bar; // error private type in public interface } fn main() {} @@ -22,13 +22,14 @@ This is done by using pub(crate) or pub(in crate::my_mod::etc) Example: ``` -struct Bar(u32); +struct Bar; + +pub(crate) trait PubTr { // only public to crate root + type Alias; +} -mod foo { - use crate::Bar; - pub(crate) fn bar() -> Bar { // only public to crate root - Bar(0) - } +impl PubTr for u8 { + type Alias = Bar; } fn main() {} @@ -38,12 +39,15 @@ The other way to solve this error is to make the private type public. Example: ``` -pub struct Bar(u32); // we set the Bar type public -mod foo { - use crate::Bar; - pub fn bar() -> Bar { // ok! - Bar(0) - } + +pub struct Bar; // we set the Bar trait public + +pub trait PubTr { + type Alias; +} + +impl PubTr for u8 { + type Alias = Bar; } fn main() {} |
