Code
use ::priv_dep::NUM; // private dependency
pub struct U<const X: u8>;
pub fn foo(_: U<NUM>) {}
Current output
Desired output
error: constant `NUM` from private dependency 'priv_dep' in public interface
--> $DIR/file.rs:0:0
|
LL | pub fn foo(_: U<NUM>) {}
| ^^^
Rationale and extra context
We're linting on the same thing if it's normal generic instead of const generic. I believe this exposes the private dependency because it could change the constant which would change our public interface.
Similar issue for const generics also exist in reexports of const generic structs, implementations on those structs, implementation of const generic traits and so on.
The re-export lint correctly identifies constants from private dependencies.
Other cases
Rust Version
Anything else?
Tracking issue for the lint #44663
@rustbot label +F-public_private_dependencies +L-exported_private_dependencies +A-lints +A-visibility
Changes to this lint are currently reviewed in #160726 but it doesn't change this.
Code
Current output
Desired output
Rationale and extra context
We're linting on the same thing if it's normal generic instead of const generic. I believe this exposes the private dependency because it could change the constant which would change our public interface.
Similar issue for const generics also exist in reexports of const generic structs, implementations on those structs, implementation of const generic traits and so on.
The re-export lint correctly identifies constants from private dependencies.
Other cases
Rust Version
Anything else?
Tracking issue for the lint #44663
@rustbot label +F-public_private_dependencies +L-exported_private_dependencies +A-lints +A-visibility
Changes to this lint are currently reviewed in #160726 but it doesn't change this.