]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/cstring.stderr
Auto merge of #71751 - oli-obk:const_ice, r=RalfJung
[rust.git] / src / tools / clippy / tests / ui / cstring.stderr
1 error: you are getting the inner pointer of a temporary `CString`
2   --> $DIR/cstring.rs:8:5
3    |
4 LL |     CString::new("foo").unwrap().as_ptr();
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7 note: the lint level is defined here
8   --> $DIR/cstring.rs:1:9
9    |
10 LL | #![deny(clippy::temporary_cstring_as_ptr)]
11    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12    = note: that pointer will be invalid outside this expression
13 help: assign the `CString` to a variable to extend its lifetime
14   --> $DIR/cstring.rs:8:5
15    |
16 LL |     CString::new("foo").unwrap().as_ptr();
17    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18
19 error: you are getting the inner pointer of a temporary `CString`
20   --> $DIR/cstring.rs:9:5
21    |
22 LL |     CString::new("foo").expect("dummy").as_ptr();
23    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24    |
25    = note: that pointer will be invalid outside this expression
26 help: assign the `CString` to a variable to extend its lifetime
27   --> $DIR/cstring.rs:9:5
28    |
29 LL |     CString::new("foo").expect("dummy").as_ptr();
30    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31
32 error: you are getting the inner pointer of a temporary `CString`
33   --> $DIR/cstring.rs:22:22
34    |
35 LL |         unsafe { foo(cstr.unwrap().as_ptr()) }
36    |                      ^^^^^^^^^^^^^^^^^^^^^^
37    |
38    = note: that pointer will be invalid outside this expression
39 help: assign the `CString` to a variable to extend its lifetime
40   --> $DIR/cstring.rs:22:22
41    |
42 LL |         unsafe { foo(cstr.unwrap().as_ptr()) }
43    |                      ^^^^^^^^^^^^^
44
45 error: aborting due to 3 previous errors
46