I am trying to capture the reference to type `~int` with the following
code. I can change it to apply to bare `int` and it works fine.

#[lang="deref"]
pub trait Deref<Result> {
    fn deref<'a>(&'a self) -> &'a Result;
}

impl Deref<~int> for ~int {
    fn deref<'a>(&'a self) -> &'a ~int {
        println!("deref caught");
        self
    }
}

fn main() {
  let x: ~int = 3;
  *x
}

Thanks,
Noah
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to