blob: cf4cb3dbe7aaf4f872cb2e22fe8f60ba25f5c95a (
plain)
1
2
3
4
5
6
7
8
9
|
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
let raw_lines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
raw_lines.iter().map(|l| l.trim()).collect()
//~^ ERROR cannot return value referencing local variable `raw_lines`
}
fn main() {
println!("{:?}", read_lines_borrowed());
}
|