2012-06-12 14:05:26 -05:00
|
|
|
enum newtype {
|
|
|
|
newtype(int)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
|
|
|
// Test that borrowck treats enums with a single variant
|
|
|
|
// specially.
|
|
|
|
|
|
|
|
let x = @mut 5;
|
|
|
|
let y = @mut newtype(3);
|
2012-08-06 14:34:08 -05:00
|
|
|
let z = match *y {
|
2012-08-03 21:59:04 -05:00
|
|
|
newtype(b) => {
|
2012-06-12 14:05:26 -05:00
|
|
|
*x += 1;
|
|
|
|
*x * b
|
|
|
|
}
|
|
|
|
};
|
|
|
|
assert z == 18;
|
|
|
|
}
|