mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
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:
parent
c75d5e242f
commit
3627e43dc4
26
src/test/ui/nll/issue-43058.rs
Normal file
26
src/test/ui/nll/issue-43058.rs
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user