title: Why the [u8] inside Box<[u8]> does not implement AsRef<[u8]> + AsMut<[u8]>?
body: <p>The code below creates a <code>Box&lt;[u8]&gt;</code>, which I though had a fixed size, because <code>Box</code> has a fixed size. Also, I though <code>[u8]</code> implemented <code>AsRef&lt;[u8]&gt; + AsMut&lt;[u8]&gt;</code></p>
  <pre><code>pub trait MemAs&lt;T&gt;: AsMut&lt;[T]&gt; + AsRef&lt;[T]&gt; {}
  fn allocate(size: usize) -&gt; Box&lt;dyn MemAs&lt;u8&gt;&gt; {
      vec![0; size].into_boxed_slice()
  }
  </code></pre>
  <p>Errors:</p>
  <pre><code>error[E0277]: the trait bound `[{integer}]: MemAs&lt;u8&gt;` is not satisfied
   --&gt; src/lib.rs:3:5
    |
  3 |     vec![0; size].into_boxed_slice()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MemAs&lt;u8&gt;` is not implemented for `[{integer}]`
    |
    = note: required for the cast to the object type `dyn MemAs&lt;u8&gt;`
  
  error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
   --&gt; src/lib.rs:3:5
    |
  3 |     vec![0; size].into_boxed_slice()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `Sized` is not implemented for `[{integer}]`
    = note: required for the cast to the object type `dyn MemAs&lt;u8&gt;`
  </code></pre>
  <p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=a348e149773b8145284fac308666b220" rel="nofollow noreferrer">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=a348e149773b8145284fac308666b220</a></p>
  <p>What is wrong?</p>