-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`A-visibilityArea: Visibility / privacyArea: Visibility / privacyT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
struct MyStruct;
pub fn my_test(_v: &MyStruct) {}
fn main() {}
Current output
error[E0446]: private type `MyStruct` in public interface
--> src/bin/main.rs:2:1
|
1 | struct MyStruct;
| --------------- `MyStruct` declared as private
2 | pub fn my_test(_v: &MyStruct) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
Desired output
error[E0446]: private type `MyStruct` in public interface
--> src/bin/main.rs:2:1
|
1 | struct MyStruct;
| --------------- `MyStruct` declared as private
2 | pub fn my_test(_v: &MyStruct) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
Help:
* Either remove the `pub` in `pub fn my_test`
* Or add `pub` to `struct MyStruct;`
Rationale and extra context
Novice developers might be confused by the current wording of "leaking private type", and this seems like an easy help message fix.
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`A-visibilityArea: Visibility / privacyArea: Visibility / privacyT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.