1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-11-24 17:06:37 +02:00

Fix “incorrect” which should have been “unsafe” (#2419)

This commit is contained in:
Martin Geisler 2024-10-16 11:34:53 +02:00 committed by GitHub
parent 701589ffd5
commit 0c824ab740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,8 +79,8 @@ fn main() {
## Calling Unsafe Functions ## Calling Unsafe Functions
`get_unchecked`, like most `_unchecked` functions, is unsafe, because it can `get_unchecked`, like most `_unchecked` functions, is unsafe, because it can
create UB if the range is incorrect. `abs` is incorrect for a different reason: create UB if the range is incorrect. `abs` is unsafe for a different reason: it
it is an external function (FFI). Calling external functions is usually only a is an external function (FFI). Calling external functions is usually only a
problem when those functions do things with pointers which might violate Rust's problem when those functions do things with pointers which might violate Rust's
memory model, but in general any C function might have undefined behaviour under memory model, but in general any C function might have undefined behaviour under
any arbitrary circumstances. any arbitrary circumstances.