No description provided.
At the moment we are very conservative when it comes to using self. This is for multiple reasons. The first reason is that we load globals through self. ```rust let var3 = self.global65; ``` With globals we need to be somewhat conservative, as they possibly can't be reordered. Consider the following example: ```rust let var3 = self.global65; self.some_function(...); let var4 = var3 * 10.0; ``` If we were to not introduce that let binding for loading the global, we could do the following: ```rust /// Supposed to load self.global65 here self.some_function(...); let var4 = self.global65 * 10.0; ``` That is however problematic, as this reordered the load of the global after the method call. The method call however borrows self mutably and is able to modify the global. Thus we have to essentially do a similar pass as the borrow checker and treat self as borrowed mutably (at least partially) from the original location of the load to when it is actually being used. If this borrow check fails, which it does in this case, then the load needs to happen early. Similarly we have to work around restrictions that apply to Rust today. You can't write the following code: ```rust self.some_function(self.global65); ``` Even with the current NLL implementation, self.some_function starts the borrow before self.global65 and thus the load got reordered behind the method call, resulting in a borrow conflict.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by CryZe and has received 0 comments.