We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c711531 commit 5366135Copy full SHA for 5366135
src/librustc/middle/region.rs
@@ -1175,13 +1175,18 @@ struct YieldFinder<'a> {
1175
1176
impl<'a> YieldFinder<'a> {
1177
fn lookup<F: FnOnce(&mut Self)>(&mut self, id: NodeId, f: F) {
1178
- if let Some(result) = self.cache.get(&id) {
1179
- self.result = *result;
+ // Don't traverse further if we found a yield expression
+ if self.result.is_some() {
1180
return;
1181
}
1182
- if self.result.is_some() {
+
1183
+ // See if there's an entry in the cache
1184
+ if let Some(result) = self.cache.get(&id) {
1185
+ self.result = *result;
1186
1187
1188
1189
+ // Otherwise calculate the result and insert it into the cache
1190
f(self);
1191
self.cache.insert(id, self.result);
1192
0 commit comments