]> git.lizzy.rs Git - rust.git/blob - tests/ui/cstring.stderr
Fix lint_cstring_as_ptr for expect
[rust.git] / tests / ui / cstring.stderr
1 error: you are getting the inner pointer of a temporary `CString`
2   --> $DIR/cstring.rs:7:5
3    |
4 LL |     CString::new("foo").unwrap().as_ptr();
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `#[deny(clippy::temporary_cstring_as_ptr)]` on by default
8    = note: that pointer will be invalid outside this expression
9 help: assign the `CString` to a variable to extend its lifetime
10   --> $DIR/cstring.rs:7:5
11    |
12 LL |     CString::new("foo").unwrap().as_ptr();
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
15 error: you are getting the inner pointer of a temporary `CString`
16   --> $DIR/cstring.rs:8:5
17    |
18 LL |     CString::new("foo").expect("dummy").as_ptr();
19    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20    |
21    = note: that pointer will be invalid outside this expression
22 help: assign the `CString` to a variable to extend its lifetime
23   --> $DIR/cstring.rs:8:5
24    |
25 LL |     CString::new("foo").expect("dummy").as_ptr();
26    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
28 error: aborting due to 2 previous errors
29