Files
rust/tests/ui/lifetimes/return-reference-local-variable-13497.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
358 B
Rust
Raw Normal View History

2025-07-24 17:52:22 +05:00
//! Regression test for https://github.com/rust-lang/rust/issues/13497
2014-10-02 21:52:06 +02:00
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
rawLines //~ ERROR cannot return value referencing local variable `rawLines`
2025-07-24 17:52:22 +05:00
.iter()
.map(|l| l.trim())
.collect()
2014-10-02 21:52:06 +02:00
}
fn main() {}