macros, vm, bytecode: add #[primop] await-style primop macro
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
//! Single macro-facing path for the `#[primop]` support surface: the traits
|
||||
//! generated code type-checks through (defined in `fix_runtime`, where the
|
||||
//! impl sets are coherent) and the stub trio that keeps un-expanded primop
|
||||
//! sources resolving in tooling.
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
pub use fix_runtime::{CalleeReady, ForceTarget, UnwrapSlot};
|
||||
use fix_runtime::{Slot, Value};
|
||||
|
||||
macro_rules! type_hint {
|
||||
() => {
|
||||
if false {
|
||||
return async {
|
||||
unreachable!();
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[expect(clippy::panic, reason = "deliberately panic when the stub is called")]
|
||||
pub fn force<T>(_: Slot<Value<'_>>) -> impl Future<Output = Slot<T>> {
|
||||
type_hint!();
|
||||
panic!("stub `force` called at runtime")
|
||||
}
|
||||
|
||||
#[expect(clippy::panic, reason = "deliberately panic when the stub is called")]
|
||||
pub fn call<T, A, R>(_: &T, _: A) -> impl Future<Output = R> {
|
||||
type_hint!();
|
||||
panic!("stub `call` called at runtime")
|
||||
}
|
||||
|
||||
#[expect(clippy::panic, reason = "deliberately panic when the stub is called")]
|
||||
pub fn spill<T>(_: T) -> Slot<T> {
|
||||
panic!("stub `spill` called at runtime")
|
||||
}
|
||||
Reference in New Issue
Block a user