]> git.lizzy.rs Git - rust.git/blob - tests/ui/cstring.stderr
Merge pull request #2119 from camsteffen/never_loop
[rust.git] / tests / ui / cstring.stderr
1 error: function is never used: `temporary_cstring`
2  --> $DIR/cstring.rs:4:1
3   |
4 4 | fn temporary_cstring() {
5   | ^^^^^^^^^^^^^^^^^^^^^^
6   |
7   = note: `-D dead-code` implied by `-D warnings`
8
9 error: you are getting the inner pointer of a temporary `CString`
10  --> $DIR/cstring.rs:7:5
11   |
12 7 |     CString::new("foo").unwrap().as_ptr();
13   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14   |
15   = note: `-D temporary-cstring-as-ptr` implied by `-D warnings`
16   = note: that pointer will be invalid outside this expression
17 help: assign the `CString` to a variable to extend its lifetime
18  --> $DIR/cstring.rs:7:5
19   |
20 7 |     CString::new("foo").unwrap().as_ptr();
21   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22