Add a test for the fix to issue #43058

Followed the instructions laid out here https://github.com/rust-lang/rust/issues/43058#issuecomment-378389971
This commit is contained in:
lloydmeta 2018-04-04 10:25:37 +09:00
parent c75d5e242f
commit 3627e43dc4
No known key found for this signature in database
GPG Key ID: C3DAB4BD5AADD60D

View File

@ -0,0 +1,26 @@
#![feature(nll)]
use std::borrow::Cow;
#[derive(Clone, Debug)]
struct S<'a> {
name: Cow<'a, str>
}
#[derive(Clone, Debug)]
struct T<'a> {
s: Cow<'a, [S<'a>]>
}
fn main() {
let s1 = [S { name: Cow::Borrowed("Test1") }, S { name: Cow::Borrowed("Test2") }];
let b1 = T { s: Cow::Borrowed(&s1) };
let s2 = [S { name: Cow::Borrowed("Test3") }, S { name: Cow::Borrowed("Test4") }];
let b2 = T { s: Cow::Borrowed(&s2) };
let mut v = Vec::new();
v.push(b1);
v.push(b2);
println!("{:?}", v);
}