Calling a function with a &&

The following code all works just fine

fn test(n: &isize) -> isize {
    *n
}

fn main() {
    let a = 3;
    println!("{}", test(&a));
    println!("{}", test(&&a));
    println!("{}", test(&&&a));
}
'''
Where can I find the documentation of this feature, and how do you call it?

Google: Deref coercion.

OK, but does it mean then that the Deref trait is implemented for &isize?

Yes, see here and here.

2 Likes

Yes, because it is in general implemented for &T for all possible referent types T, including isize.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.