File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -388,11 +388,15 @@ mod enum_keyword {}
388388/// lazy_static;`. The other use is in foreign function interfaces (FFI).
389389///
390390/// `extern` is used in two different contexts within FFI. The first is in the form of external
391- /// blocks, for declaring function interfaces that Rust code can call foreign code by.
391+ /// blocks, for declaring function interfaces that Rust code can call foreign code by. This use
392+ /// of `extern` is unsafe, since we are asserting to the compiler that all function declarations
393+ /// are correct. If they are not, using these items may lead to undefined behavior.
392394///
393395/// ```rust ignore
396+ /// // SAFETY: The function declarations given below are in
397+ /// // line with the header files of `my_c_library`.
394398/// #[link(name = "my_c_library")]
395- /// extern "C" {
399+ /// unsafe extern "C" {
396400/// fn my_c_function(x: i32) -> bool;
397401/// }
398402/// ```
You can’t perform that action at this time.
0 commit comments