diff options
Diffstat (limited to 'src/test/compile-fail/tps-invariant-trait.rs')
| -rw-r--r-- | src/test/compile-fail/tps-invariant-trait.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/test/compile-fail/tps-invariant-trait.rs b/src/test/compile-fail/tps-invariant-trait.rs deleted file mode 100644 index 127aa23d6ab..00000000000 --- a/src/test/compile-fail/tps-invariant-trait.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait box_trait<T> { - fn get(&self) -> T; - fn set(&self, t: T); -} - -struct box<T> { - f: T -} - -struct box_impl<T>(box<T>); - -impl<T:Copy> box_trait<T> for box_impl<T> { - fn get(&self) -> T { return self.f; } - fn set(&self, t: T) { self.f = t; } -} - -fn set_box_trait<T>(b: @box_trait<@const T>, v: @const T) { - b.set(v); -} - -fn set_box_impl<T>(b: box_impl<@const T>, v: @const T) { - b.set(v); -} - -fn main() { - let b = box_impl::<@int>(box::<@int> {f: @3}); - set_box_trait(@b as @box_trait<@int>, @mut 5); - //~^ ERROR values differ in mutability - set_box_impl(b, @mut 5); - //~^ ERROR values differ in mutability -} |
