carols10cents / carols10cents/rust-conversion-reference

&[T] to Box<[T]> does not work

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
40
Forks
7
PR merge metrics
No merged PRs in 30d

Description

```rust
fn f(x: &[T]) {
let _: Box<[T]> = Box::new(*x);
}
```

```
error[E0277]: the trait bound `[T]: std::marker::Sized` is not satisfied
--> src/main.rs:2:23
|
2 | let _: Box<[T]> = Box::new(*x);
| ^^^^^^^^ the trait `std::marker::Sized` is not implemented for `[T]`
|
= note: `[T]` does not have a constant size known at compile-time
= note: required by `>::new`
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.