Mara Bos
Mara Bos

@m_ou_se

4 Tweets Feb 06, 2023
Forgetting to initialize a variable in a loop in Rust (1.45.0-nightly) gives a 'borrowed after move' error instead of 'borrowed before initializing'. Wonder how that happens, as nothing is being moved anywhere here.
Using a Copy type does give the right error: 'borrow of possibly-uninitialized variable':
/cc @ekuber since you know everything about Rust's error reporting ^^
The full example on the Rust Playground: play.rust-lang.org

Loading suggestions...