Closed
Description
fn read_lines_borrowed() -> ~[&str] {
let rawLines: ~[~str] = ~[~"foo ", ~" bar"];
rawLines.iter().map(|l| l.trim()).collect()
}
fn main() {
println!("{}", read_lines_borrowed());
}
read_lines_borrowed is not rejected. but the value it returns cannot possibly be valid, since rawLines is going to be free'd after it returns, leaving the collected references dangling.