X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fetc%2Fcheck_missing_items.py;h=ce06a79a21c3f58a770606027708e84b6552afa0;hb=989e4ffc7c45db3905926c6650e8b2cf6daa43db;hp=a705e2384959f1b8ad56db2d1a2ce3d2e44d9fc7;hpb=bd64d67d11ce62ec5242d86ae9efade49f084f70;p=rust.git diff --git a/src/etc/check_missing_items.py b/src/etc/check_missing_items.py index a705e238495..ce06a79a21c 100644 --- a/src/etc/check_missing_items.py +++ b/src/etc/check_missing_items.py @@ -57,7 +57,7 @@ def check_generic_bound(bound): if "trait_bound" in bound: for param in bound["trait_bound"]["generic_params"]: check_generic_param(param) - check_type(bound["trait_bound"]["trait"]) + check_path(bound["trait_bound"]["trait"]) def check_decl(decl): @@ -66,35 +66,35 @@ def check_decl(decl): if decl["output"]: check_type(decl["output"]) +def check_path(path): + args = path["args"] + if args: + if "angle_bracketed" in args: + for arg in args["angle_bracketed"]["args"]: + if "type" in arg: + check_type(arg["type"]) + elif "const" in arg: + check_type(arg["const"]["type"]) + for binding in args["angle_bracketed"]["bindings"]: + if "equality" in binding["binding"]: + term = binding["binding"]["equality"] + if "type" in term: check_type(term["type"]) + elif "const" in term: check_type(term["const"]) + elif "constraint" in binding["binding"]: + for bound in binding["binding"]["constraint"]: + check_generic_bound(bound) + elif "parenthesized" in args: + for input_ty in args["parenthesized"]["inputs"]: + check_type(input_ty) + if args["parenthesized"]["output"]: + check_type(args["parenthesized"]["output"]) + if not valid_id(path["id"]): + print("Type contained an invalid ID:", path["id"]) + sys.exit(1) def check_type(ty): if ty["kind"] == "resolved_path": - for bound in ty["inner"]["param_names"]: - check_generic_bound(bound) - args = ty["inner"]["args"] - if args: - if "angle_bracketed" in args: - for arg in args["angle_bracketed"]["args"]: - if "type" in arg: - check_type(arg["type"]) - elif "const" in arg: - check_type(arg["const"]["type"]) - for binding in args["angle_bracketed"]["bindings"]: - if "equality" in binding["binding"]: - term = binding["binding"]["equality"] - if "type" in term: check_type(term["type"]) - elif "const" in term: check_type(term["const"]) - elif "constraint" in binding["binding"]: - for bound in binding["binding"]["constraint"]: - check_generic_bound(bound) - elif "parenthesized" in args: - 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"]): - print("Type contained an invalid ID:", ty["inner"]["id"]) - sys.exit(1) + check_path(ty["inner"]) elif ty["kind"] == "tuple": for ty in ty["inner"]: check_type(ty) @@ -111,7 +111,7 @@ def check_type(ty): check_decl(ty["inner"]["decl"]) elif ty["kind"] == "qualified_path": check_type(ty["inner"]["self_type"]) - check_type(ty["inner"]["trait"]) + check_path(ty["inner"]["trait"]) work_list = set([crate["root"]]) @@ -174,7 +174,7 @@ while work_list: elif item["kind"] == "impl": check_generics(item["inner"]["generics"]) if item["inner"]["trait"]: - check_type(item["inner"]["trait"]) + check_path(item["inner"]["trait"]) if item["inner"]["blanket_impl"]: check_type(item["inner"]["blanket_impl"]) check_type(item["inner"]["for"])