diff options
Diffstat (limited to 'src/test/ui/borrowck/borrowck-rvalues-mutable.rs')
-rw-r--r-- | src/test/ui/borrowck/borrowck-rvalues-mutable.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/test/ui/borrowck/borrowck-rvalues-mutable.rs b/src/test/ui/borrowck/borrowck-rvalues-mutable.rs deleted file mode 100644 index c4695c942..000000000 --- a/src/test/ui/borrowck/borrowck-rvalues-mutable.rs +++ /dev/null @@ -1,34 +0,0 @@ -// run-pass - -struct Counter { - value: usize -} - -impl Counter { - fn new(v: usize) -> Counter { - Counter {value: v} - } - - fn inc<'a>(&'a mut self) -> &'a mut Counter { - self.value += 1; - self - } - - fn get(&self) -> usize { - self.value - } - - fn get_and_inc(&mut self) -> usize { - let v = self.value; - self.value += 1; - v - } -} - -pub fn main() { - let v = Counter::new(22).get_and_inc(); - assert_eq!(v, 22); - - let v = Counter::new(22).inc().inc().get(); - assert_eq!(v, 24); -} |