Hi,
I tried to use core::managed::ptr_eq for boxed traits but it compile-fails
with a mismatched type error.
Here's a code example that reproduces my problem :
use core::ToStr;
fn main() {
let a = @S;
foo::<ToStr>(a as @ToStr);
}
struct S;
impl S for ToStr { fn to-str(&self) -> ~str {~""} }
fn foo<T>(value: @T) {} // similar to ptr_eq
with the error message :
test.rs:5:15: 5:26 error: mismatched types: expected `@core::to_str::ToStr`
but found `@core::to_str::ToStr` (expected @-ptr but found trait
core::to_str::ToStr)
test.rs:5 test::<ToStr>(a as @ToStr);
The issue is the same with owned boxes. Is it the intended behavior ? in
this case, is there any workaround ?
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev