title: Sending Vec<Box<Trait>> over channel
body: <p>I'm trying to send <code>Vec&lt;Box&lt;Trait&gt;&gt;</code> over a channel. The sending part sort of works, I guess. After <code>recv()</code>ing the <code>Vec</code> I'm trying to iterate over it and pass the inner value's reference to a function, which fails with an error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0277]: the trait bound `&amp;std::boxed::Box&lt;AwesomeTrait + std::marker::Send&gt;: AwesomeTrait` is not satisfied
    --&gt; src/main.rs:12:13
     |
  12 |             K::abc(&amp;something);
     |             ^^^^^^ the trait `AwesomeTrait` is not implemented for `&amp;std::boxed::Box&lt;AwesomeTrait + std::marker::Send&gt;`
     |
  note: required by `K::abc`
    --&gt; src/main.rs:57:5
     |
  57 |     pub fn abc&lt;T: AwesomeTrait&gt;(something: &amp;T) {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  </code></pre>
  
  <p>Is there a way to get the inner value out of the <code>Box</code> somehow?</p>
  
  <p><a href="http://play.rust-lang.org/?gist=280d2ff379ec84d0f0c685bb90641d13&amp;version=stable&amp;mode=debug" rel="nofollow noreferrer">Here's a minimal reproduction.</a>:</p>
  
  <pre><code>use std::sync::mpsc;
  use std::thread;
  
  fn main() {
      let (tx, rx) = mpsc::channel::&lt;Request&gt;();
      let s = Something::new();
      tx.send(Request::Do(s)).unwrap();
  
      let z = thread::spawn(move || match rx.recv().unwrap() {
          Request::Do(somethings) =&gt; for something in somethings.list.iter() {
              K::abc(&amp;something);
          },
      });
  
      z.join();
  }
  
  pub enum Request {
      Do(Something),
  }
  
  pub struct Something {
      list: Vec&lt;Box&lt;AwesomeTrait + Send&gt;&gt;,
  }
  
  impl Something {
      pub fn new() -&gt; Self {
          Self { list: Vec::new() }
      }
  
      pub fn from&lt;T: AwesomeTrait + Send + 'static&gt;(something: T) -&gt; Self {
          let mut list = Vec::with_capacity(1);
          list.push(Box::new(something));
          // Self { list }
          Self { list: Vec::new() }
      }
  
      pub fn push&lt;T: AwesomeTrait + Send + 'static&gt;(&amp;mut self, something: T) {
          self.list.push(Box::new(something));
      }
  }
  
  pub trait AwesomeTrait {
      fn func(&amp;self);
  }
  
  pub struct X {}
  
  impl AwesomeTrait for X {
      fn func(&amp;self) {}
  }
  
  pub struct K {}
  
  impl K {
      pub fn abc&lt;T: AwesomeTrait&gt;(something: &amp;T) {
          &amp;something.func();
      }
  }
  </code></pre>