]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/traits/trait-safety-ok-cc.rs
2 // aux-build:trait_safety_lib.rs
4 // Simple smoke test that unsafe traits can be compiled across crates.
7 extern crate trait_safety_lib
as lib
;
11 struct Bar { x: isize }
12 unsafe impl Foo
for Bar
{
13 fn foo(&self) -> isize { self.x }
16 fn take_foo
<F
:Foo
>(f
: &F
) -> isize { f.foo() }
20 assert_eq
!(22, take_foo(&x
));
22 let x
: Bar
= Bar { x: 23 }
;
23 assert_eq
!(23, take_foo(&x
));