Question regarding refactoring Rust code and REPL support


Suppose I have a hierarchy of modules:

M1 imports M2 imports M3

Now I want to refactor M3. I run cargo watch, and change types of some
functions in M3. What I get is a get millions of error messages for errors in
M2 and maybe even M1 (depending on whether M3 stuff was re-exported etc.).

If I had a REPL what I’d do is: I’d just load M3, refactor it until no
errors are generated, then load M2, repeat.

I’m wondering if something like this is possible with rust and cargo today.
What I’m currently doing is I comment out code is M1 and M2 until those
don’t generate any errors. Then I refactor M3, gradually enable code in M2
etc. this is too much work compared to the REPL approach of refactoring.

Any ideas/ thoughts?


Bumping the issue, since I’d love to have a REPL in Rust. Coming from Clojure and currently learning Rust for fun, I really miss the REPL (and the lispy syntax, but that’s another problem haha).