When to pass in self vs. &self in Rust?

60 points lancejpollard

I see mostly &self as in:

fn clone(&self) -> Self {
    let alloc = self.allocator().clone();
    <[T]>::to_vec_in(&**self, alloc)
}

But I also occasionally see self with no & ampersand.

pub fn leak<'a>(self) -> &'a mut [T]
where
    A: 'a,
{
    let mut me = ManuallyDrop::new(self);
    unsafe { slice::from_raw_parts_mut(me.as_mut_ptr(), me.len) }
}

I am fairly familiar with references and borrowing (the &), as well as mutable versions. But does the "without &" version mean a move, where it passes self and the function it calls takes ownership of the self? If that is the case, does the the function simply return the self, or consume it (and get rid of it) basically? Is that what's happening?

I am fairly new to Rust, trying to understand it enough to use it as a compiler target, but haven't had much other experience with it yet.