]> git.lizzy.rs Git - rust.git/blob - tests/ui/strlen_on_c_strings.stderr
Merge remote-tracking branch 'upstream/master' into rustup
[rust.git] / tests / ui / strlen_on_c_strings.stderr
1 error: using `libc::strlen` on a `CString` or `CStr` value
2   --> $DIR/strlen_on_c_strings.rs:11:24
3    |
4 LL |     let len = unsafe { libc::strlen(cstring.as_ptr()) };
5    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::strlen-on-c-strings` implied by `-D warnings`
8 help: try this (you might also need to get rid of `unsafe` block in some cases):
9    |
10 LL |     let len = unsafe { cstring.as_bytes().len() };
11    |                        ^^^^^^^^^^^^^^^^^^^^^^^^
12
13 error: using `libc::strlen` on a `CString` or `CStr` value
14   --> $DIR/strlen_on_c_strings.rs:15:24
15    |
16 LL |     let len = unsafe { libc::strlen(cstr.as_ptr()) };
17    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    |
19 help: try this (you might also need to get rid of `unsafe` block in some cases):
20    |
21 LL |     let len = unsafe { cstr.to_bytes().len() };
22    |                        ^^^^^^^^^^^^^^^^^^^^^
23
24 error: aborting due to 2 previous errors
25