-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-type-systemArea: Type systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
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.
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.