Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/doc/src/reference/build-script-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void hello() {
// Note the lack of the `#[link]` attribute. We’re delegating the responsibility
// of selecting what to link over to the build script rather than hard-coding
// it in the source file.
extern { fn hello(); }
unsafe extern { fn hello(); }

fn main() {
unsafe { hello(); }
Expand Down Expand Up @@ -327,7 +327,7 @@ Let's round out the example with a basic FFI binding:

use std::os::raw::{c_uint, c_ulong};

extern "C" {
unsafe extern "C" {
pub fn crc32(crc: c_ulong, buf: *const u8, len: c_uint) -> c_ulong;
}

Expand Down
6 changes: 3 additions & 3 deletions src/doc/src/reference/semver.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ pub struct SpecificLayout {
// Example usage that will break.
use updated_crate::SpecificLayout;

extern "C" {
unsafe extern "C" {
// This C function is assuming a specific layout defined in a C header.
fn c_fn_get_b(x: &SpecificLayout) -> u32;
}
Expand Down Expand Up @@ -820,7 +820,7 @@ pub struct SpecificLayout {
// Example usage that will break.
use updated_crate::SpecificLayout;

extern "C" {
unsafe extern "C" {
// This C function is assuming a specific layout defined in a C header.
fn c_fn_get_b(x: &SpecificLayout) -> u32; // Error: is not FFI-safe
}
Expand Down Expand Up @@ -941,7 +941,7 @@ pub struct Transparent<T>(T);
#![deny(improper_ctypes)]
use updated_crate::Transparent;

extern "C" {
unsafe extern "C" {
fn c_fn() -> Transparent<f64>; // Error: is not FFI-safe
}

Expand Down