limit and delimit available fields in note

Also, don't show the note if no fields are available (usually due to
privacy).
This commit is contained in:
Zack M. Davis 2017-07-31 00:31:32 -07:00
parent bf7e91f61d
commit 2dbfa3995e
11 changed files with 46 additions and 29 deletions

View file

@ -16,5 +16,5 @@ fn main() {
let s = Field::Fool { joke: 0 };
//~^ ERROR E0559
//~| NOTE `Field::Fool` does not have this field
//~| NOTE available fields are: x
//~| NOTE available fields are: `x`
}

View file

@ -16,5 +16,5 @@ fn main() {
let s = Simba { mother: 1, father: 0 };
//~^ ERROR E0560
//~| NOTE `Simba` does not have this field
//~| NOTE available fields are: mother
//~| NOTE available fields are: `mother`
}

View file

@ -16,5 +16,5 @@ fn main() {
let homura = Homura::Akemi { kaname: () };
//~^ ERROR variant `Homura::Akemi` has no field named `kaname`
//~| NOTE `Homura::Akemi` does not have this field
//~| NOTE available fields are: madoka
//~| NOTE available fields are: `madoka`
}

View file

@ -14,7 +14,7 @@ fn main() {
let s = S{0b1: 10, 0: 11};
//~^ ERROR struct `S` has no field named `0b1`
//~| NOTE `S` does not have this field
//~| NOTE available fields are: 0, 1
//~| NOTE available fields are: `0`, `1`
match s {
S{0: a, 0x1: b, ..} => {}
//~^ ERROR does not have a field named `0x1`

View file

@ -18,6 +18,6 @@ fn main() {
bar: 0
//~^ ERROR struct `BuildData` has no field named `bar`
//~| NOTE `BuildData` does not have this field
//~| NOTE available fields are: foo
//~| NOTE available fields are: `foo`
};
}

View file

@ -28,7 +28,7 @@ fn main () {
bb: 20,
//~^ ERROR struct `xc::B` has no field named `bb`
//~| NOTE `xc::B` does not have this field
//~| NOTE available fields are: a
//~| NOTE available fields are: `a`
};
// local crate struct
let l = A {

View file

@ -20,7 +20,7 @@ fn main() {
let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field
//~^ ERROR union `U` has no field named `c`
//~| NOTE `U` does not have this field
//~| NOTE available fields are: a, b
//~| NOTE available fields are: `a`, `b`
let u = U { ..u }; //~ ERROR union expressions should have exactly one field
//~^ ERROR functional record update syntax requires a struct