Skip to content

Commit

Permalink
Add a test for the fix to issue #43058
Browse files Browse the repository at this point in the history
Followed the instructions laid out here #43058 (comment)
  • Loading branch information
lloydmeta committed Apr 4, 2018
1 parent c75d5e2 commit 3627e43
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/ui/nll/issue-43058.rs
@@ -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);
}

0 comments on commit 3627e43

Please sign in to comment.