]> git.proxmox.com Git - rustc.git/blob - src/test/ui/union/union-suggest-field.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / union / union-suggest-field.rs
1 // revisions: mirunsafeck thirunsafeck
2 // [thirunsafeck]compile-flags: -Z thir-unsafeck
3
4 union U {
5 principal: u8,
6 }
7
8 impl U {
9 fn calculate(&self) {}
10 }
11
12 fn main() {
13 let u = U { principle: 0 };
14 //~^ ERROR union `U` has no field named `principle`
15 //~| HELP a field with a similar name exists
16 //~| SUGGESTION principal
17 let w = u.principial; //~ ERROR no field `principial` on type `U`
18 //~| HELP a field with a similar name exists
19 //~| SUGGESTION principal
20
21 let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U`
22 //~| HELP use parentheses to call the method
23 //~| SUGGESTION ()
24 }