title: Is it possible to use Box with no_std?
body: <p>I'd like to use <code>Box</code> in a crate with <code>no_std</code>. Is this possible? My simple attempts so far have not worked.</p>
  
  <p>This compiles (but uses the standard library):</p>
  
  <pre><code>fn main() {
      let _: Box&lt;[u8]&gt; = Box::new([0; 10]);
  }
  </code></pre>
  
  <p>This does not:</p>
  
  <pre><code>#![no_std]
  
  fn main() {
      let _: Box&lt;[u8]&gt; = Box::new([0; 10]);
  }
  </code></pre>
  
  <p>(<a href="https://play.rust-lang.org/?code=%23!%5Bno_std%5D%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20_%3A%20Box%3C%5Bu8%5D%3E%20%3D%20Box%3A%3Anew(%5B0%3B%2010%5D)%3B%0A%7D%0A&amp;version=nightly&amp;backtrace=0" rel="noreferrer">Playground</a>)</p>
  
  <p>However, looking through the Rust source code, I see <code>Box</code> is defined in liballoc with the warning</p>
  
  <blockquote>
    <p>This library, like libcore, is not intended for general usage, but rather as a building block of other libraries. The types and interfaces in this library are reexported through the standard library, and should not be used through this library.</p>
  </blockquote>
  
  <p>Since <code>Box</code> doesn't depend on std but is only reexported for it, it seems like I only need to figure out the right way to import it into my code. (Despite this seeming to be not recommended.)</p>