Skip to content

Commit dfee1ba

Browse files
committed
document our assumptions about symbols provided by the libc
1 parent a922d1c commit dfee1ba

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: library/core/src/lib.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
// FIXME: Fill me in with more detail when the interface settles
2121
//! This library is built on the assumption of a few existing symbols:
2222
//!
23-
//! * `memcpy`, `memcmp`, `memset`, `strlen` - These are core memory routines which are
24-
//! often generated by LLVM. Additionally, this library can make explicit
25-
//! calls to these functions. Their signatures are the same as found in C.
26-
//! These functions are often provided by the system libc, but can also be
27-
//! provided by the [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
23+
//! * `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines
24+
//! which are generated by Rust codegen backends. Additionally, this library can make explicit
25+
//! calls to `strlen`. Their signatures are the same as found in C, but there are extra
26+
//! 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](https://reviews.llvm.org/D86993) among compilers.)
30+
//! These functions are often provided by the system libc, but can also be provided by the
31+
//! [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
2832
//!
2933
//! * `rust_begin_panic` - This function takes four arguments, a
3034
//! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments

0 commit comments

Comments
 (0)