title: What types are valid for the `self` parameter of a method?
body: <p>I wanted to create a method that only works where the <code>self</code> parameter was an <code>Rc</code>. I saw that I could use <code>Box</code>, so I thought I might try to mimic how that works:</p>
  
  <pre><code>use std::rc::Rc;
  use std::sync::Arc;
  
  struct Bar;
  
  impl Bar {
      fn consuming(self) {}
      fn reference(&amp;self) {}
      fn mutable_reference(&amp;mut self) {}
      fn boxed(self: Box&lt;Bar&gt;) {}
      fn ref_count(self: Rc&lt;Bar&gt;) {}
      fn atomic_ref_count(self: Arc&lt;Bar&gt;) {}
  }
  
  fn main() {}
  </code></pre>
  
  <p>Yields these errors:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0308]: mismatched method receiver
    --&gt; a.rs:11:18
     |
  11 |     fn ref_count(self: Rc&lt;Bar&gt;) {}
     |                  ^^^^ expected struct `Bar`, found struct `std::rc::Rc`
     |
     = note: expected type `Bar`
     = note:    found type `std::rc::Rc&lt;Bar&gt;`
  
  error[E0308]: mismatched method receiver
    --&gt; a.rs:12:25
     |
  12 |     fn atomic_ref_count(self: Arc&lt;Bar&gt;) {}
     |                         ^^^^ expected struct `Bar`, found struct `std::sync::Arc`
     |
     = note: expected type `Bar`
     = note:    found type `std::sync::Arc&lt;Bar&gt;`
  </code></pre>
  
  <p>This is with Rust 1.15.1.</p>