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