fn main() {
let x = "".as_slice();
}
test5.rs:2:13: 2:15 error: borrowed value does not live long enough
test5.rs:2 let x = "".as_slice();
^~
test5.rs:1:11: 3:2 note: reference must be valid for the block at 1:10...
test5.rs:1 fn main() {
test5.rs:2 let x = "".as_slice();
test5.rs:3 }
test5.rs:2:5: 2:26 note: ...but borrowed value is only valid for the statement at 2:4
test5.rs:2 let x = "".as_slice();
^~~~~~~~~~~~~~~~~~~~~
test5.rs:2:5: 2:26 help: consider using a `let` binding to increase its lifetime
test5.rs:2 let x = "".as_slice();
^~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Similarly you can't pass an array literal to BufReader.
Similarly you can't pass an array literal to BufReader.