Closed as not planned
Closed as not planned
Description
The following compiles with rustc 1.7.0 and earlier, but not in 1.8.0 and later:
use std::borrow::Cow;
#[derive(Clone)]
pub struct Node {
// ...
pub children_a: &'static [Node], // Works
pub children_b: Vec<Node>, // Works
pub children_c: Cow<'static, [Node]> // Doesn't compile
}
The errors:
error[E0275]: overflow evaluating the requirement `<[Node] as std::borrow::ToOwned>::Owned`
--> src/lib.rs:6:2
|
6 | pub children_a: &'static [Node],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: required because it appears within the type `Node`
= note: required because of the requirements on the impl of `std::borrow::ToOwned` for `[Node]`
= note: required because it appears within the type `Node`
= note: slice and array elements must have `Sized` type
Since it compiles fine with the first two members (reference to slice, and Vec), I'd expect a Cow of a slice to also work. Is this a regression, or is this supposed to not compile?