-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.