Open
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