jroweboy/oxidize — pull request #21 by jroweboy (2014-03-23 11:20:07+00:00)
Title: This compiles at least

Just fixed it up and letting you take a look at my changes. Don't worry too much about the fact that I'm up so late though :p I sprained both ankles today and it hurts a bunch so I can't sleep either :S The main issue with the borrow thing is the borrow checker was unable to determine appropriate lifetimes for some values (eg: current_node = self) It determined that you moved the value but it could determine how long the move should be valid for, so by explicitly adding a borrow and a lifetime block, it was able to figure things out.

for c in .chars() {
current_node = find_or_insert()
}

became

// explicit lifetime block for the ptr (so it doesn't try to live till the end of the function)
{
let mut current_node = self;
for c in .chars() {
// borrow a refernce to ptr so that it doesn't complain about a double move
let tmp = current_node;
current_node = tmp.find_or_insert()
}
}

Also in Rust, you don't put ( ) around the conditions in an if statement hahaha. I had to fix like 15 warnings about that.