hairyballs@programming.devtoRust@programming.dev•Common Rust Lifetime Misconceptions (2020)
1·
1 year agoIt’s a toy example. In that case, the solution is to assign the expression to a variable to compute its result upfront.
It’s a toy example. In that case, the solution is to assign the expression to a variable to compute its result upfront.
There are still obvious things the BC cannot get. For example:
struct Foo;
impl Foo {
fn num(&mut self) -> usize { 0 }
fn index(&mut self, _i: usize) { }
}
let foo = Foo;
foo.index(foo.num()); //error
I really like this instance, so of course I’m 100% for the move
The idea is that I can see all the types in one glance, then I look at the rest.