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`
|
2016-09-28 19:27:23 +10:00
|
|
|
let w = u.principial; //~ ERROR no field `principial` on type `U`
|
|
|
|
//~^ did you mean `principal`?
|
2016-08-26 19:23:42 +03:00
|
|
|
|
|
|
|
let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U`
|
2016-08-24 21:10:19 +03:00
|
|
|
}
|