Skip to content

Commit 3627e43

Browse files
committed
Add a test for the fix to issue #43058
Followed the instructions laid out here #43058 (comment)
1 parent c75d5e2 commit 3627e43

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/test/ui/nll/issue-43058.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(nll)]
2+
3+
use std::borrow::Cow;
4+
5+
#[derive(Clone, Debug)]
6+
struct S<'a> {
7+
name: Cow<'a, str>
8+
}
9+
10+
#[derive(Clone, Debug)]
11+
struct T<'a> {
12+
s: Cow<'a, [S<'a>]>
13+
}
14+
15+
fn main() {
16+
let s1 = [S { name: Cow::Borrowed("Test1") }, S { name: Cow::Borrowed("Test2") }];
17+
let b1 = T { s: Cow::Borrowed(&s1) };
18+
let s2 = [S { name: Cow::Borrowed("Test3") }, S { name: Cow::Borrowed("Test4") }];
19+
let b2 = T { s: Cow::Borrowed(&s2) };
20+
21+
let mut v = Vec::new();
22+
v.push(b1);
23+
v.push(b2);
24+
25+
println!("{:?}", v);
26+
}

0 commit comments

Comments
 (0)