Because the compiler automatically dereference the chain of references you can mentally think that it insert as many * as necessary to get the right type:
foo(&&&f)
is converted to:
foo(*&*&*&f)
that leads to the right invocation:
foo(f)
The insertions of as many *
as needed is actually performed by this blanket implementation of Deref
trait:
impl<'a, T: ?Sized> Deref for &'a T {
type Target = T;
fn deref(&self) -> &T { *self }
}
Note: I've update my answer because in the original I used the term autoderef
in the wrong way, see this post for details.