Add test for public struct with private fields
This commit is contained in:
parent
a4f47de7ff
commit
e0e379b6fd
@ -18,6 +18,11 @@ pub enum Unit {
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct StructWithFields {
|
||||
pub foo: isize,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct StructWithPrivFields {
|
||||
foo: isize,
|
||||
}
|
||||
|
||||
|
@ -8,5 +8,7 @@
|
||||
fn main() {
|
||||
let _ = xcrate_unit_struct::StructWithFields;
|
||||
//~^ ERROR expected value, found struct `xcrate_unit_struct::StructWithFields`
|
||||
let _ = xcrate_unit_struct::StructWithPrivFields;
|
||||
//~^ ERROR expected value, found struct `xcrate_unit_struct::StructWithPrivFields`
|
||||
let _ = xcrate_unit_struct::Struct;
|
||||
}
|
||||
|
@ -9,6 +9,17 @@ LL | let _ = xcrate_unit_struct::StructWithFields;
|
||||
LL | pub struct StructWithFields {
|
||||
| --------------------------- `xcrate_unit_struct::StructWithFields` defined here
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithPrivFields`
|
||||
--> $DIR/xcrate-unit-struct.rs:11:13
|
||||
|
|
||||
LL | let _ = xcrate_unit_struct::StructWithPrivFields;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithPrivFields { foo: val }`
|
||||
|
|
||||
::: $DIR/auxiliary/xcrate_unit_struct.rs:25:1
|
||||
|
|
||||
LL | pub struct StructWithPrivFields {
|
||||
| ------------------------------- `xcrate_unit_struct::StructWithPrivFields` defined here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0423`.
|
||||
|
Loading…
Reference in New Issue
Block a user