mlabs-haskell / lambda-buffers

LambdaBuffers toolkit for sharing types and their semantics between different languages
https://mlabs-haskell.github.io/lambda-buffers/
Apache License 2.0
29 stars 1 forks source link

error: reached the recursion limit while instantiating `json_field` #251

Open bladyjoker opened 1 month ago

bladyjoker commented 1 month ago

Error

error: reached the recursion limit while instantiating `<{closure@scripts::lbr_prelude::json::lamval::json_field<'_, RoCMinting>::{closu
re#0}::{closure#0}} as FnOnce<(Box<dyn Fn(...) -> ...>,)>>::call_once - shim(vtable)`                                                   
   --> /home/bladyjoker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lbr-prelude-0.1.3/src/json/lamval.rs:61:24                 
    |                                                                                                                                   
61  |     Box::new(move |x1| Box::new(move |x2| super::json_field(x0, x1, x2)))                                                         
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                          
    |                                                                                                                                   
note: `call_once` defined here                                                                                                          
   --> /nix/store/ryfyfy694d097gif9s0dg8kj1aca08c1-rust-default-1.78.0/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5      
    |                                                                                                                                   
250 |     extern "rust-call" fn call_once(self, args: Args) -> Self::Output;                                                            
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                            
    = note: the full type name has been written to '/home/bladyjoker/mlabs/unbox-infinity/infinity-extras/infinity-proto-conversions/tar

Full type name:

<{closure@scripts::lbr_prelude::json::lamval::json_field<'_, RoCMinting>::{closure#0}::{closure#0}} as FnOnce<(Box<dyn Fn(&scripts::serde_json::Value) -> std::result::Result<RoCMinting, scripts::lbr_prelude::error::Error>>,)>>::call_once - shim(vtable)

Problem schema

https://github.com/mlabs-haskell/unbox-infinity/blob/163b805f21f7a77a3bcd501fa261f1aa9ecf544f/infinity-api/lbf/Infinity/Application/Validation/Prelude.lbf#L42

References

bladyjoker commented 1 month ago

Workaround https://github.com/mlabs-haskell/unbox-infinity/pull/177/commits/9cd088ad27b7a220be96058f1bb70a82cce604e5