X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Ftest%2Frun-pass%2Fborrowck-univariant-enum.rs;h=2e8ddb08064726af9a7f3f3afe7ce0269d75a261;hb=9346a6ac1cf9668de1386d5cad0a641871f935fd;hp=bb8710aad489bf67e6f0d4a61218e908d9c8619d;hpb=1b034abe396022ad4cd6a4e5d275d7b780194bfd;p=rustc.git diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs index bb8710aad4..2e8ddb0806 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -8,8 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. + + +use std::cell::Cell; + +#[derive(Copy, Clone)] enum newtype { - newtype(int) + newvar(isize) } pub fn main() { @@ -17,12 +22,12 @@ pub fn main() { // Test that borrowck treats enums with a single variant // specially. - let x = @mut 5; - let y = @mut newtype(3); - let z = match *y { - newtype(b) => { - *x += 1; - *x * b + let x = &Cell::new(5); + let y = &Cell::new(newtype::newvar(3)); + let z = match y.get() { + newtype::newvar(b) => { + x.set(x.get() + 1); + x.get() * b } }; assert_eq!(z, 18);