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