From 95729dcc733edd9f639855081cae8e24bc44fb30 Mon Sep 17 00:00:00 2001 From: Nixon Enraght-Moony Date: Tue, 26 Jul 2022 14:34:26 +0100 Subject: [PATCH] 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; ``` --- src/etc/check_missing_items.py | 4 ++-- 1 file 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"]):