I used -Zdump-mir option for rustc to get MIR files. I have problem understanding this line:
_5 = move ((_2 as Ok).0: std::sync::RwLockReadGuard<i32>); // bb7[2]: scope 1 at src\main.rs:19:12: 19:13
For the part of _5 = move ((_2 as Ok).0, does this means "make _2 itself into Ok, then move it to _5", or "make a copy of _2 then downcast it as Ok then move to _5"?
The difference is, the former implicates that _2 itself is moved to _5, _2 won't exist nor can be used after this line; while the latter means _2 is still alive and can be used later. As I am trying to get lifetime of variables, this makes difference. Does anyone have any ideas?
What is the original code? It can usually be told what is happening without diving into MIR.
On a side note, what problem are you trying to solve? "getting the lifetime of variables" isn't something that should be done manually (In fact you can't) and should be done using generics and lifetime parameters.