2021-05-13 10:42:25 -04:00
|
|
|
// revisions: mirunsafeck thirunsafeck
|
|
|
|
// [thirunsafeck]compile-flags: -Z thir-unsafeck
|
|
|
|
|
2016-08-24 21:10:19 +03:00
|
|
|
union U {
|
2016-08-26 19:23:42 +03:00
|
|
|
principal: u8,
|
2016-08-24 21:10:19 +03:00
|
|
|
}
|
|
|
|
|
2016-08-26 19:23:42 +03:00
|
|
|
impl U {
|
|
|
|
fn calculate(&self) {}
|
2016-08-24 21:10:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2016-09-04 21:14:41 +02:00
|
|
|
let u = U { principle: 0 };
|
|
|
|
//~^ ERROR union `U` has no field named `principle`
|
2018-12-20 18:10:46 -05:00
|
|
|
//~| HELP a field with a similar name exists
|
|
|
|
//~| SUGGESTION principal
|
2016-09-28 19:27:23 +10:00
|
|
|
let w = u.principial; //~ ERROR no field `principial` on type `U`
|
2018-12-20 18:10:46 -05:00
|
|
|
//~| HELP a field with a similar name exists
|
|
|
|
//~| SUGGESTION principal
|
2016-08-26 19:23:42 +03:00
|
|
|
|
|
|
|
let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U`
|
2019-01-02 17:01:03 -05:00
|
|
|
//~| HELP use parentheses to call the method
|
2020-03-11 20:38:21 -07:00
|
|
|
//~| SUGGESTION ()
|
2016-08-24 21:10:19 +03:00
|
|
|
}
|