Skip to content
Open
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: 4 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ test-group = 'hydro-trybuild-group'
[[profile.default.overrides]]
filter = 'package(hydro_test_template)'
test-group = 'hydro-trybuild-group'

[[profile.default.overrides]]
filter = 'package(hydro_test_embedded) & kind(example)'
test-group = 'hydro-trybuild-group'
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"rust-analyzer.rustfmt.extraArgs": [
"+nightly"
],
"rust-analyzer.cargo.features": "all",
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
Expand Down
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ members = [
"hydro_lang",
"hydro_std",
"hydro_test",
"hydro_test_embedded",
"hydro_test_template",
"include_mdtests",
"lattices_macro",
Expand Down
2 changes: 1 addition & 1 deletion hydro_lang/src/compile/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl<'a> FlowBuilder<'a> {
self.with_default_optimize().with_remaining_clusters(spec)
}

pub fn compile<D: Deploy<'a>>(self) -> CompiledFlow<'a> {
pub fn compile<D: Deploy<'a, InstantiateEnv = ()>>(self) -> CompiledFlow<'a> {
self.with_default_optimize::<D>().compile()
}

Expand Down
2 changes: 1 addition & 1 deletion hydro_lang/src/compile/built.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl<'a> BuiltFlow<'a> {
self.into_deploy().with_remaining_clusters(spec)
}

pub fn compile<D: Deploy<'a>>(self) -> CompiledFlow<'a> {
pub fn compile<D: Deploy<'a, InstantiateEnv = ()>>(self) -> CompiledFlow<'a> {
self.into_deploy::<D>().compile()
}

Expand Down
12 changes: 8 additions & 4 deletions hydro_lang/src/compile/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,17 @@ impl<'a, D: Deploy<'a>> DeployFlow<'a, D> {
/// Compiles the flow into DFIR ([`dfir_lang::graph::DfirGraph`]) including networking.
///
/// (This does not compile the DFIR itself, instead use [`Self::deploy`] to compile & deploy the DFIR).
pub fn compile(mut self) -> CompiledFlow<'a> {
self.compile_internal()
pub fn compile(mut self) -> CompiledFlow<'a>
where
D: Deploy<'a, InstantiateEnv = ()>,
{
self.compile_internal(&mut ())
}

/// Same as [`Self::compile`] but does not invalidate `self`, for internal use.
///
/// Empties `self.sidecars` and modifies `self.ir`, leaving `self` in a partial state.
fn compile_internal(&mut self) -> CompiledFlow<'a> {
pub(super) fn compile_internal(&mut self, env: &mut D::InstantiateEnv) -> CompiledFlow<'a> {
let mut seen_tees: HashMap<_, _> = HashMap::new();
let mut extra_stmts = SparseSecondaryMap::new();
for leaf in self.ir.iter_mut() {
Expand All @@ -279,6 +282,7 @@ impl<'a, D: Deploy<'a>> DeployFlow<'a, D> {
&self.processes,
&self.clusters,
&self.externals,
env,
);
}

Expand Down Expand Up @@ -348,7 +352,7 @@ impl<'a, D: Deploy<'a>> DeployFlow<'a, D> {
mut extra_stmts,
mut sidecars,
_phantom,
} = self.compile_internal();
} = self.compile_internal(env);

let mut compiled = dfir;
self.cluster_id_stmts(&mut extra_stmts);
Expand Down
12 changes: 12 additions & 0 deletions hydro_lang/src/compile/deploy_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ pub trait Deploy<'a> {
fn cluster_membership_stream(
location_id: &LocationId,
) -> impl QuotedWithContext<'a, Box<dyn Stream<Item = (TaglessMemberId, MembershipEvent)> + Unpin>, ()>;

/// Registers an embedded input for the given ident and element type.
///
/// Only meaningful for the embedded deployment backend. The default
/// implementation panics.
fn register_embedded_input(
_env: &mut Self::InstantiateEnv,
_ident: &syn::Ident,
_element_type: &syn::Type,
) {
panic!("register_embedded_input is only supported by EmbeddedDeploy");
}
}

pub trait ProcessSpec<'a, D>
Expand Down
Loading
Loading