about summary refs log tree commit diff
path: root/tests/ui/lifetimes/struct-with-lifetime-parameters-9259.rs
blob: 7e39fdc3f10b53207cff7f36399b23805f9eaf92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// https://github.com/rust-lang/rust/issues/9259
//@ run-pass
#![allow(dead_code)]

struct A<'a> {
    a: &'a [String],
    b: Option<&'a [String]>,
}

pub fn main() {
    let b: &[String] = &["foo".to_string()];
    let a = A {
        a: &["test".to_string()],
        b: Some(b),
    };
    assert_eq!(a.b.as_ref().unwrap()[0], "foo");
}