2012-12-11 01:32:48 +00:00
|
|
|
// 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.
|
|
|
|
|
2012-10-31 22:09:26 +00:00
|
|
|
trait Foo {
|
2013-02-08 03:33:12 +00:00
|
|
|
fn f(&self);
|
2012-10-31 22:09:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Bar {
|
|
|
|
x: int,
|
2012-11-14 06:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Bar : Drop {
|
2012-11-28 23:42:16 +00:00
|
|
|
fn finalize(&self) {}
|
2012-10-31 22:09:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Bar : Foo {
|
2013-02-08 03:33:12 +00:00
|
|
|
fn f(&self) {
|
2012-10-31 22:09:26 +00:00
|
|
|
io::println("hi");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = ~Bar { x: 10 };
|
2013-02-08 03:33:12 +00:00
|
|
|
let y: ~Foo = x as ~Foo;
|
|
|
|
let _z = copy y; //~ ERROR copying a value of non-copyable type
|
2012-10-31 22:09:26 +00:00
|
|
|
}
|
|
|
|
|