title: How do you actually use dynamically sized types in Rust?
body: <p>In theory, Dynamically-Sized Types (DST) have landed and we should now be able to use dynamically sized type instances. Practically speaking, I can neither make it work, nor understand the tests around it.</p>
  
  <p>Everything seems to revolve around the <code>Sized?</code> keyword... but how exactly do you use it?</p>
  
  <p>I can put some types together:</p>
  
  <pre><code>// Note that this code example predates Rust 1.0
  // and is no longer syntactically valid
  
  trait Foo for Sized? {
      fn foo(&amp;self) -&gt; u32;
  }
  
  struct Bar;
  struct Bar2;
  
  impl Foo for Bar { fn foo(&amp;self) -&gt; u32 { return 9u32; }}
  impl Foo for Bar2 { fn foo(&amp;self) -&gt; u32 { return 10u32; }}
  
  struct HasFoo&lt;Sized? X&gt; {
      pub f:X
  }
  </code></pre>
  
  <p>...but how do I create an instance of <code>HasFoo</code>, which is DST, to have either a <code>Bar</code> or <code>Bar2</code>?</p>
  
  <p>Attempting to do so always seems to result in:</p>
  
  <pre class="lang-none prettyprint-override"><code>&lt;anon&gt;:28:17: 30:4 error: trying to initialise a dynamically sized struct
  &lt;anon&gt;:28   let has_foo = &amp;HasFoo {
  </code></pre>
  
  <p>I understand broadly speaking that you can't have a bare dynamically sized type; you can only interface with one through a pointer, but I can't figure out how to do that.</p>