I posted this idea as an RFC issue in #1911, but figured I’d post here as well to get some feedback.
The linked issue has some further technical details, but the basic idea is to introduce a construct to indicate that a piece of code needs to be filled in (i.e., the program should not compile while it is present), but that the developer wants to postpone coding up until later. This came about following a rather large refactor I had to do; part of the work I had to do was replace all
Bazs. But while doing so, there were times when I realized some other change would need to be made (like
Baz requiring some additional information, but that information not being readily available in a particular segment of the code). I wanted to first finish translating all the
Bars, and only after that deal with the corner cases.
Normally in this case, I add a
// TODO, or an
unimplemented!(). However, this approach has some drawbacks. In particular, these both still let the code compile when present. Thus, after I finished my “first pass” I had to remember to also grep for all the
// TODOs (and filter out any that aren’t relevant to the refactor in question). What I really wanted was a way to tell the compiler “don’t let the code compile while this is unimplemented”. But crucially, I still want to check if my code type-checks and if the borrow checker is satisfied. The compiler should only remind me of those locations if the code would otherwise have compiled.
I realize that this feature is kind of weird — it’s a construct that will never be present in any distributed code (because, by definition, it prevents compilation). But I believe it would be extremely useful during development, especially of large passes like refactors, building a new, big feature, or writing a bunch of code from scratch.