1 mod submodule { 2 3 #[derive(Default)] 4 pub struct Demo { 5 pub favorite_integer: isize, 6 secret_integer: isize, 7 pub innocently_misspellable: (), 8 another_field: bool, 9 yet_another_field: bool, 10 always_more_fields: bool, 11 and_ever: bool, 12 } 13 14 impl Demo { new_with_secret_two() -> Self15 fn new_with_secret_two() -> Self { 16 Self { secret_integer: 2, inocently_mispellable: () } 17 //~^ ERROR no field 18 } 19 new_with_secret_three() -> Self20 fn new_with_secret_three() -> Self { 21 Self { secret_integer: 3, egregiously_nonexistent_field: () } 22 //~^ ERROR no field 23 } 24 } 25 26 } 27 main()28fn main() { 29 use submodule::Demo; 30 31 let demo = Demo::default(); 32 let innocent_field_misaccess = demo.inocently_mispellable; 33 //~^ ERROR no field 34 // note shouldn't suggest private fields 35 let egregious_field_misaccess = demo.egregiously_nonexistent_field; 36 //~^ ERROR no field 37 } 38