For the past six months or so I have been working on finite-wasm, a project aimed at enforcing deterministic resource limits (in time and space) in a runtime agnostic and Easy to Reason About way. This project produces a specification (or rather additions to the WebAssembly specification) detailing how these limits should be enforced and analyses implementing the specification. Last week I finally published the very first version of this code on crates.io, but didn’t feel comfortable making the repository public quite yet – I have a fair bit of improvements I want to make first. I’ll try to make a point of writing more about this project at a later date, when the project is fully public.
That said, as I was working on the improvements I encountered a perplexing limitation in rustc that manifests itself as a note: due to current limitations in the borrow checker, this implies a 'static lifetime
diagnostic. It seemed great opportunity for a stand-alone blog post, if not to document a possible workaround, then to serve as a proof that even experienced Rust developers aren’t immune to “fighting the borrow checker” woes. But also because this diagnostic message is quite opaque and is hardly documented (I could only find this internals thread) and writing my experience down seemed possibly useful to the next unfortunate soul to encounter a similar problem. Perhaps this might even inform a change in rustc?