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;
```
This commit is contained in:
Nixon Enraght-Moony 2022-07-26 14:34:26 +01:00
parent 1202bbaf48
commit 95729dcc73

View File

@ -88,8 +88,8 @@ def check_type(ty):
for bound in binding["binding"]["constraint"]: for bound in binding["binding"]["constraint"]:
check_generic_bound(bound) check_generic_bound(bound)
elif "parenthesized" in args: elif "parenthesized" in args:
for ty in args["parenthesized"]["inputs"]: for input_ty in args["parenthesized"]["inputs"]:
check_type(ty) check_type(input_ty)
if args["parenthesized"]["output"]: if args["parenthesized"]["output"]:
check_type(args["parenthesized"]["output"]) check_type(args["parenthesized"]["output"])
if not valid_id(ty["inner"]["id"]): if not valid_id(ty["inner"]["id"]):