Tighten compile-time leaf inventory checks

This commit is contained in:
Michael Mikovsky
2026-04-26 13:55:53 -06:00
parent bc22d349bf
commit 0aa0b187d7
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -12,11 +12,18 @@ pub mod endpoint;
#[cfg(feature = "leaf_tui")] #[cfg(feature = "leaf_tui")]
pub mod tui; pub mod tui;
#[cfg(feature = "leaf_endpoint")]
pub use endpoint::Open;
#[cfg(feature = "leaf_endpoint")] #[cfg(feature = "leaf_endpoint")]
pub use endpoint::RemoteShellEndpoint; pub use endpoint::RemoteShellEndpoint;
#[cfg(feature = "leaf_tui")] #[cfg(feature = "leaf_tui")]
pub use tui::RemoteShellTui; pub use tui::RemoteShellTui;
#[cfg(not(feature = "leaf_endpoint"))]
/// Compile-time procedure symbol kept available even when the endpoint runtime is
/// not built, so the leaf declaration still validates its declared inventory.
pub struct Open;
/// Open-request payload for the remote shell leaf. /// Open-request payload for the remote shell leaf.
/// ///
/// The shell currently needs no structured arguments, but a named payload type is /// The shell currently needs no structured arguments, but a named payload type is
+5
View File
@@ -167,6 +167,7 @@ pub(crate) fn expand_leaf_declaration(input: LeafDeclarationInput) -> Result<Tok
.iter() .iter()
.map(|procedure| LitStr::new(&normalize_suffix(&procedure.to_string()), procedure.span())) .map(|procedure| LitStr::new(&normalize_suffix(&procedure.to_string()), procedure.span()))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let procedure_type_checks = input.procedures.iter();
let endpoint_impl = input let endpoint_impl = input
.endpoint_struct .endpoint_struct
@@ -225,6 +226,10 @@ pub(crate) fn expand_leaf_declaration(input: LeafDeclarationInput) -> Result<Tok
} }
} }
const _: fn() = || {
#(let _ = ::core::marker::PhantomData::<#procedure_type_checks>;)*
};
#endpoint_impl #endpoint_impl
#tui_impl #tui_impl
}) })