diff options
| author | Ralf Jung <post@ralfj.de> | 2023-11-24 21:23:45 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-11-24 21:32:16 +0100 |
| commit | 73042206ddfd2686eae6c9e186ef77ba2c08ddb5 (patch) | |
| tree | 28df28ed221fd9b2204e96a5716d4a7730aa9079 | |
| parent | 42ae1a76154289ccc972deeb43318b164f01539e (diff) | |
| download | rust-73042206ddfd2686eae6c9e186ef77ba2c08ddb5.tar.gz rust-73042206ddfd2686eae6c9e186ef77ba2c08ddb5.zip | |
remove the memcpy-on-equal-ptrs assumption
| -rw-r--r-- | library/core/src/lib.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index d44cf299c27..cc094f64327 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -24,9 +24,8 @@ //! which are generated by Rust codegen backends. Additionally, this library can make explicit //! calls to `strlen`. Their signatures are the same as found in C, but there are extra //! assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if -//! the `n` parameter is 0, the function is assumed to not be UB. Furthermore, for `memcpy`, if -//! source and target pointer are equal, the function is assumed to not be UB. -//! (Note that these are standard assumptions among compilers: +//! the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or +//! dangling. (Note that making extra assumptions about these functions is common among compilers: //! [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.) //! These functions are often provided by the system libc, but can also be provided by the //! [compiler-builtins crate](https://crates.io/crates/compiler_builtins). |
