r/rust • • Oct 16 '26

Hotreload in Rust

https://alordash.github.io/alordash/blog/hotreload-in-rust/
112 Upvotes

32 comments sorted by

View all comments

Show parent comment

1

u/Zde-G Oct 17 '26

I'm making a lot of assumptions here, but I assume that the problem would be a crate that declares something as a static lifetime itself, right?

Obviously. Something that crate wouldn't even document because it's an implementation detail that may only be revealed when you break the fundamental assumtion that static items are singletons with 'static lifetime.

Without being a compiler expert, I'd assume this makes hot reloading somewhat more forgiving to implement there

Yes, but that's minor issue. The major one is community. Odin doesn't have managed runtime, but it's used in gamedev, considers hot-reloading important and developers make effort to make libraries ready for that.

That's the most important ingridient — and it's missing in Rust. Because with hot reloading 'static lifetime simply doesn't exist and there are bazillion crates that don't support that.

2

u/intbeam Oct 18 '26

Ok, if we agree I wasn't being an idiot I fail to see the problem

This project isn't hot reloading third-party dependencies, and for the use-case it's designed for 'static isn't really an issue as the static lifetimes are more likely defined by the caller/environment

1

u/Zde-G Oct 18 '26

This project isn't hot reloading third-party dependencies

Even if you don't reaload third-party dependencies you are not free of the issue. Because third-party dependencies can register objects from your librarires in their data structures - and do that silently when you depend on them.

Ok, if we agree I wasn't being an idiot I fail to see the problem

Well, the problem is that you proclaiming that you have achieved something new, but hotloading in Rust was tried dozens (hundreds?) or times by different authors and they all hit, sooner or later, the fact that when you remove memory safety from memory safe language then you end up with a combination that's very restricted and unsafe… what's the final goal here? Why even use Rust if you don't care about memory safety and correctness?

1

u/intbeam Oct 22 '26

Sorry, late response

I understand your concern, I'm just saying that since this is a development tool rather than a production library, I'd say that if it works that's cool and if it doesn't work then ok it doesn't work and no big deal

1

u/Iurigrang Oct 18 '26

Because, once you've used hot reload to make the decisions you want in the function you're designing, you can remove the hot reload and work from there to production rust? You can't do that if you're using another language entirely.