mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-24 14:34:23 +00:00
21 lines
319 B
Rust
21 lines
319 B
Rust
fn main() {
|
|
let x = foo::Foo::default();
|
|
if x.len {
|
|
//~^ ERROR field `len` of struct `Foo` is private
|
|
println!("foo");
|
|
}
|
|
}
|
|
|
|
mod foo {
|
|
#[derive(Default)]
|
|
pub struct Foo {
|
|
len: String,
|
|
}
|
|
|
|
impl Foo {
|
|
pub fn len(&self) -> usize {
|
|
42
|
|
}
|
|
}
|
|
}
|