Skip to content

Commit ed778f9

Browse files
author
Junseok Lee
committed
added local crate struct with priv field to test
1 parent 22e8175 commit ed778f9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/compile-fail/suggest-private-fields.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,23 @@ extern crate "struct-field-privacy" as xc;
44

55
use xc::B;
66

7+
struct A {
8+
pub a: u32,
9+
b: u32,
10+
}
11+
712
fn main () {
13+
// external crate struct
814
let k = B {
915
aa: 20, //~ ERROR structure `struct-field-privacy::B` has no field named `aa`
1016
//~^ HELP did you mean `a`?
1117
bb: 20, //~ ERROR structure `struct-field-privacy::B` has no field named `bb`
1218
};
19+
// local crate struct
20+
let l = A {
21+
aa: 20, //~ ERROR structure `A` has no field named `aa`
22+
//~^ HELP did you mean `a`?
23+
bb: 20, //~ ERROR structure `A` has no field named `bb`
24+
//~^ HELP did you mean `b`?
25+
};
1326
}

0 commit comments

Comments
 (0)