diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-05-01 08:49:48 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-05-01 08:49:48 -0400 |
| commit | 5ab33a297521c2d5885422bc1744f6d9dab8f3f7 (patch) | |
| tree | 7cfc8d31f53e598e33747835b17e81b19244e3c4 /src/test | |
| parent | f236b850c0dc4c1b925e33d1173f359605801307 (diff) | |
correct incorrect handling of overloaded operators, exposing various other bits of rot
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/borrowck-loan-in-overloaded-op.rs | 10 | ||||
| -rw-r--r-- | src/test/run-pass/auto-ref-slice-plus-ref.rs | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs index 482d1b6b8b6..0361213af22 100644 --- a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs @@ -8,18 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test #3387 - struct foo(~uint); impl Add<foo, foo> for foo { - fn add(f: &foo) -> foo { - foo(~(**self + **(*f))) + fn add(&self, f: &foo) -> foo { + foo(~(***self + **(*f))) } } fn main() { let x = foo(~3); - let _y = x + x; - //~^ ERROR moving out of immutable local variable prohibited due to outstanding loan + let _y = x + {x}; // the `{x}` forces a move to occur + //~^ ERROR cannot move out of `x` } diff --git a/src/test/run-pass/auto-ref-slice-plus-ref.rs b/src/test/run-pass/auto-ref-slice-plus-ref.rs index 1dc56132875..07629651e56 100644 --- a/src/test/run-pass/auto-ref-slice-plus-ref.rs +++ b/src/test/run-pass/auto-ref-slice-plus-ref.rs @@ -17,13 +17,13 @@ trait MyIter { } impl<'self> MyIter for &'self [int] { - fn test_imm(&self) { assert!(self[0] == 1) } - fn test_const(&const self) { assert!(self[0] == 1) } + fn test_imm(&self) { assert_eq!(self[0], 1) } + fn test_const(&const self) { assert_eq!(self[0], 1) } } impl<'self> MyIter for &'self str { - fn test_imm(&self) { assert!(*self == "test") } - fn test_const(&const self) { assert!(*self == "test") } + fn test_imm(&self) { assert_eq!(*self, "test") } + fn test_const(&const self) { assert_eq!(self[0], 't') } } pub fn main() { |
