diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/strlen_on_c_strings.stderr | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/strlen_on_c_strings.stderr')
-rw-r--r-- | src/tools/clippy/tests/ui/strlen_on_c_strings.stderr | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr b/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr new file mode 100644 index 000000000..296268a5f --- /dev/null +++ b/src/tools/clippy/tests/ui/strlen_on_c_strings.stderr @@ -0,0 +1,46 @@ +error: using `libc::strlen` on a `CString` or `CStr` value + --> $DIR/strlen_on_c_strings.rs:15:13 + | +LL | let _ = 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:19:13 + | +LL | let _ = 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:21:13 + | +LL | let _ = 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:24:22 + | +LL | let _ = 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:29:22 + | +LL | let _ = 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:30:13 + | +LL | let _ = 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:33:22 + | +LL | let _ = unsafe { strlen(f(cstr).as_ptr()) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `f(cstr).to_bytes().len()` + +error: aborting due to 7 previous errors + |