'What is the relation between auto-dereferencing and deref coercion?

After some discussion, I'm now a little bit confused about the relation between auto-dereferencing and deref coercion.

It seems that the term "auto-dereferencing" applies only when the target to dereference is a method receiver, whereas it seems that the term "deref coercion" applies to function arguments and all contexts it needs to.

I thought that a dereference does not always involve deref coercion, but I'm not sure: does dereferencing always use some Deref::deref trait implementation?

If so, is the implementor of T: Deref<Target = U> where T: &U built into the compiler?

Finally, it sounds natural to use the term "autoderef" in all the cases where the compiler implicitly transforms &&&&x to &x:

pub fn foo(_v: &str) -> bool {
    false
}

let x="hello world";
foo(&&&&x);

Is this the general consensus of the community?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source