Skip to content
Open
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
10 changes: 7 additions & 3 deletions ch05/c-fibers/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/// FIX 47
/// Upstream fails on stable with E0554 (#![feature] not allowed on stable).
/// rustc 1.89.0 compiler says naked_functions is already stable, so the feature gate must be removed
//#![feature(naked_functions)]

/// FIX #31:
/// Inline assembly blocks inside naked functions now need to use
/// the `naked_asm` macro instead of the good old `asm` macro.
Expand All @@ -6,7 +11,6 @@
///
/// See: https://github.com/PacktPublishing/Asynchronous-Programming-in-Rust/issues/31
/// for more information.
#![feature(naked_functions)]
use std::arch::{asm, naked_asm};

const DEFAULT_STACK_SIZE: usize = 1024 * 1024 * 2;
Expand Down Expand Up @@ -147,7 +151,7 @@ fn guard() {
};
}

#[naked]
#[unsafe(naked)]
unsafe extern "C" fn skip() {
naked_asm!("ret")
}
Expand All @@ -159,7 +163,7 @@ pub fn yield_thread() {
};
}

#[naked]
#[unsafe(naked)]
#[no_mangle]
#[cfg_attr(target_os = "macos", export_name = "\x01switch")] // see: How-to-MacOS-M.md for explanation
unsafe extern "C" fn switch() {
Expand Down