blob: d456a78b64dcbe69c4124857513900bee52d0188 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// run-pass
// Simple smoke test that unsafe traits can be compiled etc.
unsafe trait Foo {
fn foo(&self) -> isize;
}
unsafe impl Foo for isize {
fn foo(&self) -> isize { *self }
}
fn take_foo<F:Foo>(f: &F) -> isize { f.foo() }
fn main() {
let x: isize = 22;
assert_eq!(22, take_foo(&x));
}
|