hydroflow icon indicating copy to clipboard operation
hydroflow copied to clipboard

Forgetting to complete a cycle in HF+ gives a proc macro panic

Open davidchuyaya opened this issue 7 months ago • 0 comments

I created a cycle but never called its "complete" function. This causes a crash at compile time that is not very explainable.

Here is the stack trace:

thread '<unnamed>' panicked at hydroflow_lang/src/graph/ops/tee.rs:35:17:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d7f6ebacee13b6c03623c4b74197280454ede8de/library/std/src/panicking.rs:658:5
   1: core::panicking::panic_fmt
             at /rustc/d7f6ebacee13b6c03623c4b74197280454ede8de/library/core/src/panicking.rs:74:14
   2: core::panicking::panic_bounds_check
             at /rustc/d7f6ebacee13b6c03623c4b74197280454ede8de/library/core/src/panicking.rs:276:5
   3: hydroflow_lang::graph::ops::tee::TEE::{{closure}}
             at ./hydroflow_lang/src/graph/ops/tee.rs:35:17
   4: core::ops::function::FnOnce::call_once
             at /rustc/d7f6ebacee13b6c03623c4b74197280454ede8de/library/core/src/ops/function.rs:250:5
   5: hydroflow_lang::graph::propagate_flow_props::propagate_flow_props
             at ./hydroflow_lang/src/graph/propagate_flow_props.rs:65:29
   6: hydroflow_plus::HfCompiled<usize>::with_dynamic_id
   7: hydroflow_plus_test_macro::paxos::paxos_runtime
   8: hydroflow_plus_test_macro::paxos::macro_b57fd27198ef2d7228a4316a336b7ea09e06957a88699006d7803d32dfe016e1_impl
   9: hydroflow_plus_test_macro::macro_b57fd27198ef2d7228a4316a336b7ea09e06957a88699006d7803d32dfe016e1
  10: core::ops::function::Fn::call
  11: proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}::{{closure}}
  12: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
  13: proc_macro::bridge::client::state::set
  14: proc_macro::bridge::client::run_client::{{closure}}
  15: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  16: std::panicking::try::do_call
  17: ___rust_try
  18: std::panicking::try
  19: proc_macro::bridge::client::run_client
  20: proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}
  21: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
  22: <proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::MessagePipe<proc_macro::bridge::buffer::Buffer>> as proc_macro::bridge::server::ExecutionStrategy>::run_bridge_and_client::<proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<rustc_expand::proc_macro_server::Rustc>>>
  23: <proc_macro::bridge::client::Client<proc_macro::TokenStream, proc_macro::TokenStream>>::run::<rustc_expand::proc_macro_server::Rustc, proc_macro::bridge::server::MaybeCrossThread<rustc_expand::proc_macro::MessagePipe<proc_macro::bridge::buffer::Buffer>>>
  24: <rustc_expand::proc_macro::BangProcMacro as rustc_expand::base::BangProcMacro>::expand
  25: <rustc_expand::expand::MacroExpander>::expand_invoc
  26: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
  27: <rustc_expand::expand::MacroExpander>::expand_crate
  28: rustc_interface::passes::resolver_for_lowering_raw
      [... omitted 2 frames ...]
  29: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<&rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::sync::Arc<rustc_ast::ast::Crate>)>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#2}>
  30: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: proc macro panicked
  --> hydroflow_plus_test/src/bin/paxos.rs:13:37
   |
13 |       hydroflow_plus::launch!(|ports| hydroflow_plus_test::paxos::paxos_runtime!(
   |  _____________________________________^
14 | |         ports,
15 | |         &f,
16 | |         &num_clients_per_node,
...  |
20 | |         &i_am_leader_check_timeout,
21 | |     ))
   | |_____^
   |
   = help: message: index out of bounds: the len is 0 but the index is 0

error: could not compile `hydroflow_plus_test` (bin "paxos" test) due to 1 previous error

davidchuyaya avatar Jul 02 '24 18:07 davidchuyaya