mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
47 lines
2.0 KiB
Plaintext
47 lines
2.0 KiB
Plaintext
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:12:15
|
|
|
|
|
LL | let len = unsafe { libc::strlen(cstring.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstring.as_bytes().len()`
|
|
|
|
|
= note: `-D clippy::strlen-on-c-strings` implied by `-D warnings`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:16:15
|
|
|
|
|
LL | let len = unsafe { libc::strlen(cstr.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstr.to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:18:15
|
|
|
|
|
LL | let len = unsafe { strlen(cstr.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `cstr.to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:21:24
|
|
|
|
|
LL | let len = unsafe { strlen((*pcstr).as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `(*pcstr).to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:26:24
|
|
|
|
|
LL | let len = unsafe { strlen(unsafe_identity(cstr).as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unsafe_identity(cstr).to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:27:15
|
|
|
|
|
LL | let len = unsafe { strlen(unsafe { unsafe_identity(cstr) }.as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unsafe { unsafe_identity(cstr) }.to_bytes().len()`
|
|
|
|
error: using `libc::strlen` on a `CString` or `CStr` value
|
|
--> $DIR/strlen_on_c_strings.rs:30:24
|
|
|
|
|
LL | let len = unsafe { strlen(f(cstr).as_ptr()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `f(cstr).to_bytes().len()`
|
|
|
|
error: aborting due to 7 previous errors
|
|
|