Skip to content

Commit 7304220

Browse files
committed
remove the memcpy-on-equal-ptrs assumption
1 parent 42ae1a7 commit 7304220

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/core/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
//! which are generated by Rust codegen backends. Additionally, this library can make explicit
2525
//! calls to `strlen`. Their signatures are the same as found in C, but there are extra
2626
//! assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if
27-
//! the `n` parameter is 0, the function is assumed to not be UB. Furthermore, for `memcpy`, if
28-
//! source and target pointer are equal, the function is assumed to not be UB.
29-
//! (Note that these are standard assumptions among compilers:
27+
//! the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or
28+
//! dangling. (Note that making extra assumptions about these functions is common among compilers:
3029
//! [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)
3130
//! These functions are often provided by the system libc, but can also be provided by the
3231
//! [compiler-builtins crate](https://crates.io/crates/compiler_builtins).

0 commit comments

Comments
 (0)