Closed
Description
The code below yields two errors:
- The field is private
- Type error in if expression because type is
<type of private field>
instead ofbool
This means a user can observe the type of a private field of a dependency in their error messages. It doesn't mean they can actually use that information, but it seems weird at least.
Is this actually an issue? If you don't consider it one, feel free to close this.
fn main() {
let x = foo::Foo::default();
if x.len {
println!("foo");
}
}
mod foo {
#[derive(Default)]
pub struct Foo {
len: String,
}
impl Foo {
pub fn len(&self) -> usize {
42
}
}
}
(originally seen on reddit)