about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNixon Enraght-Moony <nixon.emoony@gmail.com>2022-07-26 14:34:26 +0100
committerNixon Enraght-Moony <nixon.emoony@gmail.com>2022-07-30 20:13:40 +0100
commit95729dcc733edd9f639855081cae8e24bc44fb30 (patch)
treeab37c27e13c0c8e3505e06f9b4ee511b59e58879
parent1202bbaf48a0a919a2e0cfd8b7dce97e8fc3030d (diff)
downloadrust-95729dcc733edd9f639855081cae8e24bc44fb30.tar.gz
rust-95729dcc733edd9f639855081cae8e24bc44fb30.zip
check_missing_items.py: Don't overwrite `ty` in loop
Because python doesn't have lexical scope, loop variables
persist after the loop is exited, set to the value of the last
itteration

```
>>> i = 0
>>> for i in range(10): pass
...
>>> i
9
```

This causes the `ty` variable to be changed, causing unexpected crashes on
```
pub type RefFn<'a> = &'a dyn for<'b> Fn(&'a i32) -> i32;
```
-rw-r--r--src/etc/check_missing_items.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/etc/check_missing_items.py b/src/etc/check_missing_items.py
index 343dd0387f4..a705e238495 100644
--- a/src/etc/check_missing_items.py
+++ b/src/etc/check_missing_items.py
@@ -88,8 +88,8 @@ def check_type(ty):
                         for bound in binding["binding"]["constraint"]:
                             check_generic_bound(bound)
             elif "parenthesized" in args:
-                for ty in args["parenthesized"]["inputs"]:
-                    check_type(ty)
+                for input_ty in args["parenthesized"]["inputs"]:
+                    check_type(input_ty)
                 if args["parenthesized"]["output"]:
                     check_type(args["parenthesized"]["output"])
         if not valid_id(ty["inner"]["id"]):