mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 13:13:40 +00:00
17 lines
291 B
Rust
17 lines
291 B
Rust
// 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");
|
|
}
|