File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -388,11 +388,15 @@ mod enum_keyword {}
388
388
/// lazy_static;`. The other use is in foreign function interfaces (FFI).
389
389
///
390
390
/// `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.
392
394
///
393
395
/// ```rust ignore
396
+ /// // SAFETY: The function declarations given below are in
397
+ /// // line with the header files of `my_c_library`.
394
398
/// #[link(name = "my_c_library")]
395
- /// extern "C" {
399
+ /// unsafe extern "C" {
396
400
/// fn my_c_function(x: i32) -> bool;
397
401
/// }
398
402
/// ```
You can’t perform that action at this time.
0 commit comments