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 @@ -381,11 +381,15 @@ mod enum_keyword {}
381381/// lazy_static;`. The other use is in foreign function interfaces (FFI).
382382///
383383/// `extern` is used in two different contexts within FFI. The first is in the form of external
384- /// blocks, for declaring function interfaces that Rust code can call foreign code by.
384+ /// blocks, for declaring function interfaces that Rust code can call foreign code by. This use
385+ /// of `extern` is unsafe, since we are asserting to the compiler that all function declarations
386+ /// are correct. If they are not, using these items may lead to undefined behavior.
385387///
386388/// ```rust ignore
389+ /// // SAFETY: The function declarations given below are in
390+ /// // line with the header files of `my_c_library`.
387391/// #[link(name = "my_c_library")]
388- /// extern "C" {
392+ /// unsafe extern "C" {
389393/// fn my_c_function(x: i32) -> bool;
390394/// }
391395/// ```
You can’t perform that action at this time.
0 commit comments