mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
Add test for public struct with private fields
This commit is contained in:
parent
a4f47de7ff
commit
e0e379b6fd
@ -18,6 +18,11 @@ pub struct TupleStruct(pub usize, pub &'static str);
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct StructWithFields {
|
||||
pub foo: isize,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct StructWithPrivFields {
|
||||
foo: isize,
|
||||
}
|
||||
|
||||
|
@ -8,5 +8,7 @@ extern crate xcrate_unit_struct;
|
||||
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