From 76c35bec9381cd469e91f57911e4a566123afbbe Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Thu, 5 Sep 2024 13:54:26 +0200 Subject: [PATCH 01/13] Rust: add Expr, Pat, Stmt to schema --- rust/schema.py | 486 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 486 insertions(+) diff --git a/rust/schema.py b/rust/schema.py index ae05c0f9ac07..54d0a7104e1c 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -13,6 +13,7 @@ include("prefix.dbscheme") + @qltest.skip class Element: pass @@ -22,6 +23,7 @@ class Element: class File(Element): name: string + @qltest.skip @qltest.collapse_hierarchy class Location(Element): @@ -31,30 +33,514 @@ class Location(Element): end_line: int end_column: int + class DbFile(File): pass + class DbLocation(Location): pass + @synth.on_arguments() class UnknownFile(File): pass + @synth.on_arguments() class UnknownLocation(Location): pass + @qltest.skip class Locatable(Element): location: optional[Location] + class Declaration(Locatable): pass + class Module(Declaration): # TODO name declarations: list[Declaration] | child + +@qltest.collapse_hierarchy +class Expr(Locatable): + pass + + +@qltest.collapse_hierarchy +class Pat(Locatable): + pass + + +@qltest.collapse_hierarchy +class Stmt(Locatable): + pass + + +@qltest.collapse_hierarchy +class TypeRef(Locatable): + # TODO + pass + + class Function(Declaration): name: string + body: Expr + + +# Missing, +class MissingExpr(Expr): + pass + +# Path(Path), + + +class Path(Expr): + # TODO + pass + +# If { +# condition: ExprId, +# then_branch: ExprId, +# else_branch: Option, +# }, + + +class If(Expr): + condition: Expr + then_branch: Expr + else_branch: optional[Expr] + +# Let { +# pat: PatId, +# expr: ExprId, +# }, + + +class Let(Expr): + pat: Pat + expr: Expr + +# Block { +# id: Option, +# statements: Box<[Stmt]>, +# tail: Option, +# label: Option, +# }, + + +class Block(Expr): + statements: list[Stmt] + tail: optional[Expr] + label: optional[string] + +# Async { +# id: Option, +# statements: Box<[Stmt]>, +# tail: Option, +# }, + + +class Async(Block): + pass + +# Const(ConstBlockId), + + +class Const(Expr): + pass + +# // FIXME: Fold this into Block with an unsafe flag? +# Unsafe { +# id: Option, +# statements: Box<[Stmt]>, +# tail: Option, +# }, + + +class Unsafe(Block): + pass + +# Loop { +# body: ExprId, +# label: Option, +# }, + + +class Loop(Expr): + body: Expr + label: optional[string] + +# Call { +# callee: ExprId, +# args: Box<[ExprId]>, +# is_assignee_expr: bool, +# }, + + +class Call(Expr): + callee: Expr + args: list[Expr] + is_assignee_expr: predicate + +# MethodCall { +# receiver: ExprId, +# method_name: Name, +# args: Box<[ExprId]>, +# generic_args: Option>, +# }, + + +class MethodCall(Expr): + receiver: Expr + method_name: string + args: list[Expr] + # TODO + # generic_args: optional[GenericArgs] + +# pub struct MatchArm { +# pub pat: PatId, +# pub guard: Option, +# pub expr: ExprId, +# } + + +@qltest.skip +class MatchArm(Locatable): + pat: Pat + guard: optional[Expr] + expr: Expr +# Match { +# expr: ExprId, +# arms: Box<[MatchArm]>, +# }, + + +class Match(Expr): + expr: Expr + branches: list[MatchArm] + +# Continue { +# label: Option, +# }, + + +class Continue(Expr): + label: optional[string] + +# Break { +# expr: Option, +# label: Option, +# }, + + +class Break(Expr): + expr: optional[Expr] + label: optional[string] + + +# Return { +# expr: Option, +# }, + +class Return(Expr): + expr: optional[Expr] +# Become { +# expr: ExprId, +# }, + + +class Become(Expr): + expr: Expr +# Yield { +# expr: Option, +# }, + + +class Yield(Expr): + expr: optional[Expr] + +# Yeet { +# expr: Option, +# }, + + +class Yeet(Expr): + expr: optional[Expr] +# RecordLit { +# path: Option>, +# fields: Box<[RecordLitField]>, +# spread: Option, +# ellipsis: bool, +# is_assignee_expr: bool, +# }, + + +class RecordLit(Expr): + # TODO + pass + + +# Field { +# expr: ExprId, +# name: Name, +# }, + +class Field(Expr): + expr: Expr + name: string + +# Await { +# expr: ExprId, +# }, + + +class Await(Expr): + expr: Expr + +# Cast { +# expr: ExprId, +# type_ref: Interned, +# }, + + +class Cast(Expr): + expr: Expr + type_ref: TypeRef +# Ref { +# expr: ExprId, +# rawness: Rawness, +# mutability: Mutability, +# }, + + +class Ref(Expr): + expr: Expr + is_raw: predicate + is_mut: predicate +# Box { +# expr: ExprId, +# }, + + +class Box(Expr): + expr: Expr +# UnaryOp { +# expr: ExprId, +# op: UnaryOp, +# }, + + +class UnaryExpr(Expr): + expr: Expr + op: string + + +# BinaryOp { +# lhs: ExprId, +# rhs: ExprId, +# op: Option, +# }, + + +class BinaryOp(Expr): + lhs: Expr + rhs: Expr + op: optional[string] + + +# Range { +# lhs: Option, +# rhs: Option, +# range_type: RangeOp, +# }, + + +class Range(Expr): + lhs: optional[Expr] + rhs: optional[Expr] + is_inclusive: predicate + +# Index { +# base: ExprId, +# index: ExprId, +# is_assignee_expr: bool, +# }, + + +class Index(Expr): + base: Expr + index: Expr + is_assignee_expr: predicate + +# Closure { +# args: Box<[PatId]>, +# arg_types: Box<[Option>]>, +# ret_type: Option>, +# body: ExprId, +# closure_kind: ClosureKind, +# capture_by: CaptureBy, +# }, + + +class Closure(Expr): + args: list[Pat] + arg_types: list[TypeRef] + ret_type: optional[TypeRef] + body: Expr + # TODO + # closure_kind: ClosureKind + is_move: predicate +# Tuple { +# exprs: Box<[ExprId]>, +# is_assignee_expr: bool, +# }, + + +class Tuple(Expr): + exprs: list[Expr] + is_assignee_expr: predicate + +# Array(Array), + + +class Array(Expr): + pass +# Literal(Literal), + + +class Literal(Expr): + pass +# Underscore, + + +class Underscore(Expr): + pass +# OffsetOf(OffsetOf), + + +class OffsetOf(Expr): + pass +# InlineAsm(InlineAsm), + + +class InlineAsm(Expr): + pass + + +# Let { +# pat: PatId, +# type_ref: Option>, +# initializer: Option, +# else_branch: Option, +# }, + +class IfLet(Stmt): + pat: Pat + type_ref: optional[TypeRef] + initializer: optional[Expr] + else_branch: optional[Expr] +# Expr { +# expr: ExprId, +# has_semi: bool, +# }, + + +class ExprStmt(Stmt): + expr: Expr + has_semi: predicate + +# // At the moment, we only use this to figure out if a return expression +# // is really the last statement of a block. See #16566 +# Item, + + +class ItemStmt(Stmt): + pass + + # Missing, + + +class MissingPat(Pat): + pass + # Wild, + + +class WildPat(Pat): + pass + # Tuple { args: Box<[PatId]>, ellipsis: Option }, + + +class TuplePat(Pat): + args: list[Pat] + ellipsis: optional[int] + + # Or(Box<[PatId]>), + + +class OrPat(Pat): + args: list[Pat] + # Record { path: Option>, args: Box<[RecordFieldPat]>, ellipsis: bool }, + + +class RecordPat(Pat): + # TODO + pass + + # Range { start: Option>, end: Option> }, + + +class RangePat(Pat): + start: optional[Pat] + end: optional[Pat] + # Slice { prefix: Box<[PatId]>, slice: Option, suffix: Box<[PatId]> }, + + +class SlicePat(Pat): + prefix: list[Pat] + # Path(Box), + + +class PathPat(Pat): + pass + # Lit(ExprId), + + +class LitPat(Pat): + expr: Expr + + # Bind { id: BindingId, subpat: Option }, + + +class BindPat(Pat): + binding_id: string + subpat: optional[Pat] + + # TupleStruct { path: Option>, args: Box<[PatId]>, ellipsis: Option }, + + +class TupleStructPat(Pat): + # TODO + pass + + # Ref { pat: PatId, mutability: Mutability }, + + +class RefPat(Pat): + pat: Pat + is_mut: predicate + + # Box { inner: PatId }, + + +class BoxPat(Pat): + inner: Pat + # ConstBlock(ExprId), + + +class ConstBlockPat(Pat): + expr: Expr From 46d6bbb4589fc57e197b8f13e95a38368990cf68 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Thu, 5 Sep 2024 13:54:00 +0200 Subject: [PATCH 02/13] Rust: update generated code --- rust/.generated.list | 190 ++- rust/.gitattributes | 176 ++- rust/extractor/src/generated/top.rs | 1235 ++++++++++++++- rust/ql/lib/codeql/rust/elements.qll | 57 + rust/ql/lib/codeql/rust/elements/Array.qll | 8 + .../codeql/rust/elements/ArrayConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Async.qll | 8 + .../codeql/rust/elements/AsyncConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Await.qll | 8 + .../codeql/rust/elements/AwaitConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Become.qll | 8 + .../rust/elements/BecomeConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/BinaryOp.qll | 8 + .../rust/elements/BinaryOpConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/BindPat.qll | 8 + .../rust/elements/BindPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Block.qll | 8 + rust/ql/lib/codeql/rust/elements/Box.qll | 8 + .../codeql/rust/elements/BoxConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/BoxPat.qll | 8 + .../rust/elements/BoxPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Break.qll | 8 + .../codeql/rust/elements/BreakConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Call.qll | 8 + .../codeql/rust/elements/CallConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Cast.qll | 8 + .../codeql/rust/elements/CastConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Closure.qll | 8 + .../rust/elements/ClosureConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Const.qll | 8 + .../codeql/rust/elements/ConstBlockPat.qll | 8 + .../elements/ConstBlockPatConstructor.qll | 14 + .../codeql/rust/elements/ConstConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Continue.qll | 8 + .../rust/elements/ContinueConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Expr.qll | 8 + rust/ql/lib/codeql/rust/elements/ExprStmt.qll | 8 + .../rust/elements/ExprStmtConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Field.qll | 8 + .../codeql/rust/elements/FieldConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/If.qll | 8 + .../codeql/rust/elements/IfConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/IfLet.qll | 8 + .../codeql/rust/elements/IfLetConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Index.qll | 8 + .../codeql/rust/elements/IndexConstructor.qll | 14 + .../ql/lib/codeql/rust/elements/InlineAsm.qll | 8 + .../rust/elements/InlineAsmConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/ItemStmt.qll | 8 + .../rust/elements/ItemStmtConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Let.qll | 8 + .../codeql/rust/elements/LetConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/LitPat.qll | 8 + .../rust/elements/LitPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Literal.qll | 8 + .../rust/elements/LiteralConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Loop.qll | 8 + .../codeql/rust/elements/LoopConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Match.qll | 8 + rust/ql/lib/codeql/rust/elements/MatchArm.qll | 8 + .../rust/elements/MatchArmConstructor.qll | 14 + .../codeql/rust/elements/MatchConstructor.qll | 14 + .../lib/codeql/rust/elements/MethodCall.qll | 8 + .../rust/elements/MethodCallConstructor.qll | 14 + .../lib/codeql/rust/elements/MissingExpr.qll | 8 + .../rust/elements/MissingExprConstructor.qll | 14 + .../lib/codeql/rust/elements/MissingPat.qll | 8 + .../rust/elements/MissingPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/OffsetOf.qll | 8 + .../rust/elements/OffsetOfConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/OrPat.qll | 8 + .../codeql/rust/elements/OrPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Pat.qll | 8 + rust/ql/lib/codeql/rust/elements/Path.qll | 8 + .../codeql/rust/elements/PathConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/PathPat.qll | 8 + .../rust/elements/PathPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Range.qll | 8 + .../codeql/rust/elements/RangeConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/RangePat.qll | 8 + .../rust/elements/RangePatConstructor.qll | 14 + .../ql/lib/codeql/rust/elements/RecordLit.qll | 8 + .../rust/elements/RecordLitConstructor.qll | 14 + .../ql/lib/codeql/rust/elements/RecordPat.qll | 8 + .../rust/elements/RecordPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Ref.qll | 8 + .../codeql/rust/elements/RefConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/RefPat.qll | 8 + .../rust/elements/RefPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Return.qll | 8 + .../rust/elements/ReturnConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/SlicePat.qll | 8 + .../rust/elements/SlicePatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Stmt.qll | 8 + rust/ql/lib/codeql/rust/elements/Tuple.qll | 8 + .../codeql/rust/elements/TupleConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/TuplePat.qll | 8 + .../rust/elements/TuplePatConstructor.qll | 14 + .../codeql/rust/elements/TupleStructPat.qll | 8 + .../elements/TupleStructPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/TypeRef.qll | 8 + .../rust/elements/TypeRefConstructor.qll | 14 + .../ql/lib/codeql/rust/elements/UnaryExpr.qll | 8 + .../rust/elements/UnaryExprConstructor.qll | 14 + .../lib/codeql/rust/elements/Underscore.qll | 8 + .../rust/elements/UnderscoreConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Unsafe.qll | 8 + .../rust/elements/UnsafeConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/WildPat.qll | 8 + .../rust/elements/WildPatConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Yeet.qll | 8 + .../codeql/rust/elements/YeetConstructor.qll | 14 + rust/ql/lib/codeql/rust/elements/Yield.qll | 8 + .../codeql/rust/elements/YieldConstructor.qll | 14 + rust/ql/lib/codeql/rust/generated/Array.qll | 23 + rust/ql/lib/codeql/rust/generated/Async.qll | 23 + rust/ql/lib/codeql/rust/generated/Await.qll | 30 + rust/ql/lib/codeql/rust/generated/Become.qll | 30 + .../ql/lib/codeql/rust/generated/BinaryOp.qll | 47 + rust/ql/lib/codeql/rust/generated/BindPat.qll | 42 + rust/ql/lib/codeql/rust/generated/Block.qll | 62 + rust/ql/lib/codeql/rust/generated/Box.qll | 30 + rust/ql/lib/codeql/rust/generated/BoxPat.qll | 30 + rust/ql/lib/codeql/rust/generated/Break.qll | 45 + rust/ql/lib/codeql/rust/generated/Call.qll | 52 + rust/ql/lib/codeql/rust/generated/Cast.qll | 38 + rust/ql/lib/codeql/rust/generated/Closure.qll | 88 ++ rust/ql/lib/codeql/rust/generated/Const.qll | 23 + .../codeql/rust/generated/ConstBlockPat.qll | 34 + .../ql/lib/codeql/rust/generated/Continue.qll | 33 + rust/ql/lib/codeql/rust/generated/Expr.qll | 21 + .../ql/lib/codeql/rust/generated/ExprStmt.qll | 37 + rust/ql/lib/codeql/rust/generated/Field.qll | 35 + .../ql/lib/codeql/rust/generated/Function.qll | 9 + rust/ql/lib/codeql/rust/generated/If.qll | 49 + rust/ql/lib/codeql/rust/generated/IfLet.qll | 72 + rust/ql/lib/codeql/rust/generated/Index.qll | 42 + .../lib/codeql/rust/generated/InlineAsm.qll | 23 + .../ql/lib/codeql/rust/generated/ItemStmt.qll | 23 + rust/ql/lib/codeql/rust/generated/Let.qll | 38 + rust/ql/lib/codeql/rust/generated/LitPat.qll | 31 + rust/ql/lib/codeql/rust/generated/Literal.qll | 23 + rust/ql/lib/codeql/rust/generated/Loop.qll | 40 + rust/ql/lib/codeql/rust/generated/Match.qll | 49 + .../ql/lib/codeql/rust/generated/MatchArm.qll | 53 + .../lib/codeql/rust/generated/MethodCall.qll | 60 + .../lib/codeql/rust/generated/MissingExpr.qll | 23 + .../lib/codeql/rust/generated/MissingPat.qll | 23 + .../ql/lib/codeql/rust/generated/OffsetOf.qll | 23 + rust/ql/lib/codeql/rust/generated/OrPat.qll | 40 + .../lib/codeql/rust/generated/ParentChild.qll | 883 ++++++++++- rust/ql/lib/codeql/rust/generated/Pat.qll | 21 + rust/ql/lib/codeql/rust/generated/Path.qll | 23 + rust/ql/lib/codeql/rust/generated/PathPat.qll | 23 + rust/ql/lib/codeql/rust/generated/Range.qll | 52 + .../ql/lib/codeql/rust/generated/RangePat.qll | 48 + rust/ql/lib/codeql/rust/generated/Raw.qll | 768 ++++++++- .../lib/codeql/rust/generated/RecordLit.qll | 23 + .../lib/codeql/rust/generated/RecordPat.qll | 23 + rust/ql/lib/codeql/rust/generated/Ref.qll | 40 + rust/ql/lib/codeql/rust/generated/RefPat.qll | 35 + rust/ql/lib/codeql/rust/generated/Return.qll | 35 + .../ql/lib/codeql/rust/generated/SlicePat.qll | 41 + rust/ql/lib/codeql/rust/generated/Stmt.qll | 21 + rust/ql/lib/codeql/rust/generated/Synth.qll | 1373 ++++++++++++++++- .../rust/generated/SynthConstructors.qll | 53 + rust/ql/lib/codeql/rust/generated/Tuple.qll | 45 + .../ql/lib/codeql/rust/generated/TuplePat.qll | 51 + .../codeql/rust/generated/TupleStructPat.qll | 23 + rust/ql/lib/codeql/rust/generated/TypeRef.qll | 23 + .../lib/codeql/rust/generated/UnaryExpr.qll | 36 + .../lib/codeql/rust/generated/Underscore.qll | 23 + rust/ql/lib/codeql/rust/generated/Unsafe.qll | 23 + rust/ql/lib/codeql/rust/generated/WildPat.qll | 23 + rust/ql/lib/codeql/rust/generated/Yeet.qll | 35 + rust/ql/lib/codeql/rust/generated/Yield.qll | 35 + rust/ql/lib/rust.dbscheme | 564 ++++++- .../generated/Expr/MISSING_SOURCE.txt | 4 + .../generated/Function/Function.ql | 7 +- .../generated/Pat/MISSING_SOURCE.txt | 4 + .../generated/Stmt/MISSING_SOURCE.txt | 4 + .../generated/TypeRef/MISSING_SOURCE.txt | 4 + 182 files changed, 8468 insertions(+), 98 deletions(-) create mode 100644 rust/ql/lib/codeql/rust/elements/Array.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Async.qll create mode 100644 rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Await.qll create mode 100644 rust/ql/lib/codeql/rust/elements/AwaitConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Become.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BecomeConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BinaryOp.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BinaryOpConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BindPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BindPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Block.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Box.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BoxConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BoxPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BoxPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Break.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BreakConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Call.qll create mode 100644 rust/ql/lib/codeql/rust/elements/CallConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Cast.qll create mode 100644 rust/ql/lib/codeql/rust/elements/CastConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Closure.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ClosureConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Const.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ConstBlockPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ConstBlockPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ConstConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Continue.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ContinueConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Expr.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ExprStmt.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ExprStmtConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Field.qll create mode 100644 rust/ql/lib/codeql/rust/elements/FieldConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/If.qll create mode 100644 rust/ql/lib/codeql/rust/elements/IfConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/IfLet.qll create mode 100644 rust/ql/lib/codeql/rust/elements/IfLetConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Index.qll create mode 100644 rust/ql/lib/codeql/rust/elements/IndexConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/InlineAsm.qll create mode 100644 rust/ql/lib/codeql/rust/elements/InlineAsmConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ItemStmt.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ItemStmtConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Let.qll create mode 100644 rust/ql/lib/codeql/rust/elements/LetConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/LitPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/LitPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Literal.qll create mode 100644 rust/ql/lib/codeql/rust/elements/LiteralConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Loop.qll create mode 100644 rust/ql/lib/codeql/rust/elements/LoopConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Match.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MatchArm.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MatchArmConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MatchConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MethodCall.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MethodCallConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MissingExpr.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MissingExprConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MissingPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/MissingPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/OffsetOf.qll create mode 100644 rust/ql/lib/codeql/rust/elements/OffsetOfConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/OrPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/OrPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Pat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Path.qll create mode 100644 rust/ql/lib/codeql/rust/elements/PathConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/PathPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/PathPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Range.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RangeConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RangePat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RangePatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RecordLit.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RecordLitConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RecordPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RecordPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Ref.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RefConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RefPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/RefPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Return.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ReturnConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/SlicePat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/SlicePatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Stmt.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Tuple.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TupleConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TuplePat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TuplePatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TupleStructPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TypeRef.qll create mode 100644 rust/ql/lib/codeql/rust/elements/TypeRefConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/UnaryExpr.qll create mode 100644 rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Underscore.qll create mode 100644 rust/ql/lib/codeql/rust/elements/UnderscoreConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Unsafe.qll create mode 100644 rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/WildPat.qll create mode 100644 rust/ql/lib/codeql/rust/elements/WildPatConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Yeet.qll create mode 100644 rust/ql/lib/codeql/rust/elements/YeetConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Yield.qll create mode 100644 rust/ql/lib/codeql/rust/elements/YieldConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Array.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Async.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Await.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Become.qll create mode 100644 rust/ql/lib/codeql/rust/generated/BinaryOp.qll create mode 100644 rust/ql/lib/codeql/rust/generated/BindPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Block.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Box.qll create mode 100644 rust/ql/lib/codeql/rust/generated/BoxPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Break.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Call.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Cast.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Closure.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Const.qll create mode 100644 rust/ql/lib/codeql/rust/generated/ConstBlockPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Continue.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Expr.qll create mode 100644 rust/ql/lib/codeql/rust/generated/ExprStmt.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Field.qll create mode 100644 rust/ql/lib/codeql/rust/generated/If.qll create mode 100644 rust/ql/lib/codeql/rust/generated/IfLet.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Index.qll create mode 100644 rust/ql/lib/codeql/rust/generated/InlineAsm.qll create mode 100644 rust/ql/lib/codeql/rust/generated/ItemStmt.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Let.qll create mode 100644 rust/ql/lib/codeql/rust/generated/LitPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Literal.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Loop.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Match.qll create mode 100644 rust/ql/lib/codeql/rust/generated/MatchArm.qll create mode 100644 rust/ql/lib/codeql/rust/generated/MethodCall.qll create mode 100644 rust/ql/lib/codeql/rust/generated/MissingExpr.qll create mode 100644 rust/ql/lib/codeql/rust/generated/MissingPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/OffsetOf.qll create mode 100644 rust/ql/lib/codeql/rust/generated/OrPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Pat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Path.qll create mode 100644 rust/ql/lib/codeql/rust/generated/PathPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Range.qll create mode 100644 rust/ql/lib/codeql/rust/generated/RangePat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/RecordLit.qll create mode 100644 rust/ql/lib/codeql/rust/generated/RecordPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Ref.qll create mode 100644 rust/ql/lib/codeql/rust/generated/RefPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Return.qll create mode 100644 rust/ql/lib/codeql/rust/generated/SlicePat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Stmt.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Tuple.qll create mode 100644 rust/ql/lib/codeql/rust/generated/TuplePat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/TupleStructPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/TypeRef.qll create mode 100644 rust/ql/lib/codeql/rust/generated/UnaryExpr.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Underscore.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Unsafe.qll create mode 100644 rust/ql/lib/codeql/rust/generated/WildPat.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Yeet.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Yield.qll create mode 100644 rust/ql/test/extractor-tests/generated/Expr/MISSING_SOURCE.txt create mode 100644 rust/ql/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt create mode 100644 rust/ql/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt create mode 100644 rust/ql/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt diff --git a/rust/.generated.list b/rust/.generated.list index 3b67e2208121..de1101499f18 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -1,33 +1,199 @@ +ql/lib/codeql/rust/elements/Array.qll c33de8fd2c0acbf221441dd67b061d3ab169f0bf548c0c957884455a215fce5c c54c716551746afd895da187e3d03acbe481bdf1ca4461065555641480801c2d +ql/lib/codeql/rust/elements/ArrayConstructor.qll aba72e72a26013fe0c665870bbdc20903ff287d890cbcabc0dc62be32ace8422 6c539b9008c27646c5708f92e8691f41d752676045953516117eb3bb23e3f88c +ql/lib/codeql/rust/elements/Async.qll 96cb9c26e6b8b2b28686aeb3b0aa442c59d48f8a14e9ad838df3c846a2daae64 c55d9db2402f7a04692ed61a187d581231327b675af8ca7a4bd6467195ce4263 +ql/lib/codeql/rust/elements/AsyncConstructor.qll 27248231035b78fd8961003168a30b8b6e79102fe9d858bd9b94090a4d970317 23a8799e3ee39281c167a29dd835e220571af6419f907e3cee606863c51f333c +ql/lib/codeql/rust/elements/Await.qll b143784cf3a536d67bcddc6145fca944e34b5262975d1f13fc8922dda8cac39d bf8b3b173708b0dfcab5c84407e17d488ac1e94e285f6ee8723a71cae81eeea3 +ql/lib/codeql/rust/elements/AwaitConstructor.qll b34c0592c512ab38f7a7106b3416ba53dad650a801e1a3adb4afc1dadf56ed1e dfbf6ff965abe7791898e7fb026c997a22ac7af23fa84ab87b4f9f74b89c2a70 +ql/lib/codeql/rust/elements/Become.qll 57a2a0a42f03ff8ebf29e3829762bf49cdbd01666a51ff83437124b281ecb31b a4ff816fb6d93151ab9cd6ec51739c1f869bb740d87b522dca1917f13fab1978 +ql/lib/codeql/rust/elements/BecomeConstructor.qll 783ec64a9d8921d3613208eb4ad15acd9a227d1182e099d3aa15dd7a25030443 48e35b3c39532468101141af0ef324ad1d09cc263de8fa9e28d08e0e8d6d72c3 +ql/lib/codeql/rust/elements/BinaryOp.qll 5688f95eb9d6615e04fdb16654e5756ba0a250790d322247d59aaf2df7058d1c 66e403bfbfc4ad70be0a702e70d742daff1d98697711fdd19a2c54f9e2969ebc +ql/lib/codeql/rust/elements/BinaryOpConstructor.qll 4e9b81d972c3ce4cd38baa0bbb5a1bb5a4a6d135e189df43e041926ccf770efe 1ae5b9f5b8f9f31bfe4b4b2fc437f1673d721f4a278f3d7490497e59a6f99c3a +ql/lib/codeql/rust/elements/BindPat.qll f0209f781d8a14ab7fbb4b4d6a654469aecb0ff1a8ff4810f18a90f3b171e1c3 9734b7907855e46eeded6c3f59912a16212f7e8639fba35c740bb04462240287 +ql/lib/codeql/rust/elements/BindPatConstructor.qll 2bbcc296bcdcd945313d83294b90d327c51c9f1e96f92d37dd10bf0c32dfaf6a 612b4fc651f32129155727e866796edee8fff939614c6fd0b7baa1392930a38c +ql/lib/codeql/rust/elements/Block.qll 03adb9118a899bfdd3790d82426eb6ee3df83d03d6e0eceb5d05bc9b8f08c576 c65f594a7d576889ddb13b3ec16175e1ceb09e9f289a23e91708be6d728573bb +ql/lib/codeql/rust/elements/Box.qll 8fa74f14d72cb8613e9ddc4effc19054cb745c91582aa7a440d68f02b9c13b9c 1e196173be41e5059fc538c1cda01ccfea644425030584e2689c68abf7850935 +ql/lib/codeql/rust/elements/BoxConstructor.qll 9a76f8b87367812ac7be252d04802f09a97659869098391bcdd46e6da72840cc 8225e3743257dd1a927a7c6eabdfd082011e1124ffeb10e4020b52c41556fa12 +ql/lib/codeql/rust/elements/BoxPat.qll 1df08d5443c63e21d40d25023da58da50bd6cf6e156b9f5dbd6d41a3193faee9 9837752be4d4a1c3f16d6438bd361c596b6b983d9ae4e486083651e8f4e090ff +ql/lib/codeql/rust/elements/BoxPatConstructor.qll 20f79f18beb8b7eeec63b1e30302d9f2e514354a7b1ae077f240db3cda4ecc4c f41ca3fdafc70c6b972598a3af3434bf60687bc2f0252dd11ddd09ec874fe63c +ql/lib/codeql/rust/elements/Break.qll 39ddf63748d5df0fe2f36e88ed656007d8adcb94110ef513d5b6148e96b532ba f7a90bcf424db38bfbee9300e418a4a2e304822d882d1221da90e719bcf4d092 +ql/lib/codeql/rust/elements/BreakConstructor.qll 6642b7b9624dda02bfc9178d0f40cf8937d1cc1629621c526a0be50525ba5cc1 473d11dd648c355fbcc9603eae65501513be7f84e92bc06ae415c393b3d5b55e +ql/lib/codeql/rust/elements/Call.qll be1c6c66ec2076b7c11cd57caddca591ecea321b0053287182b7951c051646f3 fc2b36ee527f31e1fa00d92a5941a6f86f336356fce168b23ba6b3bb9e52fb1c +ql/lib/codeql/rust/elements/CallConstructor.qll d5a805a645829fa261619909bc80804a188f5e043dbc40a498fae7e3fac9891a 4e14e345ff5f253d09de6142c886a97420b37b12f7d92afcd011150b914322ba +ql/lib/codeql/rust/elements/Cast.qll 02093710cebd4ace265e1f1b84287be8bf15ea6390acf4e3c08a9727ef8d76bb 9c870b6e7ec202437041d374262377055db72d8fa3610cb4d39122f673e0ff3c +ql/lib/codeql/rust/elements/CastConstructor.qll f94723d4cc9197d10b706b6945ed2869b5f73d5b7e0d8487151624eb2a3ac345 2cc4f0dc93dce5a811bab3708d97686668bc04966490617e394277411bfc647f +ql/lib/codeql/rust/elements/Closure.qll 3ebb4e36aeced34c77370b103ec0a5748bebc85c70a706a1b46cf625e5e5de25 83d40cfff2569fc691d82daab08ff9fe1aa6b03ef3e3c38f0f61c11a2e531d9c +ql/lib/codeql/rust/elements/ClosureConstructor.qll d489970d2ab853e20cc50b0a2a68e36be2c376dfe37ae1099b0c4eb59d841107 2e0788d23c3c7a94d23bb568874bd8b99e8ac6bc5d294e4c2fec0cc54bb97229 +ql/lib/codeql/rust/elements/Const.qll 117efce95fd61f3845e6e378bb46246f3ead808031f435847f0c121aec236172 d6a626696985847950e8f904cf842b971b00ce2f4108f4b54716503825c292b8 +ql/lib/codeql/rust/elements/ConstBlockPat.qll af7f5f1a8de38266a12e92dee4a5ef5279baccf542cf2c52d982ed075d3bec27 1208223d97230a90d9377164b61454dcc6ca0f46a408e4a5ab2a82340bc92eb3 +ql/lib/codeql/rust/elements/ConstBlockPatConstructor.qll 04aa8b4f218ce87157f0d6b10c9c04660c34c90af1f121b1432402de2e5114cd 34e2fecbe91ea9ac1626bc27121a7d5abe99855e3f49bdca12a1969b42ac0ba5 +ql/lib/codeql/rust/elements/ConstConstructor.qll aa9cc5e0131c6c4ca0022d5cfc20783a0bd3a3e43d46f58b9951c2b22eaa071c 3af96dbdf939f0b170f7f46f71cf0ede2944e638a611c86b660630c86eaba29a +ql/lib/codeql/rust/elements/Continue.qll c4148199252ae1d13c572063d8f73d77d798b1cf3fcab16924e154e7a09aeb49 13f81945ea35613c910e933da800c6e80c3a75859092df185910483b8a5bfc1f +ql/lib/codeql/rust/elements/ContinueConstructor.qll 541a6ae2c3c2d4552e16368f6b94f6e74c58933c139fc775e2b123270bb63a1b dc99f93f41bf53a0d025a025bbf917b1fc3aae8908f9d2f9e243103b478e33fb ql/lib/codeql/rust/elements/DbFile.qll 056d363e1ba5ec08cacb2e90b8a7a3b47f52ded5dc2289edd4e85921fc50f37e 18e6926f77265a3a6319ca2f3bf3d529d17d46cebdd2ef6753357fdc53c22c70 ql/lib/codeql/rust/elements/DbFileConstructor.qll ea93dc49b23b1c6d800ab9d0b9cacfa9dc661bfdb04b9e6efcad2bdb050fb0ab f7a891b1786604eee57a784733555b677e2580770d51d18073b59e7ca65df1d4 ql/lib/codeql/rust/elements/DbLocation.qll 1f694594e8e4ab65a8781cd443ad4f864447ca88e2cb65504aee5a779393c84d 003ec72275406eb8f5ddd6ccc2b258fb7c906d4bb2c0ef1ba235f291624321ca ql/lib/codeql/rust/elements/DbLocationConstructor.qll 8848abace985818a5d3a6eddfc4cb200795970146d282b037b4f22ae6230b894 44dba880e17bb1072fa12451ccaae4830fd04dcc61f7403d35510309fde6906e ql/lib/codeql/rust/elements/Declaration.qll d4ec5c83728f1837243caf2f27d06fd05ecdd2ca440112accff99bfd37b45e5f c1cd9b297be8b69207e75d24b29949b9f71c78406ee0ffd38d0b0810288d6140 -ql/lib/codeql/rust/elements/Function.qll 220eb1d0e6b49e83b7674a9f505d3f529cf7f4d022ddca44fa6367e0d75daa0f d156cff59ecdcffc0d62041b801025b1aaedbc92d44efd107f93f6fd06c34a6d +ql/lib/codeql/rust/elements/Expr.qll a0c2cb3ff9628e5dd1a7900d2413390faa433dcef114bdc85279a3a2bf2fc4d8 a0e8e5693ead91b62da5531e070e11a2105ee49046cb69e63b8747eeafc27651 +ql/lib/codeql/rust/elements/ExprStmt.qll afe41d6d05ed9d94b3c8529dad743bdf3e2a0e68bed84a80da4dd6df0257451d c1f0c7c1a3c62baffb7d3bb69cc4bc828e6fbbbabe8f87342ec67d8744fcbe7e +ql/lib/codeql/rust/elements/ExprStmtConstructor.qll 28e37020abdfce5a8666b0c9a3147c339c7a90d9de527f97fc7d36df2bb921ba 5333db932a2edb791ec3c8f2c215f4c74e825a362f45ee901949d81e328bc7fd +ql/lib/codeql/rust/elements/Field.qll 598169fd695762b54dc71fe56400fd19e62f314a824f7f9cae3441f77c698f58 0da139a7acb789881022f55a59e0368818f9100dbf50dd38c5489d587e0fcdac +ql/lib/codeql/rust/elements/FieldConstructor.qll 3bf050aba1d6b17529500aa93e051139380fa918c175044ae39143db29929836 b589557f39a524e8565292453c50946d7f491b10f4e7ca5c187ee7829e73d595 ql/lib/codeql/rust/elements/FunctionConstructor.qll a9269b37182c0bf432f9b2b015691da5dbd64819b9bd25445af229d873014a91 69107a7503af14a51e091e6918094a4e9fc316a72de2e1514f001872ce0f2c0c -ql/lib/codeql/rust/elements/Locatable.qll dfc0235cf5aff0ec91d85375ac03998b0e6a69f3722b099330ab0a2161af988a bb1055f59ef7e95e89748765c79f1b5832aa18226f227e689a6801adfc6247ad -ql/lib/codeql/rust/elements/Location.qll 17a222ffe30ecfa252bfd2a5d6ef668f9579824b78d241d576c8c0112a9f93f0 9ae822cd9ce3c70824cccae500651f0cba70ad9c9195b611e7542cb928093b0b +ql/lib/codeql/rust/elements/If.qll 7fcb0fdded3431c2adcb5daa6b61c95ee8a4da563d73603b6f396a36d09e7fab e2507dd776ca911dadd792268e79a68ad7aac7203fabc28eac29ad6d8b864ea8 +ql/lib/codeql/rust/elements/IfConstructor.qll 31f1965a186b7c0e55bce6dc060b07fd9e67a7e1dece7444825ccad5c27940a0 8a542b21713f24a6de13e2513b89a6f442a83dbb04226d4ee2b9214159a8f94c +ql/lib/codeql/rust/elements/IfLet.qll 83a1d686ea6b99af775814ecad169ce0cded40d159ca4c3ad917e79607a6234f dd47bd70aa801f9a2cea84379a52c09e15f678c43abe33a2b6cbef3dd7eda43c +ql/lib/codeql/rust/elements/IfLetConstructor.qll cf99514825c25eca2126e3f855d06ef588cef93d6f131586e44083325477f1d7 c4e4082549bfd1885496f4d67a2d54012dd84b2a5a1461d76e8b025097cdd064 +ql/lib/codeql/rust/elements/Index.qll 0a2ec6ed6616eb3f9f85a2d63184ead503f20c8050e623079c5a1dc94f035300 4e91229765fedd5a66ba2e0968f7f1ffde36c7039d51d729a740cd304a52cfe1 +ql/lib/codeql/rust/elements/IndexConstructor.qll 518349246cb64d07f45a9be11061e6cba9da674a7406334d10422e992e02f928 a89aef36d63d09aa08074c4fc79ef046359f955faefd9b0141cdc60008b5ad71 +ql/lib/codeql/rust/elements/InlineAsm.qll 3ff6a13840a083ac39672aa694213b3740bc2c8654d489813c97c28abad8e991 6270b298f10ed3f9427cd7c0119e44f5441c7589322821578a6b236147929805 +ql/lib/codeql/rust/elements/InlineAsmConstructor.qll 3923d1b0d772e0686ce891e63c39b984fabbc9c2656f9177df1696e85eff12bf 3ce886c37495ee40eb9d12c2b4ee0222b34f3d9df5a23a47ea2e629c54c30a58 +ql/lib/codeql/rust/elements/ItemStmt.qll 70fc3f9df9794dc78199dfd81b8136701d4ca0c9b3c6e88ecec42f75fbc41f32 df122241e3868b1c376e2d2501328ad47020a0837826f165c7e54640bc018156 +ql/lib/codeql/rust/elements/ItemStmtConstructor.qll cd27051f73ab2897b1f7a725313f97d36507fc9f5e0dd7b2ad8bd1caaf8c42ad 67596c97386fbe6cb9e5e6abc45b674158f411d927297345cb25359587380bcd +ql/lib/codeql/rust/elements/Let.qll 2148dd54c4f109f1668b724d547ee4e4fe86820fa554a57f2806da102ec8d5cf 7a44c96aadba848b36d26325499d2011e3a1f2f3ee26f78b9202fc39130a6a57 +ql/lib/codeql/rust/elements/LetConstructor.qll c696cefd2d2c8e2a56e5df6e63cd5302833bf5bc1d16ff87666cd8a8b01eb7f0 8065946e2b996abbd58fef9f03ae30c98369367153acd8681a87422d07b36a68 +ql/lib/codeql/rust/elements/LitPat.qll 539b414883b0b86ff446fa81254f2c71f467e5ea0bda21dc3bd66cf3abf95b13 d54eeb618cfb8f0c4a48ce5ab1922fca2622f4a0c703760aa344028172f37642 +ql/lib/codeql/rust/elements/LitPatConstructor.qll 1a1c5f711b04bfc9b8b9a197564cc8acfeeaff1a9c8b30d57657747d84138fce 19cfa7386fd1f4ad8ba1ffe8b14bc547b9884dc98e731b6935afd11ceac6b5fe +ql/lib/codeql/rust/elements/Literal.qll 25eca7baf71894a8826493ee433897de3d47a82e897317239ae11ab1e850518d 413a56eed1703c4a07d900d9c7006e6770c6fe31b81711ddc00c0bd333f11d7c +ql/lib/codeql/rust/elements/LiteralConstructor.qll 6a80cc2175b6f7ceeedab2c06ca7f980ccbf64f6a7dda8c779fc92cecf91f7bc 177eee9c8214f2a776df18fc02754a6685f116aefe00d1444643eea954436739 +ql/lib/codeql/rust/elements/Loop.qll a5e490726c68cb8e5bee0a90891ed8e2018d8ff80dad7ff59233f7a425afea3a 8dddc6c579de9ed7932296b6aec6253764eff1c7155778abb9b74b6d591769df +ql/lib/codeql/rust/elements/LoopConstructor.qll feae830d063f25fab417bf9b2981406d5427a090552aaffe7f166a2e7eec4ce1 860a66865a473df5848d9591fcf0ebeab5a5a87653d27cde97e4f10ae004e3b7 +ql/lib/codeql/rust/elements/Match.qll c8eaabc6c02c3fd50c05d5067c10641c0fcdf8f838c98ada2b5a851c7da8bc6e d47cfc0ebd04474b59d0e918656662d6501cb928ff9af96621edae7f4ffef392 +ql/lib/codeql/rust/elements/MatchArm.qll f91def96700dd8521c11aef100f494d2d44777186e771b306ec9579b01c882af 021b298096cd88d3de81c2c012102e5b5ce5159d6dbca2bbd32b266593df335d +ql/lib/codeql/rust/elements/MatchArmConstructor.qll 49d134823a445a1ee995ebf5637fd0d736b9ab7f2b141026712f231ec4ed3389 f16e8adc8375e6a7334589d5732dcbe10f5ada9de7a12c549c55be3f028ec628 +ql/lib/codeql/rust/elements/MatchConstructor.qll 9d0fbd176257148010ca79fd496b0bf489838e02cdfddb30ee9156b573088f7a 3995df463f80e02c9d66e4fef652e3902c603b3dc7a94d71ebc42176616cb6fb +ql/lib/codeql/rust/elements/MethodCall.qll 213704bb1dfa3872331fffc27cb4c63b6c78614acc5865cc1aaae45479662670 f8dca58ac0db62e7fc4dc582efe8edc6112688878d7f5831c6986d0747c92c97 +ql/lib/codeql/rust/elements/MethodCallConstructor.qll 1a0db56c1c2503467a105e5727ad132b4ecc6b84ca9bdb457ef0dbfddac5b622 9c0b3e1fe997323b60d258f504b48228d62737c2f1aaed2b1a60c29a0f783fe8 +ql/lib/codeql/rust/elements/MissingExpr.qll 2158f064d027975e3faba6a858b8e469c324544ae0923319b149fd5ec6548448 500ef109ceb36f5da72040fc733c7e98f94920f51d53d90fff3d86f85da0aad3 +ql/lib/codeql/rust/elements/MissingExprConstructor.qll c51f4f6e897ef2107a27bd91ecf31ce875611b29a5a12238d5312b9489a35b8d b9ea3fdae459aba6c7ed9eb48edbc5bdbdb4cb41220fff81ed4cd256648612e0 +ql/lib/codeql/rust/elements/MissingPat.qll eacee2eaede4adb8452a41c14c95c310d0731c2c60fdb818b3e94e34f418aed4 9f81567e8e9c02be0994764a082a2135a6bec952456c2413295f2b0a16e5eb5d +ql/lib/codeql/rust/elements/MissingPatConstructor.qll 7bff2fb7fe96388dd703cca5f0bb1d04cea5d1f0729bb54c6604b58e338c7d6b eec9fea46593b3850da111658848cb54cfa9992286eeee313a55def184cf7ec5 ql/lib/codeql/rust/elements/Module.qll d8995b361cc672f86a314bd53bd3e4d1ddb26b6afde62eb7c380923810785af0 3c10180c812d89a8116ac6e32cbd4d7ac2f549c8a76d327ed75c764b09251d52 ql/lib/codeql/rust/elements/ModuleConstructor.qll 109ed8c1b5c61cc1d3e8613aa8bb8c168dc1943c93b5b622fa79665751b78318 601526c7f56578883d261d14653fdad08329f80fea71de14a5ac5ce671a8d436 -ql/lib/codeql/rust/elements/UnknownFile.qll 638ac1c5baef4ab8eb98ef4a37202334290001ca183dab769f729b61f9fc0aa9 fae24f8b29c3e5a124e6c71c9bcb0e2bf4bb033eaf3348fd2db3644ce2803b43 -ql/lib/codeql/rust/elements/UnknownLocation.qll eaadf1702e2f5df0c0917dd9e452a3ceb81e5c2d182675c32e988d826ac3fc71 9bf63fbd74c6114678189a62f63795156c0e5b9ad467c020f16842038e84a226 -ql/lib/codeql/rust/elements.qll 658d3d26ac2685a077714d41d83ac47f87b0df1c4f0cc7d099c96e06bd1f9d0e 658d3d26ac2685a077714d41d83ac47f87b0df1c4f0cc7d099c96e06bd1f9d0e +ql/lib/codeql/rust/elements/OffsetOf.qll b815be1155d34c3e74da871f275b78e5aadfb62ae6e3232529af3d0b30e385a9 d3a1709c7d0958ff8b90ce8327f5566228d6ff582f45c9f88daa0b47e937fab2 +ql/lib/codeql/rust/elements/OffsetOfConstructor.qll aa4bac3adf272e9f5f4d0f8ad63df3364dd1ed84aa8efebb60604e45baa3b3f0 30fdb49660f5bb838a3309e50a75c196b59dbee315a958ac991f669111205c1d +ql/lib/codeql/rust/elements/OrPat.qll 9b5cf68d55c57c262a5d630852ff2e842f0caa3aca2a0b4491d601340917db63 c965eb43675b135f3ce11c1e8762af0b764c6d4c262f002f8b9a512ae59e8a03 +ql/lib/codeql/rust/elements/OrPatConstructor.qll 9a24cc095adc55ae8ea66f68c695f42de0181a43e23d70e210c63351b47e2586 1f773ae88276289672d93708f4ae9f8c95199e7370a0c610a52c92b5e018e632 +ql/lib/codeql/rust/elements/Pat.qll 197aa86d5f317669e38230a20460b271c1d82e830b84150dac65afb67059fa2a ed3e8c74e42ffd5df14dd88711d79660982170a42f9a605704a274298dbbfc41 +ql/lib/codeql/rust/elements/Path.qll 05a168a83168638e07eb3d746adad7ecd952976dfed6fd85becc0fd491bf4b0f 8f38d2ae227dfd4fc7cedde3008dc66df57aa4ac1714c8d5105c9989b4e8b93e +ql/lib/codeql/rust/elements/PathConstructor.qll 97243db75d6337cf68a22ea68569fdddf4c3bc1b8875bb4bb66faeeba8846a53 03c8c665e2f3b103148fd38eb7a4d0459c8189b2f6160dc08ee1d6d2807e01b6 +ql/lib/codeql/rust/elements/PathPat.qll a49036bca0f3f023917fec3547876759987a34747e16b9a15ebb99c82ca9234c b4f77e6e29300f02cb845ab79d4a64edb654a398fe3d6c1a2306423e1c0a237b +ql/lib/codeql/rust/elements/PathPatConstructor.qll 476a38723c63bbfa2565946725c90f1224ac2c5283fde79bf14dcefce6f500ca e9e9b000cac44851772bd9ca519edc89e8518e89a0930df21af14a69f5b0e864 +ql/lib/codeql/rust/elements/Range.qll e9f66460c8a11b594298c00998ffd17ea39126e07a71319469174487e22f59bf b0df73a26c5f8decc1d95245fdefd823ec4c0c7642b93f518e77ad5055502dd4 +ql/lib/codeql/rust/elements/RangeConstructor.qll 4a0e4e782e6bfd1ef5377a27df6929b0d8cfb24d90a89cf8623f17cee74621fe a05eb96fdb5feff50be7c93575d32b15e62425bb347b0a8fbf1b8c18a535cb9a +ql/lib/codeql/rust/elements/RangePat.qll 02f3e4647932553481c4d8b1e2d2da3551662a17d75f26f2fb7e9d77ef1d579d e2546bc74035d03c92aa7beab2abca73a587049c95710eb9b59f916363df1552 +ql/lib/codeql/rust/elements/RangePatConstructor.qll c391431118ed6ce16f7b7126c5d43e61f07b98fab7b8bc48e9dfe22f7e21ed19 bbafe1c9595b0b004f7b27999a14df27d0710d5b058e7ab14dddd2fae058fc31 +ql/lib/codeql/rust/elements/RecordLit.qll 9c68193cebe8f709837b999e40a3af713e774c271a5a9195ad1fcdd8dbef4326 8e64bdd98a40f5724c3f7e43cad3c7522257fffe1e8c78da2068509ffe6719ee +ql/lib/codeql/rust/elements/RecordLitConstructor.qll 56b607c8777acb65d8061a835f818628b415d5b0258e1b5e5948106f6d95555e 64c99fc35ff4f8d8c8c980c1d5eb4e58e20dc4648beda1ed6b1b4180ef5ae887 +ql/lib/codeql/rust/elements/RecordPat.qll 50f4a2401dc579f3900188043d412ccdd6c57c1da6636c105221cfe243307d32 7812f0e10ce1a8e70c8c45d0c87e52539f6b29469157463456d06c566e86c2dd +ql/lib/codeql/rust/elements/RecordPatConstructor.qll 93c794efa5050b86c458470224de7f3206c1a004b46ef374780f080a8e9a4ce0 157800f342de96095e118dbcfa20f8e65cc79ccae712e8e37bff1ba92a227fda +ql/lib/codeql/rust/elements/Ref.qll ce21e04980cd53e453dbe79931418c8527102aab2e2bd3f26e1c7a15f355a0fc 8d5b16ee1ba8574035e75227b7d2b1799d9e19a77dba778845b174bb767ca40b +ql/lib/codeql/rust/elements/RefConstructor.qll bf669bb7392c120a8125913ee7ef3fe14436a753bff5e8697d4c336cfac0b491 0124097f1831f27b440293dd0fdb70b9d54a61f669b43bdd68e9e2937737dd02 +ql/lib/codeql/rust/elements/RefPat.qll 00b2c32e09a02b336d516b7812aa7ffe6202bd1dcdf4ec2060a74ee7a4b1c5c3 90a4b3da60aec10b5d56f6364d0a022c1d7db5fe8cbb65a78f55651d23f9abe7 +ql/lib/codeql/rust/elements/RefPatConstructor.qll 98497e0ef76bec0390a23aede2fc6f80050ad2d00bb60f1d473362111a53d4dd e4fde4e3e88c33daee90ab6d90ef2e38b36faedcfe1b6d6304f4eed92980b5b1 +ql/lib/codeql/rust/elements/Return.qll 60237f2c90a93c0df852eba89a635f0014ce072ec2acb80137a1da07a12e4b16 cc914eecc5d0522e81a41a1901bdf6f4c7535888bc104d9ac30bde243d12210e +ql/lib/codeql/rust/elements/ReturnConstructor.qll cdbbe70dab2be11453f1e98251ee7100d1a043f2d38b141615d3cdd53e3b62cf 8f3227e0eba7b06a9a19195b548807d87ce901a2d09fcaf23c89e53edf9f21a1 +ql/lib/codeql/rust/elements/SlicePat.qll 3e88657bd488dcb1ce2fa6f4bf72a9f76c7bfbf64b695070efa0ad89a6af407b ad60e3d0eee368c21c46acb439b599d8867c82193c7279777fea10f3205bd272 +ql/lib/codeql/rust/elements/SlicePatConstructor.qll b2885e663932f68ffecf87b4532f533e9177beddd715765474f454a9804afc8b ade153522a4773eb769f4f4d96fa07add34089f131b41a74534b28fbfd2bbb60 +ql/lib/codeql/rust/elements/Stmt.qll bbe8414d75bdcfda90f47b853a04fc618f4d0b6d6cd3b662bb15d3a9e5cc7bda 714c6f8eba9882363bf1594f48c75d1a885f6e93adadbdecbbd8169ce08f7b98 +ql/lib/codeql/rust/elements/Tuple.qll d7bddb240c9fe992d7940ee3e6cab0e1acdb2711be4776b07076ec7b9ba80dec 077792054a9e5d499f01f53ae919b428ada5ceaf4791192d1031ede774f84a75 +ql/lib/codeql/rust/elements/TupleConstructor.qll 93e9248e33e213275d0be9513b29311f2390c6b68ac5b726bcece115a396499a 4539aa935419b20dd1ecb0bf634f991a311eb972bce4d8397b7a35f645b20e81 +ql/lib/codeql/rust/elements/TuplePat.qll 17bad5b6a0be8e9b61addbd9a17bb387709147e8d2fb8a93ca9255a8a11bb822 7e84df64d0baf1b5329d47f4977fa5e8471fc323b2eeca8e942df93a48e04cbf +ql/lib/codeql/rust/elements/TuplePatConstructor.qll 505c4f440b47da576acd7e3fc69d6b49e8287f981a21e79919ded374200f2578 b295526303bcae982ddd8c6b544288c0b8b8d62984d6986319e7f17baeb7a19b +ql/lib/codeql/rust/elements/TupleStructPat.qll 50b7d89498dbe6737d97325037156c7689fd8d7e776d66fef9551f173fa3f2d6 f42edcf42be877424ecf2f11c90166a90f485249b24d73ed302294299d6a9bcd +ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll 15a15362572ac2dc98ed3257f195f20bb8dfe34a1fe203cf2a1a193ce16c406f 9e590b50cf865f6bc573b6fc17acea073f0d9389be241b01e820d9f3f8f14acb +ql/lib/codeql/rust/elements/TypeRef.qll 223844544eab3e07b6edda805c6344fa8b486aeea7bbe62e4b98e235ce2008d8 7517748b0e7a57c925168f5ce7a31ecc1b59f7521a2095578f599b8d9045a4e5 +ql/lib/codeql/rust/elements/TypeRefConstructor.qll f8b2e5ef15517890a8b2d56643f471ae64cc74c420187049e33b182417e72e4f 683611e732b842756e301a77625b385bca0c4969971020c9e11220a1aa665a29 +ql/lib/codeql/rust/elements/UnaryExpr.qll b996aedbb0cb7aa36ef403fd1b8a378d29f1d62c3cdaf89dbe2ec2c2baf6ff4b f24cd5740efbd75d3f79c0428a1401d089c0dd76af77ea0de45289150e3026d3 +ql/lib/codeql/rust/elements/UnaryExprConstructor.qll cad00e01caaf5c5e56457ba7f33fae7e72900ef695312af56525128605a0cc63 205f7e12f691f937f473094a0f0bcca4b0c36e7e2c88d9d1928e849b8e455356 +ql/lib/codeql/rust/elements/Underscore.qll a988d966016984c82ca1a22b86be751d3ee3da117b9333126cebe969e6cdc74b 81da73806731d80bd723bfa1c3c6be6ef0a0a906f49d2a20c52363e5ba39fafe +ql/lib/codeql/rust/elements/UnderscoreConstructor.qll 044463d55ca7d4cc1193b79fdc3140e33f68a1e3973a3d9262da4c49879999ac e024c4b988d5441dd032bdb0b521fed1074542e3e402e2fadae10bc9cab40aac +ql/lib/codeql/rust/elements/Unsafe.qll 49407b17db3b442a1365cc89db21bfcdb6b86bfbd03f9e0cf12281b77b319cda 7961b94982b7b7ad6356c13c057b822c89efb3e8830cb264534f761a09313666 +ql/lib/codeql/rust/elements/UnsafeConstructor.qll 5133f965cbf8fcfa3ae4d779f5c5a896e33939328d6613f0bcc359faa0c64097 c6ec48ba7cf32fc127845944a2692d7c2d2b34f3fd3284c5e78df5b313456d2f +ql/lib/codeql/rust/elements/WildPat.qll 9791bcd2b36516da82a81c10655fe6b4ef0f788d548cc99cb88578dd9c1278f0 03c192da4f92db637001854f904f5f0ea7406b74c02c1ce26cd375d9cfb26108 +ql/lib/codeql/rust/elements/WildPatConstructor.qll 538cde83119510e0b3fc9728127cbf980d17f7f4a9371b4572de26329ab08341 66b96aee3862d5c314a2fbcc6930258f755189c4359394b432e8edb13a9d0eaf +ql/lib/codeql/rust/elements/Yeet.qll 07f967352be486b7e2b787c292c16195a7084699cbdf23e2214574afc455261a 593cf9528a531ad140e69b3ea3a885a7a2780abe3ea0d8ec1ef0a9b36b0c013d +ql/lib/codeql/rust/elements/YeetConstructor.qll 835afa5ff4b4102335525c41d67380e59f272f95b4b7b0196e0475eae4b9f738 6c51946d661aea16d91010e0639b4ea8f3d161bd56a029e955dc7f7bca025c00 +ql/lib/codeql/rust/elements/Yield.qll 9a484b5b5c2c32ef61395213c376ce4b1ef7f699f08330d08faf071ea8919af1 e45fe09b794a2a05a1c125d112dfb36d9c7d538ff1953440d6c580cd8c987f8a +ql/lib/codeql/rust/elements/YieldConstructor.qll 16f393593cf9cf126f048c6f36eba7ca45e78c44577c7bda51c9a66bac95487e f49c9c3d4d17f64f44111bea2bb197cf8b11a0aa88b53b9a527c6aab4733c4b5 +ql/lib/codeql/rust/elements.qll 4aca3b30770f4e9b358af1e08727dad8a9e1faf652814741238c54967d2f9574 4aca3b30770f4e9b358af1e08727dad8a9e1faf652814741238c54967d2f9574 +ql/lib/codeql/rust/generated/Array.qll 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 +ql/lib/codeql/rust/generated/Async.qll 4e050ff6d9a61a821c4fc1220f783b86bcad9eb53bceb15cc947cc21e78ce9f8 4e050ff6d9a61a821c4fc1220f783b86bcad9eb53bceb15cc947cc21e78ce9f8 +ql/lib/codeql/rust/generated/Await.qll f5d65ee72d03205b95b9f507a4da5706f5c66d0da8b4a8a5d67bfae5643a4766 382ad8a5e1098ec697370cdf5453404128abd9d56a1e578e0255aa29d33fcf74 +ql/lib/codeql/rust/generated/Become.qll 7cfe61271eb91293014ebf16cd1029454705f4b569bba8afeec7d683f378efaf 9a31140d67ae8e77762aa2bd09ab018c88fe464a1b2205035e957d889abfe42a +ql/lib/codeql/rust/generated/BinaryOp.qll ec80f6cb6a0a03496814a629ecc8736f77c46e22a6c26b4e11fe1e650eb91441 67cd9c875556034a7afe78857c2d50d9ae1af084bee87e0d0c691c8baaaae72f +ql/lib/codeql/rust/generated/BindPat.qll 15d3a33c5f56f7659a331f72735f00930fddd6066659e54c5c19d5e7eb8ef078 bc0a916622b2c426b71760caf15b8e005eed276e06e04d04cc5f19f4c31c34f6 +ql/lib/codeql/rust/generated/Block.qll 5f769e5bf7484552e1cee031d7ba1ac8811e8d1e1a712d44fc28a3c2ec88a672 5d3da26a524cb8c79f190cc9c960c989752ea651055d7fc882de58ee9a05bf19 +ql/lib/codeql/rust/generated/Box.qll c64ff6a3e495d5729e091d275f04573ca820df2df1f42773dd04b0da0bf1d3d1 6d0778ae8347530f9ed5be9b24206f02d9437dd5265fdb308dfefce70f5d8829 +ql/lib/codeql/rust/generated/BoxPat.qll b69ba2bc341a1bf4c613279e45fb97a530619d4148d5ccc4f05436a316db29eb bf52730243bd1836d5890c745232aba50544c2046d00e80e7d22eebcd104f821 +ql/lib/codeql/rust/generated/Break.qll a1131a39a8b57398937b7e35108c83a92aabb284289acf5e8da1bbb9e603ae8d 4a2059cc94e028f080e984e485f1760c92ad2def6993ba68e023a2c9720ba00a +ql/lib/codeql/rust/generated/Call.qll b2dc0c89cc8ca855cf38b82b5bcbbf0fb5cce2b5dafbb3eb253accea89818908 13441bcc3f0f68595cea49c4af14165335e67ceb83d2546ab4c45a5d054c2923 +ql/lib/codeql/rust/generated/Cast.qll bfd3e61c0a7458adbed7d63bd5351ebdfcb11d42769fc2d34bafa6523f6e94ba e46d9a648e23a5e15e5c02d5d9666d827ef4732b7ac6b2edfc00d56cc239c845 +ql/lib/codeql/rust/generated/Closure.qll e6f93c79fe2a9a5f842b30d443d4abb64a72bf400102d2e2287e0a1885bfd0df 4659dfc3b325c44c82013c5e198144ad93dba9c1ee43a0efaa4b83262b7db7f4 +ql/lib/codeql/rust/generated/Const.qll a1c6725f1b7b2482dfd996d44ec695c63230c1c28ee00d9bf694dd3f01831323 a1c6725f1b7b2482dfd996d44ec695c63230c1c28ee00d9bf694dd3f01831323 +ql/lib/codeql/rust/generated/ConstBlockPat.qll d0818fe4cee066f1e6d3439c82122942ae62941e69da686b7d5c399e820c395c 2fae5a2f0457bb7106d52ac7457afb597d7ac9658b8dcff8e76294f5fe34019a +ql/lib/codeql/rust/generated/Continue.qll 73a86f272288f0383b8cb3a8f72e954447a343715d8d82b2b58729077295905f e5d6cc9c7b0c47f01b8a5f076cc5790e837ade852b485ac8c323c540b7e7cd23 ql/lib/codeql/rust/generated/DbFile.qll 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a ql/lib/codeql/rust/generated/DbLocation.qll 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 ql/lib/codeql/rust/generated/Declaration.qll 4487ac3f5ffa5b92e8628bc04b51e818d4ea1c9a333375cf1b729428d36a4ee7 6481d5e2d99a548f857213a283da75d45db8b3adac949e90fd5d17ceb5e22b54 ql/lib/codeql/rust/generated/Element.qll 21567fa7348dccdf69dd34e73cb6de7cc9c7e0f3f7bb419a1abd787f7dc851a1 21567fa7348dccdf69dd34e73cb6de7cc9c7e0f3f7bb419a1abd787f7dc851a1 +ql/lib/codeql/rust/generated/Expr.qll 67ed928bc76950917f86e0099c8eb3a57cbd2fc1d2ba5f84a57b4f580e3e553c 3082181dec8f2dbe6d3b858bf8e48bd2d99868d4962be83802d01f7c67cdb9f3 +ql/lib/codeql/rust/generated/ExprStmt.qll 1aba8c482a307f27612317b4d895ac59389e23ff905b6061931fced12ff7c3d1 c4e42a8863cfe4e83eddcd82236da2dbb1fc7bbdf12cab63d39fd1df4b1cb013 +ql/lib/codeql/rust/generated/Field.qll c3249b8dd1aed1978077875fbd6090327d431af8cf8888b432cacfa33b76f976 0977ff2fd039f4d6a82ce209d7a7d60a0747a1a3a29be69cf3f136f76429c917 ql/lib/codeql/rust/generated/File.qll 2eff5c882d044d2e360fe6382fb55e5a45f6ccb9df323cfa1fae41eae9d2a47f 87e7a906b3a1b4de056952e288ddd7f69fa7cb1bd9dc7dd3972868a9002ac1e4 -ql/lib/codeql/rust/generated/Function.qll 6429619a284cadaf64d74ab408f57a399c7e5df2ad182bd38f77b580879d9e33 8c4cfa4f23b5ed461f0f8aa40c5833a953fc9ba3f99584f0f05cf7d7d6a9b617 +ql/lib/codeql/rust/generated/Function.qll 8d5607035adebdb5f1a80ac2688b57ca751bfc010295e4982e6a432d402fc523 337d5aebc38e4413b8a87af87ea91219a51a46d1a04dd8f124b6431dba034a67 +ql/lib/codeql/rust/generated/If.qll 617ac0b7cb00683423245bd16d8e9bcd3c606215fe64afaabab8a5288c6f31e3 7d056c81ef17304acfba52e5bfb2589e8f2231e8524c712d68a7f461a78c3d19 +ql/lib/codeql/rust/generated/IfLet.qll 0f51d1f708282a622d075e635698b2020b7d21e77abad6ea12516af13edb5d06 1b9f9c058c888f77a225025b984145a886928caaad26f20e869d9f8a0f5843b4 +ql/lib/codeql/rust/generated/Index.qll f1b78db475006a0779a079f9600987932e638bcfaf35ce4e9b2b872798e35d50 7fa2b22497c3bd80161f7e3ef5477c82a0d4f961dce557ed3fd1a62d9f9328f7 +ql/lib/codeql/rust/generated/InlineAsm.qll f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 +ql/lib/codeql/rust/generated/ItemStmt.qll b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa +ql/lib/codeql/rust/generated/Let.qll 2cdec11bcb64d8c5c9db9ff3c8fff41fc4e5e705c0ff4327ae053ff10579fb6d c7e1742274635ded0088acdfe8cbc9e9d967f27e833ac8a1a37e3a06d207f004 +ql/lib/codeql/rust/generated/LitPat.qll 92c3c0f32ab9d5b08e246231e5465fe18536dee99351f73e158048bb007baf8a 6736a7824e5bdb0cc16de1231bdb5169d2f48251d5917bf2c31a36422b0bf2fd +ql/lib/codeql/rust/generated/Literal.qll eba217bbd4917c3674406c9538a0114d77d04f23467c4a362898a3020cb7d999 eba217bbd4917c3674406c9538a0114d77d04f23467c4a362898a3020cb7d999 ql/lib/codeql/rust/generated/Locatable.qll 9e9685bba50ad2220701f3465e63af9331f7f9dc548ad906ff954fc2ce0a4400 78c89b2cc78a357d682ab65310dd474603071f07c1eaaab07711714ce17549f2 ql/lib/codeql/rust/generated/Location.qll bce4c72988ec6fedd1439c60a37c45aa6147c962904709ef9f12206937174be4 d57000571771a2d997c50d9a43ef1c2f075960f847effa0e80ea91fd4c6b4d6c +ql/lib/codeql/rust/generated/Loop.qll e310e7e885374a653a2c3e6b86783b4a5dd71db72cf5f208785c17ea3f90737e 99c52a112d56f8e44a987159122091f46ba9a22b71456e8ba109369ff58db931 +ql/lib/codeql/rust/generated/Match.qll e0dd9a39cfcb5cd56efd89c3c009a62ff39c887511ba2962dfeed978830b5000 7378a8a30d7bde2a06a23e7037bddbd64d656ec047ba18142d22086cc7d7da32 +ql/lib/codeql/rust/generated/MatchArm.qll c0aaeab8f7d405de821095686b8065daf4ad600da97658b087203716671bee93 670d2b879eae365204966b4e904f57c76098ce9b9f9d784e4b63a5bad9e9931e +ql/lib/codeql/rust/generated/MethodCall.qll 1d7afd5e8795b89f3cd20569fe7e0b7fd339aa178ed6ecb2a3a9cadd1a49eede 7a6396ce629a46db16de523fd39e2bb2c56837df80990ff1dd3bdfe242c20761 +ql/lib/codeql/rust/generated/MissingExpr.qll 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 +ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 -ql/lib/codeql/rust/generated/ParentChild.qll b44f149bff05a96ee16c88883f06d5d2c159a89423ec32b00765da6964af029e 1d13e54fbc27d9cc29405a21c2f4a63043cbb7aade317184f440a17d3f5645c4 +ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 +ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 +ql/lib/codeql/rust/generated/ParentChild.qll 231b3332f96ddd4ebe180c069267ca58d935f193f1437432ae3fc2e136f16800 6b7810b3e296a4dbf899c4d5da2c80dd66d8d7665bef8ec75a6f2dbc00917c3e +ql/lib/codeql/rust/generated/Pat.qll 0334fff3df2bd0ea6f25c150c79ac462b35095b14e6f5208f947b9759b2396fc f02694d64b29637eaa5c7ef04ec0d1fddc01c85d38f0df6f2fb82ebcdc458923 +ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 +ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 -ql/lib/codeql/rust/generated/Raw.qll 921cb1afb5c1c3177acb557151755d4f97e7c65f656c5069d6f095b0e078074f a25fdad01e70bbab2d2663b152a4a5844677edcf0a0af2ec93c42dc3248ac9b2 -ql/lib/codeql/rust/generated/Synth.qll d278de9c2d06cb7549cd8f2e10ed186827a2ceab6ff46725ca76e78e7fecac72 acacd9afc5ca4a288e037a43375d933c3ba3cd8d08ef122b31695e74be260eb2 -ql/lib/codeql/rust/generated/SynthConstructors.qll 35b36df0c4fff05bcbd4ed10b1e6fa2e58fe8d8c818e7805111044825788fc01 35b36df0c4fff05bcbd4ed10b1e6fa2e58fe8d8c818e7805111044825788fc01 +ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 +ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 +ql/lib/codeql/rust/generated/Raw.qll 119ace38b931d203b0728441c813f662715b24a0abf0faff06e6fe52b9b24cf8 828ac11f4660cf126969472ff2a4224acb00869db169f259abe26bb23a825898 +ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 +ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 +ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd +ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb50a9f2bf62e49bf182d64b6d 804efbd32869f92e5515d34852fed6416288f99b0aab95b5be5cb5bdd1eea806 +ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511 +ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533 +ql/lib/codeql/rust/generated/Stmt.qll 6eb11dfb08004f762c3825d3433b6981b011ab906092d38764102bfde70a94ba 07d2fa92c4b5f14a08d80391ce74eacf89045097451498d0902800ba19328f65 +ql/lib/codeql/rust/generated/Synth.qll 58bde7feae55a29e10d47a2acc0a76c531b754096bc84d43b57b6763000d210c a363d9a61182e011370ea03de2e22ca5991da5f0a963d21ef17dee8df72104cc +ql/lib/codeql/rust/generated/SynthConstructors.qll e6bc351d69b548ba047c02415d1919c448cebe2d55578499f64d5ac87fbc246a e6bc351d69b548ba047c02415d1919c448cebe2d55578499f64d5ac87fbc246a +ql/lib/codeql/rust/generated/Tuple.qll 3fde94f0c23c6af6bcb58d0245a3cd0a8bbd6ef7999fbeed805baf2615e6226d c1aa7fc201aebb34dc6cd7760e817032b86fd16b8facac450c74deda860bc821 +ql/lib/codeql/rust/generated/TuplePat.qll fdb2c66fe6291106fe125de6a91c4d74b2c715d276c2fee9751d0523b618d095 330098460ccac28479a2b522048d6f1191bf01b40b3eceef4adf722c01c8360b +ql/lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 +ql/lib/codeql/rust/generated/TypeRef.qll d9c43cb829076091f06aa23ff2151e1d832ea355d5fcfdff732796299b14811d d9c43cb829076091f06aa23ff2151e1d832ea355d5fcfdff732796299b14811d +ql/lib/codeql/rust/generated/UnaryExpr.qll c9756e03ea83bb17250528f896e29c05d105534637353cd383d0de2e2e52b764 98bfc8e1c675e975181edf43816971647176bc5d12f7d1cfb642f8f741fead07 +ql/lib/codeql/rust/generated/Underscore.qll d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d ql/lib/codeql/rust/generated/UnknownFile.qll ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ql/lib/codeql/rust/generated/UnknownLocation.qll a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf +ql/lib/codeql/rust/generated/Unsafe.qll 3688228843b32ff905f1fdc462213bdfe3449d572388b85114d2e59fba099b4c 3688228843b32ff905f1fdc462213bdfe3449d572388b85114d2e59fba099b4c +ql/lib/codeql/rust/generated/WildPat.qll 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 +ql/lib/codeql/rust/generated/Yeet.qll 41b05d32a1b93cee770d6706cc044efe8ce57f11ae2f009c59666264cd1aaec1 8a6c8a1ae59e5a7e1b64abea85f6362c0460cbd5fcace1520b213ef5e08331ef +ql/lib/codeql/rust/generated/Yield.qll afefea932d770b61b633feeaa05973943c2bb45ea3cd4f960a0be1bbce33a405 c975fba823b05ad40b3c1bd908880e65511b59f9e6882fa207009194a45134a0 +ql/test/extractor-tests/generated/Expr/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e ql/test/extractor-tests/generated/File/File.ql dec43be882fad904fab0c6447ca93633d801cb08ff8bec309befde7d2b9e5dda 74e1f1d698558c35fa03935cc34f4c8145d376b56d7657b18aeb338f5ca752cf -ql/test/extractor-tests/generated/Function/Function.ql ae5d44a85047d50d8fbd3b62290c6935f061f07076b0070998173957e54eb43f 3e7fb6fb82463b96577394213915d8deae5332acdec2fcc07aa3eb8560420edd +ql/test/extractor-tests/generated/Function/Function.ql c49434420dbb6fc3d9e6294161dcd3d3b306fae5ba5c85b610e534b8b15ef74c fe02208b673b74eebed92b5cbb3a8a06c31c0681eb28f3e596515663f14fa9e2 ql/test/extractor-tests/generated/Module/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e +ql/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e +ql/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e +ql/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e diff --git a/rust/.gitattributes b/rust/.gitattributes index b7f99adb7d58..aeb7bf93c363 100644 --- a/rust/.gitattributes +++ b/rust/.gitattributes @@ -1,35 +1,201 @@ /.generated.list linguist-generated /.gitattributes linguist-generated +/ql/lib/codeql/rust/elements/Array.qll linguist-generated +/ql/lib/codeql/rust/elements/ArrayConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Async.qll linguist-generated +/ql/lib/codeql/rust/elements/AsyncConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Await.qll linguist-generated +/ql/lib/codeql/rust/elements/AwaitConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Become.qll linguist-generated +/ql/lib/codeql/rust/elements/BecomeConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/BinaryOp.qll linguist-generated +/ql/lib/codeql/rust/elements/BinaryOpConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/BindPat.qll linguist-generated +/ql/lib/codeql/rust/elements/BindPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Block.qll linguist-generated +/ql/lib/codeql/rust/elements/Box.qll linguist-generated +/ql/lib/codeql/rust/elements/BoxConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/BoxPat.qll linguist-generated +/ql/lib/codeql/rust/elements/BoxPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Break.qll linguist-generated +/ql/lib/codeql/rust/elements/BreakConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Call.qll linguist-generated +/ql/lib/codeql/rust/elements/CallConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Cast.qll linguist-generated +/ql/lib/codeql/rust/elements/CastConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Closure.qll linguist-generated +/ql/lib/codeql/rust/elements/ClosureConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Const.qll linguist-generated +/ql/lib/codeql/rust/elements/ConstBlockPat.qll linguist-generated +/ql/lib/codeql/rust/elements/ConstBlockPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/ConstConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Continue.qll linguist-generated +/ql/lib/codeql/rust/elements/ContinueConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/DbFile.qll linguist-generated /ql/lib/codeql/rust/elements/DbFileConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/DbLocation.qll linguist-generated /ql/lib/codeql/rust/elements/DbLocationConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Declaration.qll linguist-generated -/ql/lib/codeql/rust/elements/Function.qll linguist-generated +/ql/lib/codeql/rust/elements/Expr.qll linguist-generated +/ql/lib/codeql/rust/elements/ExprStmt.qll linguist-generated +/ql/lib/codeql/rust/elements/ExprStmtConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Field.qll linguist-generated +/ql/lib/codeql/rust/elements/FieldConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/FunctionConstructor.qll linguist-generated -/ql/lib/codeql/rust/elements/Locatable.qll linguist-generated -/ql/lib/codeql/rust/elements/Location.qll linguist-generated +/ql/lib/codeql/rust/elements/If.qll linguist-generated +/ql/lib/codeql/rust/elements/IfConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/IfLet.qll linguist-generated +/ql/lib/codeql/rust/elements/IfLetConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Index.qll linguist-generated +/ql/lib/codeql/rust/elements/IndexConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/InlineAsm.qll linguist-generated +/ql/lib/codeql/rust/elements/InlineAsmConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/ItemStmt.qll linguist-generated +/ql/lib/codeql/rust/elements/ItemStmtConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Let.qll linguist-generated +/ql/lib/codeql/rust/elements/LetConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/LitPat.qll linguist-generated +/ql/lib/codeql/rust/elements/LitPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Literal.qll linguist-generated +/ql/lib/codeql/rust/elements/LiteralConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Loop.qll linguist-generated +/ql/lib/codeql/rust/elements/LoopConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Match.qll linguist-generated +/ql/lib/codeql/rust/elements/MatchArm.qll linguist-generated +/ql/lib/codeql/rust/elements/MatchArmConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/MatchConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/MethodCall.qll linguist-generated +/ql/lib/codeql/rust/elements/MethodCallConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/MissingExpr.qll linguist-generated +/ql/lib/codeql/rust/elements/MissingExprConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/MissingPat.qll linguist-generated +/ql/lib/codeql/rust/elements/MissingPatConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Module.qll linguist-generated /ql/lib/codeql/rust/elements/ModuleConstructor.qll linguist-generated -/ql/lib/codeql/rust/elements/UnknownFile.qll linguist-generated -/ql/lib/codeql/rust/elements/UnknownLocation.qll linguist-generated +/ql/lib/codeql/rust/elements/OffsetOf.qll linguist-generated +/ql/lib/codeql/rust/elements/OffsetOfConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/OrPat.qll linguist-generated +/ql/lib/codeql/rust/elements/OrPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Pat.qll linguist-generated +/ql/lib/codeql/rust/elements/Path.qll linguist-generated +/ql/lib/codeql/rust/elements/PathConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/PathPat.qll linguist-generated +/ql/lib/codeql/rust/elements/PathPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Range.qll linguist-generated +/ql/lib/codeql/rust/elements/RangeConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/RangePat.qll linguist-generated +/ql/lib/codeql/rust/elements/RangePatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/RecordLit.qll linguist-generated +/ql/lib/codeql/rust/elements/RecordLitConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/RecordPat.qll linguist-generated +/ql/lib/codeql/rust/elements/RecordPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Ref.qll linguist-generated +/ql/lib/codeql/rust/elements/RefConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/RefPat.qll linguist-generated +/ql/lib/codeql/rust/elements/RefPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Return.qll linguist-generated +/ql/lib/codeql/rust/elements/ReturnConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/SlicePat.qll linguist-generated +/ql/lib/codeql/rust/elements/SlicePatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Stmt.qll linguist-generated +/ql/lib/codeql/rust/elements/Tuple.qll linguist-generated +/ql/lib/codeql/rust/elements/TupleConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/TuplePat.qll linguist-generated +/ql/lib/codeql/rust/elements/TuplePatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/TupleStructPat.qll linguist-generated +/ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/TypeRef.qll linguist-generated +/ql/lib/codeql/rust/elements/TypeRefConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/UnaryExpr.qll linguist-generated +/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Underscore.qll linguist-generated +/ql/lib/codeql/rust/elements/UnderscoreConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Unsafe.qll linguist-generated +/ql/lib/codeql/rust/elements/UnsafeConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/WildPat.qll linguist-generated +/ql/lib/codeql/rust/elements/WildPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Yeet.qll linguist-generated +/ql/lib/codeql/rust/elements/YeetConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Yield.qll linguist-generated +/ql/lib/codeql/rust/elements/YieldConstructor.qll linguist-generated /ql/lib/codeql/rust/elements.qll linguist-generated +/ql/lib/codeql/rust/generated/Array.qll linguist-generated +/ql/lib/codeql/rust/generated/Async.qll linguist-generated +/ql/lib/codeql/rust/generated/Await.qll linguist-generated +/ql/lib/codeql/rust/generated/Become.qll linguist-generated +/ql/lib/codeql/rust/generated/BinaryOp.qll linguist-generated +/ql/lib/codeql/rust/generated/BindPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Block.qll linguist-generated +/ql/lib/codeql/rust/generated/Box.qll linguist-generated +/ql/lib/codeql/rust/generated/BoxPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Break.qll linguist-generated +/ql/lib/codeql/rust/generated/Call.qll linguist-generated +/ql/lib/codeql/rust/generated/Cast.qll linguist-generated +/ql/lib/codeql/rust/generated/Closure.qll linguist-generated +/ql/lib/codeql/rust/generated/Const.qll linguist-generated +/ql/lib/codeql/rust/generated/ConstBlockPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Continue.qll linguist-generated /ql/lib/codeql/rust/generated/DbFile.qll linguist-generated /ql/lib/codeql/rust/generated/DbLocation.qll linguist-generated /ql/lib/codeql/rust/generated/Declaration.qll linguist-generated /ql/lib/codeql/rust/generated/Element.qll linguist-generated +/ql/lib/codeql/rust/generated/Expr.qll linguist-generated +/ql/lib/codeql/rust/generated/ExprStmt.qll linguist-generated +/ql/lib/codeql/rust/generated/Field.qll linguist-generated /ql/lib/codeql/rust/generated/File.qll linguist-generated /ql/lib/codeql/rust/generated/Function.qll linguist-generated +/ql/lib/codeql/rust/generated/If.qll linguist-generated +/ql/lib/codeql/rust/generated/IfLet.qll linguist-generated +/ql/lib/codeql/rust/generated/Index.qll linguist-generated +/ql/lib/codeql/rust/generated/InlineAsm.qll linguist-generated +/ql/lib/codeql/rust/generated/ItemStmt.qll linguist-generated +/ql/lib/codeql/rust/generated/Let.qll linguist-generated +/ql/lib/codeql/rust/generated/LitPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Literal.qll linguist-generated /ql/lib/codeql/rust/generated/Locatable.qll linguist-generated /ql/lib/codeql/rust/generated/Location.qll linguist-generated +/ql/lib/codeql/rust/generated/Loop.qll linguist-generated +/ql/lib/codeql/rust/generated/Match.qll linguist-generated +/ql/lib/codeql/rust/generated/MatchArm.qll linguist-generated +/ql/lib/codeql/rust/generated/MethodCall.qll linguist-generated +/ql/lib/codeql/rust/generated/MissingExpr.qll linguist-generated +/ql/lib/codeql/rust/generated/MissingPat.qll linguist-generated /ql/lib/codeql/rust/generated/Module.qll linguist-generated +/ql/lib/codeql/rust/generated/OffsetOf.qll linguist-generated +/ql/lib/codeql/rust/generated/OrPat.qll linguist-generated /ql/lib/codeql/rust/generated/ParentChild.qll linguist-generated +/ql/lib/codeql/rust/generated/Pat.qll linguist-generated +/ql/lib/codeql/rust/generated/Path.qll linguist-generated +/ql/lib/codeql/rust/generated/PathPat.qll linguist-generated /ql/lib/codeql/rust/generated/PureSynthConstructors.qll linguist-generated +/ql/lib/codeql/rust/generated/Range.qll linguist-generated +/ql/lib/codeql/rust/generated/RangePat.qll linguist-generated /ql/lib/codeql/rust/generated/Raw.qll linguist-generated +/ql/lib/codeql/rust/generated/RecordLit.qll linguist-generated +/ql/lib/codeql/rust/generated/RecordPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Ref.qll linguist-generated +/ql/lib/codeql/rust/generated/RefPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Return.qll linguist-generated +/ql/lib/codeql/rust/generated/SlicePat.qll linguist-generated +/ql/lib/codeql/rust/generated/Stmt.qll linguist-generated /ql/lib/codeql/rust/generated/Synth.qll linguist-generated /ql/lib/codeql/rust/generated/SynthConstructors.qll linguist-generated +/ql/lib/codeql/rust/generated/Tuple.qll linguist-generated +/ql/lib/codeql/rust/generated/TuplePat.qll linguist-generated +/ql/lib/codeql/rust/generated/TupleStructPat.qll linguist-generated +/ql/lib/codeql/rust/generated/TypeRef.qll linguist-generated +/ql/lib/codeql/rust/generated/UnaryExpr.qll linguist-generated +/ql/lib/codeql/rust/generated/Underscore.qll linguist-generated /ql/lib/codeql/rust/generated/UnknownFile.qll linguist-generated /ql/lib/codeql/rust/generated/UnknownLocation.qll linguist-generated +/ql/lib/codeql/rust/generated/Unsafe.qll linguist-generated +/ql/lib/codeql/rust/generated/WildPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Yeet.qll linguist-generated +/ql/lib/codeql/rust/generated/Yield.qll linguist-generated +/ql/test/extractor-tests/generated/Expr/MISSING_SOURCE.txt linguist-generated /ql/test/extractor-tests/generated/File/File.ql linguist-generated /ql/test/extractor-tests/generated/Function/Function.ql linguist-generated /ql/test/extractor-tests/generated/Module/MISSING_SOURCE.txt linguist-generated +/ql/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt linguist-generated +/ql/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt linguist-generated +/ql/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt linguist-generated diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index c0c7f9ddee89..93705e171e37 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -41,20 +41,903 @@ impl TrapEntry for DbLocation { } } +#[derive(Debug)] +pub struct MatchArm { + pub id: TrapId, + pub location: Option, + pub pat: trap::Label, + pub guard: Option, + pub expr: trap::Label, +} + +impl TrapEntry for MatchArm { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("match_arms", vec![trap::Arg::Label(id), self.pat.into(), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.guard { + out.add_tuple("match_arm_guards", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct TypeRef { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for TypeRef { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("type_refs", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Array { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for Array { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("arrays", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Await { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, +} + +impl TrapEntry for Await { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("awaits", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Become { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, +} + +impl TrapEntry for Become { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("becomes", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct BinaryOp { + pub id: TrapId, + pub location: Option, + pub lhs: trap::Label, + pub rhs: trap::Label, + pub op: Option, +} + +impl TrapEntry for BinaryOp { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("binary_ops", vec![trap::Arg::Label(id), self.lhs.into(), self.rhs.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.op { + out.add_tuple("binary_op_ops", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct BindPat { + pub id: TrapId, + pub location: Option, + pub binding_id: String, + pub subpat: Option, +} + +impl TrapEntry for BindPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("bind_pats", vec![trap::Arg::Label(id), self.binding_id.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.subpat { + out.add_tuple("bind_pat_subpats", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Box { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, +} + +impl TrapEntry for Box { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("boxes", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct BoxPat { + pub id: TrapId, + pub location: Option, + pub inner: trap::Label, +} + +impl TrapEntry for BoxPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("box_pats", vec![trap::Arg::Label(id), self.inner.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Break { + pub id: TrapId, + pub location: Option, + pub expr: Option, + pub label: Option, +} + +impl TrapEntry for Break { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("breaks", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.expr { + out.add_tuple("break_exprs", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.label { + out.add_tuple("break_labels", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Call { + pub id: TrapId, + pub location: Option, + pub callee: trap::Label, + pub args: Vec, + pub is_assignee_expr: bool, +} + +impl TrapEntry for Call { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("calls", vec![trap::Arg::Label(id), self.callee.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.args.iter().enumerate() { + out.add_tuple("call_args", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if self.is_assignee_expr { + out.add_tuple("call_is_assignee_expr", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct Cast { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, + pub type_ref: trap::Label, +} + +impl TrapEntry for Cast { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("casts", vec![trap::Arg::Label(id), self.expr.into(), self.type_ref.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Closure { + pub id: TrapId, + pub location: Option, + pub args: Vec, + pub arg_types: Vec, + pub ret_type: Option, + pub body: trap::Label, + pub is_move: bool, +} + +impl TrapEntry for Closure { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("closures", vec![trap::Arg::Label(id), self.body.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.args.iter().enumerate() { + out.add_tuple("closure_args", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + for (i, &v) in self.arg_types.iter().enumerate() { + out.add_tuple("closure_arg_types", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if let Some(v) = self.ret_type { + out.add_tuple("closure_ret_types", vec![trap::Arg::Label(id), v.into()]); + } + if self.is_move { + out.add_tuple("closure_is_move", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct Const { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for Const { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("consts", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct ConstBlockPat { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, +} + +impl TrapEntry for ConstBlockPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("const_block_pats", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Continue { + pub id: TrapId, + pub location: Option, + pub label: Option, +} + +impl TrapEntry for Continue { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("continues", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.label { + out.add_tuple("continue_labels", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct ExprStmt { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, + pub has_semi: bool, +} + +impl TrapEntry for ExprStmt { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("expr_stmts", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if self.has_semi { + out.add_tuple("expr_stmt_has_semi", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct Field { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, + pub name: String, +} + +impl TrapEntry for Field { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("fields", vec![trap::Arg::Label(id), self.expr.into(), self.name.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + #[derive(Debug)] pub struct Function { pub id: TrapId, pub location: Option, - pub name: String, + pub name: String, + pub body: trap::Label, +} + +impl TrapEntry for Function { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("functions", vec![trap::Arg::Label(id), self.name.into(), self.body.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct If { + pub id: TrapId, + pub location: Option, + pub condition: trap::Label, + pub then_branch: trap::Label, + pub else_branch: Option, +} + +impl TrapEntry for If { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("ifs", vec![trap::Arg::Label(id), self.condition.into(), self.then_branch.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.else_branch { + out.add_tuple("if_else_branches", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct IfLet { + pub id: TrapId, + pub location: Option, + pub pat: trap::Label, + pub type_ref: Option, + pub initializer: Option, + pub else_branch: Option, +} + +impl TrapEntry for IfLet { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("if_lets", vec![trap::Arg::Label(id), self.pat.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.type_ref { + out.add_tuple("if_let_type_refs", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.initializer { + out.add_tuple("if_let_initializers", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.else_branch { + out.add_tuple("if_let_else_branches", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Index { + pub id: TrapId, + pub location: Option, + pub base: trap::Label, + pub index: trap::Label, + pub is_assignee_expr: bool, +} + +impl TrapEntry for Index { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("indices", vec![trap::Arg::Label(id), self.base.into(), self.index.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if self.is_assignee_expr { + out.add_tuple("index_is_assignee_expr", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct InlineAsm { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for InlineAsm { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("inline_asms", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct ItemStmt { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for ItemStmt { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("item_stmts", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Let { + pub id: TrapId, + pub location: Option, + pub pat: trap::Label, + pub expr: trap::Label, +} + +impl TrapEntry for Let { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("lets", vec![trap::Arg::Label(id), self.pat.into(), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct LitPat { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, +} + +impl TrapEntry for LitPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("lit_pats", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Literal { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for Literal { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("literals", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Loop { + pub id: TrapId, + pub location: Option, + pub body: trap::Label, + pub label: Option, +} + +impl TrapEntry for Loop { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("loops", vec![trap::Arg::Label(id), self.body.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.label { + out.add_tuple("loop_labels", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Match { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, + pub branches: Vec, +} + +impl TrapEntry for Match { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("matches", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.branches.iter().enumerate() { + out.add_tuple("match_branches", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct MethodCall { + pub id: TrapId, + pub location: Option, + pub receiver: trap::Label, + pub method_name: String, + pub args: Vec, +} + +impl TrapEntry for MethodCall { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("method_calls", vec![trap::Arg::Label(id), self.receiver.into(), self.method_name.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.args.iter().enumerate() { + out.add_tuple("method_call_args", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct MissingExpr { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for MissingExpr { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("missing_exprs", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct MissingPat { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for MissingPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("missing_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Module { + pub id: TrapId, + pub location: Option, + pub declarations: Vec, +} + +impl TrapEntry for Module { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("modules", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.declarations.iter().enumerate() { + out.add_tuple("module_declarations", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct OffsetOf { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for OffsetOf { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("offset_ofs", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct OrPat { + pub id: TrapId, + pub location: Option, + pub args: Vec, +} + +impl TrapEntry for OrPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("or_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.args.iter().enumerate() { + out.add_tuple("or_pat_args", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Path { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for Path { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("paths", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct PathPat { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for PathPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("path_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Range { + pub id: TrapId, + pub location: Option, + pub lhs: Option, + pub rhs: Option, + pub is_inclusive: bool, +} + +impl TrapEntry for Range { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("ranges", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.lhs { + out.add_tuple("range_lhs", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.rhs { + out.add_tuple("range_rhs", vec![trap::Arg::Label(id), v.into()]); + } + if self.is_inclusive { + out.add_tuple("range_is_inclusive", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct RangePat { + pub id: TrapId, + pub location: Option, + pub start: Option, + pub end: Option, +} + +impl TrapEntry for RangePat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("range_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.start { + out.add_tuple("range_pat_starts", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.end { + out.add_tuple("range_pat_ends", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct RecordLit { + pub id: TrapId, + pub location: Option, } -impl TrapEntry for Function { +impl TrapEntry for RecordLit { fn extract_id(&mut self) -> TrapId { std::mem::replace(&mut self.id, TrapId::Star) } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("functions", vec![trap::Arg::Label(id), self.name.into()]); + out.add_tuple("record_lits", vec![trap::Arg::Label(id)]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } @@ -62,24 +945,358 @@ impl TrapEntry for Function { } #[derive(Debug)] -pub struct Module { +pub struct RecordPat { pub id: TrapId, pub location: Option, - pub declarations: Vec, } -impl TrapEntry for Module { +impl TrapEntry for RecordPat { fn extract_id(&mut self) -> TrapId { std::mem::replace(&mut self.id, TrapId::Star) } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("modules", vec![trap::Arg::Label(id)]); + out.add_tuple("record_pats", vec![trap::Arg::Label(id)]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.declarations.iter().enumerate() { - out.add_tuple("module_declarations", vec![trap::Arg::Label(id), i.into(), v.into()]); + } +} + +#[derive(Debug)] +pub struct Ref { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, + pub is_raw: bool, + pub is_mut: bool, +} + +impl TrapEntry for Ref { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("refs", vec![trap::Arg::Label(id), self.expr.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if self.is_raw { + out.add_tuple("ref_is_raw", vec![trap::Arg::Label(id)]); + } + if self.is_mut { + out.add_tuple("ref_is_mut", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct RefPat { + pub id: TrapId, + pub location: Option, + pub pat: trap::Label, + pub is_mut: bool, +} + +impl TrapEntry for RefPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("ref_pats", vec![trap::Arg::Label(id), self.pat.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if self.is_mut { + out.add_tuple("ref_pat_is_mut", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct Return { + pub id: TrapId, + pub location: Option, + pub expr: Option, +} + +impl TrapEntry for Return { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("returns", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.expr { + out.add_tuple("return_exprs", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct SlicePat { + pub id: TrapId, + pub location: Option, + pub prefix: Vec, +} + +impl TrapEntry for SlicePat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("slice_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.prefix.iter().enumerate() { + out.add_tuple("slice_pat_prefixes", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Tuple { + pub id: TrapId, + pub location: Option, + pub exprs: Vec, + pub is_assignee_expr: bool, +} + +impl TrapEntry for Tuple { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("tuples", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.exprs.iter().enumerate() { + out.add_tuple("tuple_exprs", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if self.is_assignee_expr { + out.add_tuple("tuple_is_assignee_expr", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct TuplePat { + pub id: TrapId, + pub location: Option, + pub args: Vec, + pub ellipsis: Option, +} + +impl TrapEntry for TuplePat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("tuple_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.args.iter().enumerate() { + out.add_tuple("tuple_pat_args", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if let Some(v) = self.ellipsis { + out.add_tuple("tuple_pat_ellipses", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct TupleStructPat { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for TupleStructPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("tuple_struct_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct UnaryExpr { + pub id: TrapId, + pub location: Option, + pub expr: trap::Label, + pub op: String, +} + +impl TrapEntry for UnaryExpr { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("unary_exprs", vec![trap::Arg::Label(id), self.expr.into(), self.op.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Underscore { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for Underscore { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("underscores", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct WildPat { + pub id: TrapId, + pub location: Option, +} + +impl TrapEntry for WildPat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("wild_pats", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Yeet { + pub id: TrapId, + pub location: Option, + pub expr: Option, +} + +impl TrapEntry for Yeet { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("yeets", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.expr { + out.add_tuple("yeet_exprs", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Yield { + pub id: TrapId, + pub location: Option, + pub expr: Option, +} + +impl TrapEntry for Yield { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("yields", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.expr { + out.add_tuple("yield_exprs", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Async { + pub id: TrapId, + pub location: Option, + pub statements: Vec, + pub tail: Option, + pub label: Option, +} + +impl TrapEntry for Async { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("asyncs", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.statements.iter().enumerate() { + out.add_tuple("block_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if let Some(v) = self.tail { + out.add_tuple("block_tails", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.label { + out.add_tuple("block_labels", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Unsafe { + pub id: TrapId, + pub location: Option, + pub statements: Vec, + pub tail: Option, + pub label: Option, +} + +impl TrapEntry for Unsafe { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("unsaves", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.statements.iter().enumerate() { + out.add_tuple("block_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if let Some(v) = self.tail { + out.add_tuple("block_tails", vec![trap::Arg::Label(id), v.into()]); + } + if let Some(v) = self.label { + out.add_tuple("block_labels", vec![trap::Arg::Label(id), v.into()]); } } } diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index 8752dbe0fb5f..8b7d6dfb04a3 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -3,14 +3,71 @@ * This module exports all modules providing `Element` subclasses. */ +import codeql.rust.elements.Array +import codeql.rust.elements.Async +import codeql.rust.elements.Await +import codeql.rust.elements.Become +import codeql.rust.elements.BinaryOp +import codeql.rust.elements.BindPat +import codeql.rust.elements.Block +import codeql.rust.elements.Box +import codeql.rust.elements.BoxPat +import codeql.rust.elements.Break +import codeql.rust.elements.Call +import codeql.rust.elements.Cast +import codeql.rust.elements.Closure +import codeql.rust.elements.Const +import codeql.rust.elements.ConstBlockPat +import codeql.rust.elements.Continue import codeql.rust.elements.DbFile import codeql.rust.elements.DbLocation import codeql.rust.elements.Declaration import codeql.rust.elements.Element +import codeql.rust.elements.Expr +import codeql.rust.elements.ExprStmt +import codeql.rust.elements.Field import codeql.rust.elements.File import codeql.rust.elements.Function +import codeql.rust.elements.If +import codeql.rust.elements.IfLet +import codeql.rust.elements.Index +import codeql.rust.elements.InlineAsm +import codeql.rust.elements.ItemStmt +import codeql.rust.elements.Let +import codeql.rust.elements.LitPat +import codeql.rust.elements.Literal import codeql.rust.elements.Locatable import codeql.rust.elements.Location +import codeql.rust.elements.Loop +import codeql.rust.elements.Match +import codeql.rust.elements.MatchArm +import codeql.rust.elements.MethodCall +import codeql.rust.elements.MissingExpr +import codeql.rust.elements.MissingPat import codeql.rust.elements.Module +import codeql.rust.elements.OffsetOf +import codeql.rust.elements.OrPat +import codeql.rust.elements.Pat +import codeql.rust.elements.Path +import codeql.rust.elements.PathPat +import codeql.rust.elements.Range +import codeql.rust.elements.RangePat +import codeql.rust.elements.RecordLit +import codeql.rust.elements.RecordPat +import codeql.rust.elements.Ref +import codeql.rust.elements.RefPat +import codeql.rust.elements.Return +import codeql.rust.elements.SlicePat +import codeql.rust.elements.Stmt +import codeql.rust.elements.Tuple +import codeql.rust.elements.TuplePat +import codeql.rust.elements.TupleStructPat +import codeql.rust.elements.TypeRef +import codeql.rust.elements.UnaryExpr +import codeql.rust.elements.Underscore import codeql.rust.elements.UnknownFile import codeql.rust.elements.UnknownLocation +import codeql.rust.elements.Unsafe +import codeql.rust.elements.WildPat +import codeql.rust.elements.Yeet +import codeql.rust.elements.Yield diff --git a/rust/ql/lib/codeql/rust/elements/Array.qll b/rust/ql/lib/codeql/rust/elements/Array.qll new file mode 100644 index 000000000000..f0febef868f0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Array.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Array`. + */ + +private import codeql.rust.generated.Array + +class Array extends Generated::Array { } diff --git a/rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll b/rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll new file mode 100644 index 000000000000..9264e5d1c813 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Array` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Array` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructArray(Raw::Array id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Async.qll b/rust/ql/lib/codeql/rust/elements/Async.qll new file mode 100644 index 000000000000..dc24a0419013 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Async.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Async`. + */ + +private import codeql.rust.generated.Async + +class Async extends Generated::Async { } diff --git a/rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll b/rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll new file mode 100644 index 000000000000..0f4ad56a6366 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Async` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Async` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructAsync(Raw::Async id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Await.qll b/rust/ql/lib/codeql/rust/elements/Await.qll new file mode 100644 index 000000000000..d73b4a435da4 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Await.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Await`. + */ + +private import codeql.rust.generated.Await + +class Await extends Generated::Await { } diff --git a/rust/ql/lib/codeql/rust/elements/AwaitConstructor.qll b/rust/ql/lib/codeql/rust/elements/AwaitConstructor.qll new file mode 100644 index 000000000000..c159b5bbd483 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/AwaitConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Await` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Await` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructAwait(Raw::Await id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Become.qll b/rust/ql/lib/codeql/rust/elements/Become.qll new file mode 100644 index 000000000000..2e6f32a2bc7f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Become.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Become`. + */ + +private import codeql.rust.generated.Become + +class Become extends Generated::Become { } diff --git a/rust/ql/lib/codeql/rust/elements/BecomeConstructor.qll b/rust/ql/lib/codeql/rust/elements/BecomeConstructor.qll new file mode 100644 index 000000000000..054e98e2fca3 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BecomeConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Become` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Become` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBecome(Raw::Become id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/BinaryOp.qll b/rust/ql/lib/codeql/rust/elements/BinaryOp.qll new file mode 100644 index 000000000000..9d5e7e9a300a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BinaryOp.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `BinaryOp`. + */ + +private import codeql.rust.generated.BinaryOp + +class BinaryOp extends Generated::BinaryOp { } diff --git a/rust/ql/lib/codeql/rust/elements/BinaryOpConstructor.qll b/rust/ql/lib/codeql/rust/elements/BinaryOpConstructor.qll new file mode 100644 index 000000000000..9e73d35a4f84 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BinaryOpConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `BinaryOp` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `BinaryOp` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBinaryOp(Raw::BinaryOp id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/BindPat.qll b/rust/ql/lib/codeql/rust/elements/BindPat.qll new file mode 100644 index 000000000000..eb0d2b00448e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BindPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `BindPat`. + */ + +private import codeql.rust.generated.BindPat + +class BindPat extends Generated::BindPat { } diff --git a/rust/ql/lib/codeql/rust/elements/BindPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/BindPatConstructor.qll new file mode 100644 index 000000000000..80445356bf0d --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BindPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `BindPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `BindPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBindPat(Raw::BindPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Block.qll b/rust/ql/lib/codeql/rust/elements/Block.qll new file mode 100644 index 000000000000..0b92810f2566 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Block.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Block`. + */ + +private import codeql.rust.generated.Block + +class Block extends Generated::Block { } diff --git a/rust/ql/lib/codeql/rust/elements/Box.qll b/rust/ql/lib/codeql/rust/elements/Box.qll new file mode 100644 index 000000000000..ced9e7e85bc8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Box.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Box`. + */ + +private import codeql.rust.generated.Box + +class Box extends Generated::Box { } diff --git a/rust/ql/lib/codeql/rust/elements/BoxConstructor.qll b/rust/ql/lib/codeql/rust/elements/BoxConstructor.qll new file mode 100644 index 000000000000..f2a5f73f6e19 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BoxConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Box` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Box` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBox(Raw::Box id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/BoxPat.qll b/rust/ql/lib/codeql/rust/elements/BoxPat.qll new file mode 100644 index 000000000000..e2b1d9b7e779 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BoxPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `BoxPat`. + */ + +private import codeql.rust.generated.BoxPat + +class BoxPat extends Generated::BoxPat { } diff --git a/rust/ql/lib/codeql/rust/elements/BoxPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/BoxPatConstructor.qll new file mode 100644 index 000000000000..bcabb8c51660 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BoxPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `BoxPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `BoxPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBoxPat(Raw::BoxPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Break.qll b/rust/ql/lib/codeql/rust/elements/Break.qll new file mode 100644 index 000000000000..eafa7efa76b4 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Break.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Break`. + */ + +private import codeql.rust.generated.Break + +class Break extends Generated::Break { } diff --git a/rust/ql/lib/codeql/rust/elements/BreakConstructor.qll b/rust/ql/lib/codeql/rust/elements/BreakConstructor.qll new file mode 100644 index 000000000000..c18373c526e3 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BreakConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Break` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Break` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBreak(Raw::Break id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Call.qll b/rust/ql/lib/codeql/rust/elements/Call.qll new file mode 100644 index 000000000000..1e9d1d2d7482 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Call.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Call`. + */ + +private import codeql.rust.generated.Call + +class Call extends Generated::Call { } diff --git a/rust/ql/lib/codeql/rust/elements/CallConstructor.qll b/rust/ql/lib/codeql/rust/elements/CallConstructor.qll new file mode 100644 index 000000000000..b2b467a9fa39 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/CallConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Call` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Call` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructCall(Raw::Call id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Cast.qll b/rust/ql/lib/codeql/rust/elements/Cast.qll new file mode 100644 index 000000000000..32f5146fb011 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Cast.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Cast`. + */ + +private import codeql.rust.generated.Cast + +class Cast extends Generated::Cast { } diff --git a/rust/ql/lib/codeql/rust/elements/CastConstructor.qll b/rust/ql/lib/codeql/rust/elements/CastConstructor.qll new file mode 100644 index 000000000000..a14ae1116d7a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/CastConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Cast` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Cast` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructCast(Raw::Cast id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Closure.qll b/rust/ql/lib/codeql/rust/elements/Closure.qll new file mode 100644 index 000000000000..b1269c641550 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Closure.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Closure`. + */ + +private import codeql.rust.generated.Closure + +class Closure extends Generated::Closure { } diff --git a/rust/ql/lib/codeql/rust/elements/ClosureConstructor.qll b/rust/ql/lib/codeql/rust/elements/ClosureConstructor.qll new file mode 100644 index 000000000000..d2ade710b79e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ClosureConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Closure` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Closure` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructClosure(Raw::Closure id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Const.qll b/rust/ql/lib/codeql/rust/elements/Const.qll new file mode 100644 index 000000000000..7d795f150fd1 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Const.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Const`. + */ + +private import codeql.rust.generated.Const + +class Const extends Generated::Const { } diff --git a/rust/ql/lib/codeql/rust/elements/ConstBlockPat.qll b/rust/ql/lib/codeql/rust/elements/ConstBlockPat.qll new file mode 100644 index 000000000000..80b48ac034e8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ConstBlockPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `ConstBlockPat`. + */ + +private import codeql.rust.generated.ConstBlockPat + +class ConstBlockPat extends Generated::ConstBlockPat { } diff --git a/rust/ql/lib/codeql/rust/elements/ConstBlockPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/ConstBlockPatConstructor.qll new file mode 100644 index 000000000000..84bbb6d598ec --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ConstBlockPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `ConstBlockPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `ConstBlockPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructConstBlockPat(Raw::ConstBlockPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/ConstConstructor.qll b/rust/ql/lib/codeql/rust/elements/ConstConstructor.qll new file mode 100644 index 000000000000..a19c5d55f66d --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ConstConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Const` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Const` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructConst(Raw::Const id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Continue.qll b/rust/ql/lib/codeql/rust/elements/Continue.qll new file mode 100644 index 000000000000..1a45995a7f3f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Continue.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Continue`. + */ + +private import codeql.rust.generated.Continue + +class Continue extends Generated::Continue { } diff --git a/rust/ql/lib/codeql/rust/elements/ContinueConstructor.qll b/rust/ql/lib/codeql/rust/elements/ContinueConstructor.qll new file mode 100644 index 000000000000..7b897aae7570 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ContinueConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Continue` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Continue` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructContinue(Raw::Continue id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Expr.qll b/rust/ql/lib/codeql/rust/elements/Expr.qll new file mode 100644 index 000000000000..40a7beac2499 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Expr.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Expr`. + */ + +private import codeql.rust.generated.Expr + +class Expr extends Generated::Expr { } diff --git a/rust/ql/lib/codeql/rust/elements/ExprStmt.qll b/rust/ql/lib/codeql/rust/elements/ExprStmt.qll new file mode 100644 index 000000000000..0ec9cdbc813d --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ExprStmt.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `ExprStmt`. + */ + +private import codeql.rust.generated.ExprStmt + +class ExprStmt extends Generated::ExprStmt { } diff --git a/rust/ql/lib/codeql/rust/elements/ExprStmtConstructor.qll b/rust/ql/lib/codeql/rust/elements/ExprStmtConstructor.qll new file mode 100644 index 000000000000..5493b1ccad4a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ExprStmtConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `ExprStmt` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `ExprStmt` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructExprStmt(Raw::ExprStmt id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Field.qll b/rust/ql/lib/codeql/rust/elements/Field.qll new file mode 100644 index 000000000000..2950c59dccaf --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Field.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Field`. + */ + +private import codeql.rust.generated.Field + +class Field extends Generated::Field { } diff --git a/rust/ql/lib/codeql/rust/elements/FieldConstructor.qll b/rust/ql/lib/codeql/rust/elements/FieldConstructor.qll new file mode 100644 index 000000000000..dd2d7a586393 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/FieldConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Field` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Field` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructField(Raw::Field id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/If.qll b/rust/ql/lib/codeql/rust/elements/If.qll new file mode 100644 index 000000000000..70f1a88c4332 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/If.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `If`. + */ + +private import codeql.rust.generated.If + +class If extends Generated::If { } diff --git a/rust/ql/lib/codeql/rust/elements/IfConstructor.qll b/rust/ql/lib/codeql/rust/elements/IfConstructor.qll new file mode 100644 index 000000000000..f4ef468606e8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/IfConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `If` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `If` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructIf(Raw::If id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/IfLet.qll b/rust/ql/lib/codeql/rust/elements/IfLet.qll new file mode 100644 index 000000000000..405674194c3a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/IfLet.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `IfLet`. + */ + +private import codeql.rust.generated.IfLet + +class IfLet extends Generated::IfLet { } diff --git a/rust/ql/lib/codeql/rust/elements/IfLetConstructor.qll b/rust/ql/lib/codeql/rust/elements/IfLetConstructor.qll new file mode 100644 index 000000000000..aaf10af4b87b --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/IfLetConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `IfLet` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `IfLet` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructIfLet(Raw::IfLet id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Index.qll b/rust/ql/lib/codeql/rust/elements/Index.qll new file mode 100644 index 000000000000..4da546568429 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Index.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Index`. + */ + +private import codeql.rust.generated.Index + +class Index extends Generated::Index { } diff --git a/rust/ql/lib/codeql/rust/elements/IndexConstructor.qll b/rust/ql/lib/codeql/rust/elements/IndexConstructor.qll new file mode 100644 index 000000000000..d6f1343f05b8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/IndexConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Index` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Index` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructIndex(Raw::Index id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/InlineAsm.qll b/rust/ql/lib/codeql/rust/elements/InlineAsm.qll new file mode 100644 index 000000000000..a9733356c226 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/InlineAsm.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `InlineAsm`. + */ + +private import codeql.rust.generated.InlineAsm + +class InlineAsm extends Generated::InlineAsm { } diff --git a/rust/ql/lib/codeql/rust/elements/InlineAsmConstructor.qll b/rust/ql/lib/codeql/rust/elements/InlineAsmConstructor.qll new file mode 100644 index 000000000000..67473caf862f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/InlineAsmConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `InlineAsm` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `InlineAsm` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructInlineAsm(Raw::InlineAsm id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/ItemStmt.qll b/rust/ql/lib/codeql/rust/elements/ItemStmt.qll new file mode 100644 index 000000000000..de2a1b22f758 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ItemStmt.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `ItemStmt`. + */ + +private import codeql.rust.generated.ItemStmt + +class ItemStmt extends Generated::ItemStmt { } diff --git a/rust/ql/lib/codeql/rust/elements/ItemStmtConstructor.qll b/rust/ql/lib/codeql/rust/elements/ItemStmtConstructor.qll new file mode 100644 index 000000000000..1efff36b8040 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ItemStmtConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `ItemStmt` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `ItemStmt` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructItemStmt(Raw::ItemStmt id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Let.qll b/rust/ql/lib/codeql/rust/elements/Let.qll new file mode 100644 index 000000000000..935028028c5e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Let.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Let`. + */ + +private import codeql.rust.generated.Let + +class Let extends Generated::Let { } diff --git a/rust/ql/lib/codeql/rust/elements/LetConstructor.qll b/rust/ql/lib/codeql/rust/elements/LetConstructor.qll new file mode 100644 index 000000000000..2cb4e27082b8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/LetConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Let` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Let` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructLet(Raw::Let id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/LitPat.qll b/rust/ql/lib/codeql/rust/elements/LitPat.qll new file mode 100644 index 000000000000..0e8ac98c70d0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/LitPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `LitPat`. + */ + +private import codeql.rust.generated.LitPat + +class LitPat extends Generated::LitPat { } diff --git a/rust/ql/lib/codeql/rust/elements/LitPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/LitPatConstructor.qll new file mode 100644 index 000000000000..a72498ba0978 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/LitPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `LitPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `LitPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructLitPat(Raw::LitPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Literal.qll b/rust/ql/lib/codeql/rust/elements/Literal.qll new file mode 100644 index 000000000000..2c7ec9356e0f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Literal.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Literal`. + */ + +private import codeql.rust.generated.Literal + +class Literal extends Generated::Literal { } diff --git a/rust/ql/lib/codeql/rust/elements/LiteralConstructor.qll b/rust/ql/lib/codeql/rust/elements/LiteralConstructor.qll new file mode 100644 index 000000000000..fb21ea5b9f6e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/LiteralConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Literal` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Literal` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructLiteral(Raw::Literal id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Loop.qll b/rust/ql/lib/codeql/rust/elements/Loop.qll new file mode 100644 index 000000000000..4cc347a9e4d5 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Loop.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Loop`. + */ + +private import codeql.rust.generated.Loop + +class Loop extends Generated::Loop { } diff --git a/rust/ql/lib/codeql/rust/elements/LoopConstructor.qll b/rust/ql/lib/codeql/rust/elements/LoopConstructor.qll new file mode 100644 index 000000000000..e49faeec74ec --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/LoopConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Loop` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Loop` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructLoop(Raw::Loop id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Match.qll b/rust/ql/lib/codeql/rust/elements/Match.qll new file mode 100644 index 000000000000..3c3b9613e62a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Match.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Match`. + */ + +private import codeql.rust.generated.Match + +class Match extends Generated::Match { } diff --git a/rust/ql/lib/codeql/rust/elements/MatchArm.qll b/rust/ql/lib/codeql/rust/elements/MatchArm.qll new file mode 100644 index 000000000000..914d70d35583 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MatchArm.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `MatchArm`. + */ + +private import codeql.rust.generated.MatchArm + +class MatchArm extends Generated::MatchArm { } diff --git a/rust/ql/lib/codeql/rust/elements/MatchArmConstructor.qll b/rust/ql/lib/codeql/rust/elements/MatchArmConstructor.qll new file mode 100644 index 000000000000..3319e55fcd67 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MatchArmConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `MatchArm` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `MatchArm` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructMatchArm(Raw::MatchArm id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/MatchConstructor.qll b/rust/ql/lib/codeql/rust/elements/MatchConstructor.qll new file mode 100644 index 000000000000..a657a86a71cc --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MatchConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Match` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Match` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructMatch(Raw::Match id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/MethodCall.qll b/rust/ql/lib/codeql/rust/elements/MethodCall.qll new file mode 100644 index 000000000000..93d6dbcac739 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MethodCall.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `MethodCall`. + */ + +private import codeql.rust.generated.MethodCall + +class MethodCall extends Generated::MethodCall { } diff --git a/rust/ql/lib/codeql/rust/elements/MethodCallConstructor.qll b/rust/ql/lib/codeql/rust/elements/MethodCallConstructor.qll new file mode 100644 index 000000000000..d7d19970e3ed --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MethodCallConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `MethodCall` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `MethodCall` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructMethodCall(Raw::MethodCall id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/MissingExpr.qll b/rust/ql/lib/codeql/rust/elements/MissingExpr.qll new file mode 100644 index 000000000000..3ee2f3a6e4e8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MissingExpr.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `MissingExpr`. + */ + +private import codeql.rust.generated.MissingExpr + +class MissingExpr extends Generated::MissingExpr { } diff --git a/rust/ql/lib/codeql/rust/elements/MissingExprConstructor.qll b/rust/ql/lib/codeql/rust/elements/MissingExprConstructor.qll new file mode 100644 index 000000000000..0cf8e7ff97ee --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MissingExprConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `MissingExpr` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `MissingExpr` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructMissingExpr(Raw::MissingExpr id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/MissingPat.qll b/rust/ql/lib/codeql/rust/elements/MissingPat.qll new file mode 100644 index 000000000000..88db4cdc7794 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MissingPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `MissingPat`. + */ + +private import codeql.rust.generated.MissingPat + +class MissingPat extends Generated::MissingPat { } diff --git a/rust/ql/lib/codeql/rust/elements/MissingPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/MissingPatConstructor.qll new file mode 100644 index 000000000000..6c6ed58ec27d --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/MissingPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `MissingPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `MissingPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructMissingPat(Raw::MissingPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/OffsetOf.qll b/rust/ql/lib/codeql/rust/elements/OffsetOf.qll new file mode 100644 index 000000000000..cb93f39fc86c --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/OffsetOf.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `OffsetOf`. + */ + +private import codeql.rust.generated.OffsetOf + +class OffsetOf extends Generated::OffsetOf { } diff --git a/rust/ql/lib/codeql/rust/elements/OffsetOfConstructor.qll b/rust/ql/lib/codeql/rust/elements/OffsetOfConstructor.qll new file mode 100644 index 000000000000..dc6381d740bb --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/OffsetOfConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `OffsetOf` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `OffsetOf` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructOffsetOf(Raw::OffsetOf id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/OrPat.qll b/rust/ql/lib/codeql/rust/elements/OrPat.qll new file mode 100644 index 000000000000..797060365a4e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/OrPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `OrPat`. + */ + +private import codeql.rust.generated.OrPat + +class OrPat extends Generated::OrPat { } diff --git a/rust/ql/lib/codeql/rust/elements/OrPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/OrPatConstructor.qll new file mode 100644 index 000000000000..1bb95e89cbdf --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/OrPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `OrPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `OrPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructOrPat(Raw::OrPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Pat.qll b/rust/ql/lib/codeql/rust/elements/Pat.qll new file mode 100644 index 000000000000..7e3c032c05b5 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Pat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Pat`. + */ + +private import codeql.rust.generated.Pat + +class Pat extends Generated::Pat { } diff --git a/rust/ql/lib/codeql/rust/elements/Path.qll b/rust/ql/lib/codeql/rust/elements/Path.qll new file mode 100644 index 000000000000..b73e16bc8b13 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Path.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Path`. + */ + +private import codeql.rust.generated.Path + +class Path extends Generated::Path { } diff --git a/rust/ql/lib/codeql/rust/elements/PathConstructor.qll b/rust/ql/lib/codeql/rust/elements/PathConstructor.qll new file mode 100644 index 000000000000..ed195d2554b0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/PathConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Path` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Path` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructPath(Raw::Path id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/PathPat.qll b/rust/ql/lib/codeql/rust/elements/PathPat.qll new file mode 100644 index 000000000000..92d794c658a7 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/PathPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `PathPat`. + */ + +private import codeql.rust.generated.PathPat + +class PathPat extends Generated::PathPat { } diff --git a/rust/ql/lib/codeql/rust/elements/PathPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/PathPatConstructor.qll new file mode 100644 index 000000000000..6d5d2f566277 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/PathPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `PathPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `PathPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructPathPat(Raw::PathPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Range.qll b/rust/ql/lib/codeql/rust/elements/Range.qll new file mode 100644 index 000000000000..52e4a8b6b997 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Range.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Range`. + */ + +private import codeql.rust.generated.Range + +class Range extends Generated::Range { } diff --git a/rust/ql/lib/codeql/rust/elements/RangeConstructor.qll b/rust/ql/lib/codeql/rust/elements/RangeConstructor.qll new file mode 100644 index 000000000000..0c735f605d7f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RangeConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Range` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Range` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructRange(Raw::Range id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/RangePat.qll b/rust/ql/lib/codeql/rust/elements/RangePat.qll new file mode 100644 index 000000000000..eeae9c8aec8b --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RangePat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `RangePat`. + */ + +private import codeql.rust.generated.RangePat + +class RangePat extends Generated::RangePat { } diff --git a/rust/ql/lib/codeql/rust/elements/RangePatConstructor.qll b/rust/ql/lib/codeql/rust/elements/RangePatConstructor.qll new file mode 100644 index 000000000000..8b21ef73b3c4 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RangePatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `RangePat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `RangePat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructRangePat(Raw::RangePat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/RecordLit.qll b/rust/ql/lib/codeql/rust/elements/RecordLit.qll new file mode 100644 index 000000000000..9bfc6a7e1884 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RecordLit.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `RecordLit`. + */ + +private import codeql.rust.generated.RecordLit + +class RecordLit extends Generated::RecordLit { } diff --git a/rust/ql/lib/codeql/rust/elements/RecordLitConstructor.qll b/rust/ql/lib/codeql/rust/elements/RecordLitConstructor.qll new file mode 100644 index 000000000000..4f7f64c08f33 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RecordLitConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `RecordLit` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `RecordLit` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructRecordLit(Raw::RecordLit id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/RecordPat.qll b/rust/ql/lib/codeql/rust/elements/RecordPat.qll new file mode 100644 index 000000000000..ac412f19d3d0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RecordPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `RecordPat`. + */ + +private import codeql.rust.generated.RecordPat + +class RecordPat extends Generated::RecordPat { } diff --git a/rust/ql/lib/codeql/rust/elements/RecordPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/RecordPatConstructor.qll new file mode 100644 index 000000000000..e52d3178b34d --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RecordPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `RecordPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `RecordPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructRecordPat(Raw::RecordPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Ref.qll b/rust/ql/lib/codeql/rust/elements/Ref.qll new file mode 100644 index 000000000000..274528d7718b --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Ref.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Ref`. + */ + +private import codeql.rust.generated.Ref + +class Ref extends Generated::Ref { } diff --git a/rust/ql/lib/codeql/rust/elements/RefConstructor.qll b/rust/ql/lib/codeql/rust/elements/RefConstructor.qll new file mode 100644 index 000000000000..437294302b7d --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RefConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Ref` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Ref` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructRef(Raw::Ref id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/RefPat.qll b/rust/ql/lib/codeql/rust/elements/RefPat.qll new file mode 100644 index 000000000000..3c9c59e88c5e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RefPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `RefPat`. + */ + +private import codeql.rust.generated.RefPat + +class RefPat extends Generated::RefPat { } diff --git a/rust/ql/lib/codeql/rust/elements/RefPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/RefPatConstructor.qll new file mode 100644 index 000000000000..095c9f64fc39 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/RefPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `RefPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `RefPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructRefPat(Raw::RefPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Return.qll b/rust/ql/lib/codeql/rust/elements/Return.qll new file mode 100644 index 000000000000..b65923ccd965 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Return.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Return`. + */ + +private import codeql.rust.generated.Return + +class Return extends Generated::Return { } diff --git a/rust/ql/lib/codeql/rust/elements/ReturnConstructor.qll b/rust/ql/lib/codeql/rust/elements/ReturnConstructor.qll new file mode 100644 index 000000000000..c9c935188b88 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ReturnConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Return` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Return` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructReturn(Raw::Return id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/SlicePat.qll b/rust/ql/lib/codeql/rust/elements/SlicePat.qll new file mode 100644 index 000000000000..d89f159a7a7b --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/SlicePat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `SlicePat`. + */ + +private import codeql.rust.generated.SlicePat + +class SlicePat extends Generated::SlicePat { } diff --git a/rust/ql/lib/codeql/rust/elements/SlicePatConstructor.qll b/rust/ql/lib/codeql/rust/elements/SlicePatConstructor.qll new file mode 100644 index 000000000000..6953c3ca8b07 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/SlicePatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `SlicePat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `SlicePat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructSlicePat(Raw::SlicePat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Stmt.qll b/rust/ql/lib/codeql/rust/elements/Stmt.qll new file mode 100644 index 000000000000..4b3bd89ea76f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Stmt.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Stmt`. + */ + +private import codeql.rust.generated.Stmt + +class Stmt extends Generated::Stmt { } diff --git a/rust/ql/lib/codeql/rust/elements/Tuple.qll b/rust/ql/lib/codeql/rust/elements/Tuple.qll new file mode 100644 index 000000000000..252098131d5a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Tuple.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Tuple`. + */ + +private import codeql.rust.generated.Tuple + +class Tuple extends Generated::Tuple { } diff --git a/rust/ql/lib/codeql/rust/elements/TupleConstructor.qll b/rust/ql/lib/codeql/rust/elements/TupleConstructor.qll new file mode 100644 index 000000000000..da7ae97567ba --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TupleConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Tuple` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Tuple` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructTuple(Raw::Tuple id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/TuplePat.qll b/rust/ql/lib/codeql/rust/elements/TuplePat.qll new file mode 100644 index 000000000000..f814215aec65 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TuplePat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `TuplePat`. + */ + +private import codeql.rust.generated.TuplePat + +class TuplePat extends Generated::TuplePat { } diff --git a/rust/ql/lib/codeql/rust/elements/TuplePatConstructor.qll b/rust/ql/lib/codeql/rust/elements/TuplePatConstructor.qll new file mode 100644 index 000000000000..40daddf318be --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TuplePatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `TuplePat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `TuplePat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructTuplePat(Raw::TuplePat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/TupleStructPat.qll b/rust/ql/lib/codeql/rust/elements/TupleStructPat.qll new file mode 100644 index 000000000000..e4c4ffb24ec5 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TupleStructPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `TupleStructPat`. + */ + +private import codeql.rust.generated.TupleStructPat + +class TupleStructPat extends Generated::TupleStructPat { } diff --git a/rust/ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll new file mode 100644 index 000000000000..0075d6eaf290 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `TupleStructPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `TupleStructPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructTupleStructPat(Raw::TupleStructPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/TypeRef.qll b/rust/ql/lib/codeql/rust/elements/TypeRef.qll new file mode 100644 index 000000000000..950ecbd9726a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TypeRef.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `TypeRef`. + */ + +private import codeql.rust.generated.TypeRef + +class TypeRef extends Generated::TypeRef { } diff --git a/rust/ql/lib/codeql/rust/elements/TypeRefConstructor.qll b/rust/ql/lib/codeql/rust/elements/TypeRefConstructor.qll new file mode 100644 index 000000000000..20b97fae70d2 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/TypeRefConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `TypeRef` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `TypeRef` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructTypeRef(Raw::TypeRef id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/UnaryExpr.qll b/rust/ql/lib/codeql/rust/elements/UnaryExpr.qll new file mode 100644 index 000000000000..e763808e7c81 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/UnaryExpr.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `UnaryExpr`. + */ + +private import codeql.rust.generated.UnaryExpr + +class UnaryExpr extends Generated::UnaryExpr { } diff --git a/rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll b/rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll new file mode 100644 index 000000000000..ddc00a7d864b --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `UnaryExpr` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `UnaryExpr` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructUnaryExpr(Raw::UnaryExpr id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Underscore.qll b/rust/ql/lib/codeql/rust/elements/Underscore.qll new file mode 100644 index 000000000000..e4780c9dde6a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Underscore.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Underscore`. + */ + +private import codeql.rust.generated.Underscore + +class Underscore extends Generated::Underscore { } diff --git a/rust/ql/lib/codeql/rust/elements/UnderscoreConstructor.qll b/rust/ql/lib/codeql/rust/elements/UnderscoreConstructor.qll new file mode 100644 index 000000000000..ac3f5633f2b5 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/UnderscoreConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Underscore` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Underscore` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructUnderscore(Raw::Underscore id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Unsafe.qll b/rust/ql/lib/codeql/rust/elements/Unsafe.qll new file mode 100644 index 000000000000..741e504b740a --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Unsafe.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Unsafe`. + */ + +private import codeql.rust.generated.Unsafe + +class Unsafe extends Generated::Unsafe { } diff --git a/rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll b/rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll new file mode 100644 index 000000000000..63d6f0f9a29e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Unsafe` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Unsafe` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructUnsafe(Raw::Unsafe id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/WildPat.qll b/rust/ql/lib/codeql/rust/elements/WildPat.qll new file mode 100644 index 000000000000..346b61e8c2b0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/WildPat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `WildPat`. + */ + +private import codeql.rust.generated.WildPat + +class WildPat extends Generated::WildPat { } diff --git a/rust/ql/lib/codeql/rust/elements/WildPatConstructor.qll b/rust/ql/lib/codeql/rust/elements/WildPatConstructor.qll new file mode 100644 index 000000000000..13375a8d8aef --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/WildPatConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `WildPat` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `WildPat` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructWildPat(Raw::WildPat id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Yeet.qll b/rust/ql/lib/codeql/rust/elements/Yeet.qll new file mode 100644 index 000000000000..28ad9dc9ffcc --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Yeet.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Yeet`. + */ + +private import codeql.rust.generated.Yeet + +class Yeet extends Generated::Yeet { } diff --git a/rust/ql/lib/codeql/rust/elements/YeetConstructor.qll b/rust/ql/lib/codeql/rust/elements/YeetConstructor.qll new file mode 100644 index 000000000000..e96e7aad5df3 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/YeetConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Yeet` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Yeet` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructYeet(Raw::Yeet id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Yield.qll b/rust/ql/lib/codeql/rust/elements/Yield.qll new file mode 100644 index 000000000000..421c64bbf466 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Yield.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Yield`. + */ + +private import codeql.rust.generated.Yield + +class Yield extends Generated::Yield { } diff --git a/rust/ql/lib/codeql/rust/elements/YieldConstructor.qll b/rust/ql/lib/codeql/rust/elements/YieldConstructor.qll new file mode 100644 index 000000000000..e4896a003fd0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/YieldConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Yield` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Yield` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructYield(Raw::Yield id) { any() } diff --git a/rust/ql/lib/codeql/rust/generated/Array.qll b/rust/ql/lib/codeql/rust/generated/Array.qll new file mode 100644 index 000000000000..d085e276ef03 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Array.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Array`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Array` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Array` class directly. + * Use the subclass `Array`, where the following predicates are available. + */ + class Array extends Synth::TArray, Expr { + override string getAPrimaryQlClass() { result = "Array" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Async.qll b/rust/ql/lib/codeql/rust/generated/Async.qll new file mode 100644 index 000000000000..cdf45b869775 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Async.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Async`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Block + +/** + * INTERNAL: This module contains the fully generated definition of `Async` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Async` class directly. + * Use the subclass `Async`, where the following predicates are available. + */ + class Async extends Synth::TAsync, Block { + override string getAPrimaryQlClass() { result = "Async" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Await.qll b/rust/ql/lib/codeql/rust/generated/Await.qll new file mode 100644 index 000000000000..5c2a9e05d7a6 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Await.qll @@ -0,0 +1,30 @@ +// generated by codegen +/** + * This module provides the generated definition of `Await`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Await` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Await` class directly. + * Use the subclass `Await`, where the following predicates are available. + */ + class Await extends Synth::TAwait, Expr { + override string getAPrimaryQlClass() { result = "Await" } + + /** + * Gets the expression of this await. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertAwaitToRaw(this).(Raw::Await).getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Become.qll b/rust/ql/lib/codeql/rust/generated/Become.qll new file mode 100644 index 000000000000..587b11555ad2 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Become.qll @@ -0,0 +1,30 @@ +// generated by codegen +/** + * This module provides the generated definition of `Become`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Become` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Become` class directly. + * Use the subclass `Become`, where the following predicates are available. + */ + class Become extends Synth::TBecome, Expr { + override string getAPrimaryQlClass() { result = "Become" } + + /** + * Gets the expression of this become. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertBecomeToRaw(this).(Raw::Become).getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/BinaryOp.qll b/rust/ql/lib/codeql/rust/generated/BinaryOp.qll new file mode 100644 index 000000000000..5d3dea36a7b4 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/BinaryOp.qll @@ -0,0 +1,47 @@ +// generated by codegen +/** + * This module provides the generated definition of `BinaryOp`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `BinaryOp` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::BinaryOp` class directly. + * Use the subclass `BinaryOp`, where the following predicates are available. + */ + class BinaryOp extends Synth::TBinaryOp, Expr { + override string getAPrimaryQlClass() { result = "BinaryOp" } + + /** + * Gets the lhs of this binary op. + */ + Expr getLhs() { + result = Synth::convertExprFromRaw(Synth::convertBinaryOpToRaw(this).(Raw::BinaryOp).getLhs()) + } + + /** + * Gets the rhs of this binary op. + */ + Expr getRhs() { + result = Synth::convertExprFromRaw(Synth::convertBinaryOpToRaw(this).(Raw::BinaryOp).getRhs()) + } + + /** + * Gets the op of this binary op, if it exists. + */ + string getOp() { result = Synth::convertBinaryOpToRaw(this).(Raw::BinaryOp).getOp() } + + /** + * Holds if `getOp()` exists. + */ + final predicate hasOp() { exists(this.getOp()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/BindPat.qll b/rust/ql/lib/codeql/rust/generated/BindPat.qll new file mode 100644 index 000000000000..b58d24225851 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/BindPat.qll @@ -0,0 +1,42 @@ +// generated by codegen +/** + * This module provides the generated definition of `BindPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `BindPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::BindPat` class directly. + * Use the subclass `BindPat`, where the following predicates are available. + */ + class BindPat extends Synth::TBindPat, Pat { + override string getAPrimaryQlClass() { result = "BindPat" } + + /** + * Gets the binding of this bind pat. + */ + string getBindingId() { + result = Synth::convertBindPatToRaw(this).(Raw::BindPat).getBindingId() + } + + /** + * Gets the subpat of this bind pat, if it exists. + */ + Pat getSubpat() { + result = Synth::convertPatFromRaw(Synth::convertBindPatToRaw(this).(Raw::BindPat).getSubpat()) + } + + /** + * Holds if `getSubpat()` exists. + */ + final predicate hasSubpat() { exists(this.getSubpat()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Block.qll b/rust/ql/lib/codeql/rust/generated/Block.qll new file mode 100644 index 000000000000..9ceded8eb363 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Block.qll @@ -0,0 +1,62 @@ +// generated by codegen +/** + * This module provides the generated definition of `Block`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Stmt + +/** + * INTERNAL: This module contains the fully generated definition of `Block` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Block` class directly. + * Use the subclass `Block`, where the following predicates are available. + */ + class Block extends Synth::TBlock, Expr { + /** + * Gets the `index`th statement of this block (0-based). + */ + Stmt getStatement(int index) { + result = + Synth::convertStmtFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getStatement(index)) + } + + /** + * Gets any of the statements of this block. + */ + final Stmt getAStatement() { result = this.getStatement(_) } + + /** + * Gets the number of statements of this block. + */ + final int getNumberOfStatements() { result = count(int i | exists(this.getStatement(i))) } + + /** + * Gets the tail of this block, if it exists. + */ + Expr getTail() { + result = Synth::convertExprFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getTail()) + } + + /** + * Holds if `getTail()` exists. + */ + final predicate hasTail() { exists(this.getTail()) } + + /** + * Gets the label of this block, if it exists. + */ + string getLabel() { result = Synth::convertBlockToRaw(this).(Raw::Block).getLabel() } + + /** + * Holds if `getLabel()` exists. + */ + final predicate hasLabel() { exists(this.getLabel()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Box.qll b/rust/ql/lib/codeql/rust/generated/Box.qll new file mode 100644 index 000000000000..31ee230f3281 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Box.qll @@ -0,0 +1,30 @@ +// generated by codegen +/** + * This module provides the generated definition of `Box`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Box` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Box` class directly. + * Use the subclass `Box`, where the following predicates are available. + */ + class Box extends Synth::TBox, Expr { + override string getAPrimaryQlClass() { result = "Box" } + + /** + * Gets the expression of this box. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertBoxToRaw(this).(Raw::Box).getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/BoxPat.qll b/rust/ql/lib/codeql/rust/generated/BoxPat.qll new file mode 100644 index 000000000000..690fc5155d7c --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/BoxPat.qll @@ -0,0 +1,30 @@ +// generated by codegen +/** + * This module provides the generated definition of `BoxPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `BoxPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::BoxPat` class directly. + * Use the subclass `BoxPat`, where the following predicates are available. + */ + class BoxPat extends Synth::TBoxPat, Pat { + override string getAPrimaryQlClass() { result = "BoxPat" } + + /** + * Gets the inner of this box pat. + */ + Pat getInner() { + result = Synth::convertPatFromRaw(Synth::convertBoxPatToRaw(this).(Raw::BoxPat).getInner()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Break.qll b/rust/ql/lib/codeql/rust/generated/Break.qll new file mode 100644 index 000000000000..b356d07f5a18 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Break.qll @@ -0,0 +1,45 @@ +// generated by codegen +/** + * This module provides the generated definition of `Break`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Break` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Break` class directly. + * Use the subclass `Break`, where the following predicates are available. + */ + class Break extends Synth::TBreak, Expr { + override string getAPrimaryQlClass() { result = "Break" } + + /** + * Gets the expression of this break, if it exists. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertBreakToRaw(this).(Raw::Break).getExpr()) + } + + /** + * Holds if `getExpr()` exists. + */ + final predicate hasExpr() { exists(this.getExpr()) } + + /** + * Gets the label of this break, if it exists. + */ + string getLabel() { result = Synth::convertBreakToRaw(this).(Raw::Break).getLabel() } + + /** + * Holds if `getLabel()` exists. + */ + final predicate hasLabel() { exists(this.getLabel()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Call.qll b/rust/ql/lib/codeql/rust/generated/Call.qll new file mode 100644 index 000000000000..8dcbf340c597 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Call.qll @@ -0,0 +1,52 @@ +// generated by codegen +/** + * This module provides the generated definition of `Call`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Call` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Call` class directly. + * Use the subclass `Call`, where the following predicates are available. + */ + class Call extends Synth::TCall, Expr { + override string getAPrimaryQlClass() { result = "Call" } + + /** + * Gets the callee of this call. + */ + Expr getCallee() { + result = Synth::convertExprFromRaw(Synth::convertCallToRaw(this).(Raw::Call).getCallee()) + } + + /** + * Gets the `index`th argument of this call (0-based). + */ + Expr getArg(int index) { + result = Synth::convertExprFromRaw(Synth::convertCallToRaw(this).(Raw::Call).getArg(index)) + } + + /** + * Gets any of the arguments of this call. + */ + final Expr getAnArg() { result = this.getArg(_) } + + /** + * Gets the number of arguments of this call. + */ + final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) } + + /** + * Holds if this call is assignee expression. + */ + predicate isAssigneeExpr() { Synth::convertCallToRaw(this).(Raw::Call).isAssigneeExpr() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Cast.qll b/rust/ql/lib/codeql/rust/generated/Cast.qll new file mode 100644 index 000000000000..5a1a4e4d31b0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Cast.qll @@ -0,0 +1,38 @@ +// generated by codegen +/** + * This module provides the generated definition of `Cast`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.TypeRef + +/** + * INTERNAL: This module contains the fully generated definition of `Cast` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Cast` class directly. + * Use the subclass `Cast`, where the following predicates are available. + */ + class Cast extends Synth::TCast, Expr { + override string getAPrimaryQlClass() { result = "Cast" } + + /** + * Gets the expression of this cast. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertCastToRaw(this).(Raw::Cast).getExpr()) + } + + /** + * Gets the type reference of this cast. + */ + TypeRef getTypeRef() { + result = Synth::convertTypeRefFromRaw(Synth::convertCastToRaw(this).(Raw::Cast).getTypeRef()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Closure.qll b/rust/ql/lib/codeql/rust/generated/Closure.qll new file mode 100644 index 000000000000..9c0876a91212 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Closure.qll @@ -0,0 +1,88 @@ +// generated by codegen +/** + * This module provides the generated definition of `Closure`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Pat +import codeql.rust.elements.TypeRef + +/** + * INTERNAL: This module contains the fully generated definition of `Closure` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Closure` class directly. + * Use the subclass `Closure`, where the following predicates are available. + */ + class Closure extends Synth::TClosure, Expr { + override string getAPrimaryQlClass() { result = "Closure" } + + /** + * Gets the `index`th argument of this closure (0-based). + */ + Pat getArg(int index) { + result = + Synth::convertPatFromRaw(Synth::convertClosureToRaw(this).(Raw::Closure).getArg(index)) + } + + /** + * Gets any of the arguments of this closure. + */ + final Pat getAnArg() { result = this.getArg(_) } + + /** + * Gets the number of arguments of this closure. + */ + final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) } + + /** + * Gets the `index`th argument type of this closure (0-based). + */ + TypeRef getArgType(int index) { + result = + Synth::convertTypeRefFromRaw(Synth::convertClosureToRaw(this) + .(Raw::Closure) + .getArgType(index)) + } + + /** + * Gets any of the argument types of this closure. + */ + final TypeRef getAnArgType() { result = this.getArgType(_) } + + /** + * Gets the number of argument types of this closure. + */ + final int getNumberOfArgTypes() { result = count(int i | exists(this.getArgType(i))) } + + /** + * Gets the ret type of this closure, if it exists. + */ + TypeRef getRetType() { + result = + Synth::convertTypeRefFromRaw(Synth::convertClosureToRaw(this).(Raw::Closure).getRetType()) + } + + /** + * Holds if `getRetType()` exists. + */ + final predicate hasRetType() { exists(this.getRetType()) } + + /** + * Gets the body of this closure. + */ + Expr getBody() { + result = Synth::convertExprFromRaw(Synth::convertClosureToRaw(this).(Raw::Closure).getBody()) + } + + /** + * Holds if this closure is move. + */ + predicate isMove() { Synth::convertClosureToRaw(this).(Raw::Closure).isMove() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Const.qll b/rust/ql/lib/codeql/rust/generated/Const.qll new file mode 100644 index 000000000000..e4d48af33668 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Const.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Const`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Const` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Const` class directly. + * Use the subclass `Const`, where the following predicates are available. + */ + class Const extends Synth::TConst, Expr { + override string getAPrimaryQlClass() { result = "Const" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/ConstBlockPat.qll b/rust/ql/lib/codeql/rust/generated/ConstBlockPat.qll new file mode 100644 index 000000000000..f741124f180c --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/ConstBlockPat.qll @@ -0,0 +1,34 @@ +// generated by codegen +/** + * This module provides the generated definition of `ConstBlockPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `ConstBlockPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::ConstBlockPat` class directly. + * Use the subclass `ConstBlockPat`, where the following predicates are available. + */ + class ConstBlockPat extends Synth::TConstBlockPat, Pat { + override string getAPrimaryQlClass() { result = "ConstBlockPat" } + + /** + * Gets the expression of this const block pat. + */ + Expr getExpr() { + result = + Synth::convertExprFromRaw(Synth::convertConstBlockPatToRaw(this) + .(Raw::ConstBlockPat) + .getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Continue.qll b/rust/ql/lib/codeql/rust/generated/Continue.qll new file mode 100644 index 000000000000..148743cffc88 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Continue.qll @@ -0,0 +1,33 @@ +// generated by codegen +/** + * This module provides the generated definition of `Continue`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Continue` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Continue` class directly. + * Use the subclass `Continue`, where the following predicates are available. + */ + class Continue extends Synth::TContinue, Expr { + override string getAPrimaryQlClass() { result = "Continue" } + + /** + * Gets the label of this continue, if it exists. + */ + string getLabel() { result = Synth::convertContinueToRaw(this).(Raw::Continue).getLabel() } + + /** + * Holds if `getLabel()` exists. + */ + final predicate hasLabel() { exists(this.getLabel()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Expr.qll b/rust/ql/lib/codeql/rust/generated/Expr.qll new file mode 100644 index 000000000000..cfb39a35590c --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Expr.qll @@ -0,0 +1,21 @@ +// generated by codegen +/** + * This module provides the generated definition of `Expr`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Locatable + +/** + * INTERNAL: This module contains the fully generated definition of `Expr` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Expr` class directly. + * Use the subclass `Expr`, where the following predicates are available. + */ + class Expr extends Synth::TExpr, Locatable { } +} diff --git a/rust/ql/lib/codeql/rust/generated/ExprStmt.qll b/rust/ql/lib/codeql/rust/generated/ExprStmt.qll new file mode 100644 index 000000000000..0151dcf9b3b8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/ExprStmt.qll @@ -0,0 +1,37 @@ +// generated by codegen +/** + * This module provides the generated definition of `ExprStmt`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Stmt + +/** + * INTERNAL: This module contains the fully generated definition of `ExprStmt` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::ExprStmt` class directly. + * Use the subclass `ExprStmt`, where the following predicates are available. + */ + class ExprStmt extends Synth::TExprStmt, Stmt { + override string getAPrimaryQlClass() { result = "ExprStmt" } + + /** + * Gets the expression of this expression statement. + */ + Expr getExpr() { + result = + Synth::convertExprFromRaw(Synth::convertExprStmtToRaw(this).(Raw::ExprStmt).getExpr()) + } + + /** + * Holds if this expression statement has semi. + */ + predicate hasSemi() { Synth::convertExprStmtToRaw(this).(Raw::ExprStmt).hasSemi() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Field.qll b/rust/ql/lib/codeql/rust/generated/Field.qll new file mode 100644 index 000000000000..ae8490554118 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Field.qll @@ -0,0 +1,35 @@ +// generated by codegen +/** + * This module provides the generated definition of `Field`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Field` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Field` class directly. + * Use the subclass `Field`, where the following predicates are available. + */ + class Field extends Synth::TField, Expr { + override string getAPrimaryQlClass() { result = "Field" } + + /** + * Gets the expression of this field. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertFieldToRaw(this).(Raw::Field).getExpr()) + } + + /** + * Gets the name of this field. + */ + string getName() { result = Synth::convertFieldToRaw(this).(Raw::Field).getName() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Function.qll b/rust/ql/lib/codeql/rust/generated/Function.qll index 8eb15f350781..3faba890bfd0 100644 --- a/rust/ql/lib/codeql/rust/generated/Function.qll +++ b/rust/ql/lib/codeql/rust/generated/Function.qll @@ -7,6 +7,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw import codeql.rust.elements.Declaration +import codeql.rust.elements.Expr /** * INTERNAL: This module contains the fully generated definition of `Function` and should not @@ -24,5 +25,13 @@ module Generated { * Gets the name of this function. */ string getName() { result = Synth::convertFunctionToRaw(this).(Raw::Function).getName() } + + /** + * Gets the body of this function. + */ + Expr getBody() { + result = + Synth::convertExprFromRaw(Synth::convertFunctionToRaw(this).(Raw::Function).getBody()) + } } } diff --git a/rust/ql/lib/codeql/rust/generated/If.qll b/rust/ql/lib/codeql/rust/generated/If.qll new file mode 100644 index 000000000000..bdb9542980b6 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/If.qll @@ -0,0 +1,49 @@ +// generated by codegen +/** + * This module provides the generated definition of `If`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `If` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::If` class directly. + * Use the subclass `If`, where the following predicates are available. + */ + class If extends Synth::TIf, Expr { + override string getAPrimaryQlClass() { result = "If" } + + /** + * Gets the condition of this if. + */ + Expr getCondition() { + result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getCondition()) + } + + /** + * Gets the then branch of this if. + */ + Expr getThenBranch() { + result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getThenBranch()) + } + + /** + * Gets the else branch of this if, if it exists. + */ + Expr getElseBranch() { + result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getElseBranch()) + } + + /** + * Holds if `getElseBranch()` exists. + */ + final predicate hasElseBranch() { exists(this.getElseBranch()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/IfLet.qll b/rust/ql/lib/codeql/rust/generated/IfLet.qll new file mode 100644 index 000000000000..31cbc5afb9c9 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/IfLet.qll @@ -0,0 +1,72 @@ +// generated by codegen +/** + * This module provides the generated definition of `IfLet`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Pat +import codeql.rust.elements.Stmt +import codeql.rust.elements.TypeRef + +/** + * INTERNAL: This module contains the fully generated definition of `IfLet` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::IfLet` class directly. + * Use the subclass `IfLet`, where the following predicates are available. + */ + class IfLet extends Synth::TIfLet, Stmt { + override string getAPrimaryQlClass() { result = "IfLet" } + + /** + * Gets the pat of this if let. + */ + Pat getPat() { + result = Synth::convertPatFromRaw(Synth::convertIfLetToRaw(this).(Raw::IfLet).getPat()) + } + + /** + * Gets the type reference of this if let, if it exists. + */ + TypeRef getTypeRef() { + result = + Synth::convertTypeRefFromRaw(Synth::convertIfLetToRaw(this).(Raw::IfLet).getTypeRef()) + } + + /** + * Holds if `getTypeRef()` exists. + */ + final predicate hasTypeRef() { exists(this.getTypeRef()) } + + /** + * Gets the initializer of this if let, if it exists. + */ + Expr getInitializer() { + result = + Synth::convertExprFromRaw(Synth::convertIfLetToRaw(this).(Raw::IfLet).getInitializer()) + } + + /** + * Holds if `getInitializer()` exists. + */ + final predicate hasInitializer() { exists(this.getInitializer()) } + + /** + * Gets the else branch of this if let, if it exists. + */ + Expr getElseBranch() { + result = + Synth::convertExprFromRaw(Synth::convertIfLetToRaw(this).(Raw::IfLet).getElseBranch()) + } + + /** + * Holds if `getElseBranch()` exists. + */ + final predicate hasElseBranch() { exists(this.getElseBranch()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Index.qll b/rust/ql/lib/codeql/rust/generated/Index.qll new file mode 100644 index 000000000000..f7e0d4e8a9bc --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Index.qll @@ -0,0 +1,42 @@ +// generated by codegen +/** + * This module provides the generated definition of `Index`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Index` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Index` class directly. + * Use the subclass `Index`, where the following predicates are available. + */ + class Index extends Synth::TIndex, Expr { + override string getAPrimaryQlClass() { result = "Index" } + + /** + * Gets the base of this index. + */ + Expr getBase() { + result = Synth::convertExprFromRaw(Synth::convertIndexToRaw(this).(Raw::Index).getBase()) + } + + /** + * Gets the index of this index. + */ + Expr getIndex() { + result = Synth::convertExprFromRaw(Synth::convertIndexToRaw(this).(Raw::Index).getIndex()) + } + + /** + * Holds if this index is assignee expression. + */ + predicate isAssigneeExpr() { Synth::convertIndexToRaw(this).(Raw::Index).isAssigneeExpr() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/InlineAsm.qll b/rust/ql/lib/codeql/rust/generated/InlineAsm.qll new file mode 100644 index 000000000000..b9189c6a7e58 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/InlineAsm.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `InlineAsm`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `InlineAsm` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::InlineAsm` class directly. + * Use the subclass `InlineAsm`, where the following predicates are available. + */ + class InlineAsm extends Synth::TInlineAsm, Expr { + override string getAPrimaryQlClass() { result = "InlineAsm" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/ItemStmt.qll b/rust/ql/lib/codeql/rust/generated/ItemStmt.qll new file mode 100644 index 000000000000..2be48967c7cb --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/ItemStmt.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `ItemStmt`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Stmt + +/** + * INTERNAL: This module contains the fully generated definition of `ItemStmt` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::ItemStmt` class directly. + * Use the subclass `ItemStmt`, where the following predicates are available. + */ + class ItemStmt extends Synth::TItemStmt, Stmt { + override string getAPrimaryQlClass() { result = "ItemStmt" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Let.qll b/rust/ql/lib/codeql/rust/generated/Let.qll new file mode 100644 index 000000000000..7278f07cee2b --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Let.qll @@ -0,0 +1,38 @@ +// generated by codegen +/** + * This module provides the generated definition of `Let`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `Let` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Let` class directly. + * Use the subclass `Let`, where the following predicates are available. + */ + class Let extends Synth::TLet, Expr { + override string getAPrimaryQlClass() { result = "Let" } + + /** + * Gets the pat of this let. + */ + Pat getPat() { + result = Synth::convertPatFromRaw(Synth::convertLetToRaw(this).(Raw::Let).getPat()) + } + + /** + * Gets the expression of this let. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertLetToRaw(this).(Raw::Let).getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/LitPat.qll b/rust/ql/lib/codeql/rust/generated/LitPat.qll new file mode 100644 index 000000000000..1133ee3d1f1a --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/LitPat.qll @@ -0,0 +1,31 @@ +// generated by codegen +/** + * This module provides the generated definition of `LitPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `LitPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::LitPat` class directly. + * Use the subclass `LitPat`, where the following predicates are available. + */ + class LitPat extends Synth::TLitPat, Pat { + override string getAPrimaryQlClass() { result = "LitPat" } + + /** + * Gets the expression of this lit pat. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertLitPatToRaw(this).(Raw::LitPat).getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Literal.qll b/rust/ql/lib/codeql/rust/generated/Literal.qll new file mode 100644 index 000000000000..e7078838ed66 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Literal.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Literal`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Literal` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Literal` class directly. + * Use the subclass `Literal`, where the following predicates are available. + */ + class Literal extends Synth::TLiteral, Expr { + override string getAPrimaryQlClass() { result = "Literal" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Loop.qll b/rust/ql/lib/codeql/rust/generated/Loop.qll new file mode 100644 index 000000000000..f8ebefa5451e --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Loop.qll @@ -0,0 +1,40 @@ +// generated by codegen +/** + * This module provides the generated definition of `Loop`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Loop` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Loop` class directly. + * Use the subclass `Loop`, where the following predicates are available. + */ + class Loop extends Synth::TLoop, Expr { + override string getAPrimaryQlClass() { result = "Loop" } + + /** + * Gets the body of this loop. + */ + Expr getBody() { + result = Synth::convertExprFromRaw(Synth::convertLoopToRaw(this).(Raw::Loop).getBody()) + } + + /** + * Gets the label of this loop, if it exists. + */ + string getLabel() { result = Synth::convertLoopToRaw(this).(Raw::Loop).getLabel() } + + /** + * Holds if `getLabel()` exists. + */ + final predicate hasLabel() { exists(this.getLabel()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Match.qll b/rust/ql/lib/codeql/rust/generated/Match.qll new file mode 100644 index 000000000000..d6727b655882 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Match.qll @@ -0,0 +1,49 @@ +// generated by codegen +/** + * This module provides the generated definition of `Match`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.MatchArm + +/** + * INTERNAL: This module contains the fully generated definition of `Match` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Match` class directly. + * Use the subclass `Match`, where the following predicates are available. + */ + class Match extends Synth::TMatch, Expr { + override string getAPrimaryQlClass() { result = "Match" } + + /** + * Gets the expression of this match. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertMatchToRaw(this).(Raw::Match).getExpr()) + } + + /** + * Gets the `index`th branch of this match (0-based). + */ + MatchArm getBranch(int index) { + result = + Synth::convertMatchArmFromRaw(Synth::convertMatchToRaw(this).(Raw::Match).getBranch(index)) + } + + /** + * Gets any of the branches of this match. + */ + final MatchArm getABranch() { result = this.getBranch(_) } + + /** + * Gets the number of branches of this match. + */ + final int getNumberOfBranches() { result = count(int i | exists(this.getBranch(i))) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/MatchArm.qll b/rust/ql/lib/codeql/rust/generated/MatchArm.qll new file mode 100644 index 000000000000..a6e4f49ea59d --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/MatchArm.qll @@ -0,0 +1,53 @@ +// generated by codegen +/** + * This module provides the generated definition of `MatchArm`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Locatable +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `MatchArm` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::MatchArm` class directly. + * Use the subclass `MatchArm`, where the following predicates are available. + */ + class MatchArm extends Synth::TMatchArm, Locatable { + override string getAPrimaryQlClass() { result = "MatchArm" } + + /** + * Gets the pat of this match arm. + */ + Pat getPat() { + result = Synth::convertPatFromRaw(Synth::convertMatchArmToRaw(this).(Raw::MatchArm).getPat()) + } + + /** + * Gets the guard of this match arm, if it exists. + */ + Expr getGuard() { + result = + Synth::convertExprFromRaw(Synth::convertMatchArmToRaw(this).(Raw::MatchArm).getGuard()) + } + + /** + * Holds if `getGuard()` exists. + */ + final predicate hasGuard() { exists(this.getGuard()) } + + /** + * Gets the expression of this match arm. + */ + Expr getExpr() { + result = + Synth::convertExprFromRaw(Synth::convertMatchArmToRaw(this).(Raw::MatchArm).getExpr()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/MethodCall.qll b/rust/ql/lib/codeql/rust/generated/MethodCall.qll new file mode 100644 index 000000000000..a99e4943a91a --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/MethodCall.qll @@ -0,0 +1,60 @@ +// generated by codegen +/** + * This module provides the generated definition of `MethodCall`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `MethodCall` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::MethodCall` class directly. + * Use the subclass `MethodCall`, where the following predicates are available. + */ + class MethodCall extends Synth::TMethodCall, Expr { + override string getAPrimaryQlClass() { result = "MethodCall" } + + /** + * Gets the receiver of this method call. + */ + Expr getReceiver() { + result = + Synth::convertExprFromRaw(Synth::convertMethodCallToRaw(this) + .(Raw::MethodCall) + .getReceiver()) + } + + /** + * Gets the method name of this method call. + */ + string getMethodName() { + result = Synth::convertMethodCallToRaw(this).(Raw::MethodCall).getMethodName() + } + + /** + * Gets the `index`th argument of this method call (0-based). + */ + Expr getArg(int index) { + result = + Synth::convertExprFromRaw(Synth::convertMethodCallToRaw(this) + .(Raw::MethodCall) + .getArg(index)) + } + + /** + * Gets any of the arguments of this method call. + */ + final Expr getAnArg() { result = this.getArg(_) } + + /** + * Gets the number of arguments of this method call. + */ + final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/MissingExpr.qll b/rust/ql/lib/codeql/rust/generated/MissingExpr.qll new file mode 100644 index 000000000000..250c639fbeb8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/MissingExpr.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `MissingExpr`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `MissingExpr` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::MissingExpr` class directly. + * Use the subclass `MissingExpr`, where the following predicates are available. + */ + class MissingExpr extends Synth::TMissingExpr, Expr { + override string getAPrimaryQlClass() { result = "MissingExpr" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/MissingPat.qll b/rust/ql/lib/codeql/rust/generated/MissingPat.qll new file mode 100644 index 000000000000..fb8af9f5f5b8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/MissingPat.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `MissingPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `MissingPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::MissingPat` class directly. + * Use the subclass `MissingPat`, where the following predicates are available. + */ + class MissingPat extends Synth::TMissingPat, Pat { + override string getAPrimaryQlClass() { result = "MissingPat" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/OffsetOf.qll b/rust/ql/lib/codeql/rust/generated/OffsetOf.qll new file mode 100644 index 000000000000..1a64546225c3 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/OffsetOf.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `OffsetOf`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `OffsetOf` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::OffsetOf` class directly. + * Use the subclass `OffsetOf`, where the following predicates are available. + */ + class OffsetOf extends Synth::TOffsetOf, Expr { + override string getAPrimaryQlClass() { result = "OffsetOf" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/OrPat.qll b/rust/ql/lib/codeql/rust/generated/OrPat.qll new file mode 100644 index 000000000000..8f1541ea9b31 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/OrPat.qll @@ -0,0 +1,40 @@ +// generated by codegen +/** + * This module provides the generated definition of `OrPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `OrPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::OrPat` class directly. + * Use the subclass `OrPat`, where the following predicates are available. + */ + class OrPat extends Synth::TOrPat, Pat { + override string getAPrimaryQlClass() { result = "OrPat" } + + /** + * Gets the `index`th argument of this or pat (0-based). + */ + Pat getArg(int index) { + result = Synth::convertPatFromRaw(Synth::convertOrPatToRaw(this).(Raw::OrPat).getArg(index)) + } + + /** + * Gets any of the arguments of this or pat. + */ + final Pat getAnArg() { result = this.getArg(_) } + + /** + * Gets the number of arguments of this or pat. + */ + final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/generated/ParentChild.qll index f45adf666420..b780774d754f 100644 --- a/rust/ql/lib/codeql/rust/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/generated/ParentChild.qll @@ -90,46 +90,505 @@ private module Impl { ) } + private Element getImmediateChildOfExpr(Expr e, int index, string partialPredicateCall) { + exists(int b, int bLocatable, int n | + b = 0 and + bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and + n = bLocatable and + ( + none() + or + result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfMatchArm(MatchArm e, int index, string partialPredicateCall) { + exists(int b, int bLocatable, int n | + b = 0 and + bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and + n = bLocatable and + ( + none() + or + result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfPat(Pat e, int index, string partialPredicateCall) { + exists(int b, int bLocatable, int n | + b = 0 and + bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and + n = bLocatable and + ( + none() + or + result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfStmt(Stmt e, int index, string partialPredicateCall) { + exists(int b, int bLocatable, int n | + b = 0 and + bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and + n = bLocatable and + ( + none() + or + result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfTypeRef(TypeRef e, int index, string partialPredicateCall) { + exists(int b, int bLocatable, int n | + b = 0 and + bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and + n = bLocatable and + ( + none() + or + result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + ) + ) + } + private Element getImmediateChildOfUnknownFile( UnknownFile e, int index, string partialPredicateCall ) { exists(int b, int bFile, int n | b = 0 and - bFile = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfFile(e, i, _)) | i) and - n = bFile and + bFile = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfFile(e, i, _)) | i) and + n = bFile and + ( + none() + or + result = getImmediateChildOfFile(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfUnknownLocation( + UnknownLocation e, int index, string partialPredicateCall + ) { + exists(int b, int bLocation, int n | + b = 0 and + bLocation = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocation(e, i, _)) | i) and + n = bLocation and + ( + none() + or + result = getImmediateChildOfLocation(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfArray(Array e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfAwait(Await e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBecome(Become e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBinaryOp(BinaryOp e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBindPat(BindPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBlock(Block e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBox(Box e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBoxPat(BoxPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBreak(Break e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfCall(Call e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfCast(Cast e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfClosure(Closure e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfConst(Const e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfConstBlockPat( + ConstBlockPat e, int index, string partialPredicateCall + ) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfContinue(Continue e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfExprStmt(ExprStmt e, int index, string partialPredicateCall) { + exists(int b, int bStmt, int n | + b = 0 and + bStmt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfStmt(e, i, _)) | i) and + n = bStmt and + ( + none() + or + result = getImmediateChildOfStmt(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfField(Field e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfFunction(Function e, int index, string partialPredicateCall) { + exists(int b, int bDeclaration, int n | + b = 0 and + bDeclaration = + b + 1 + max(int i | i = -1 or exists(getImmediateChildOfDeclaration(e, i, _)) | i) and + n = bDeclaration and + ( + none() + or + result = getImmediateChildOfDeclaration(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfIf(If e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfIfLet(IfLet e, int index, string partialPredicateCall) { + exists(int b, int bStmt, int n | + b = 0 and + bStmt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfStmt(e, i, _)) | i) and + n = bStmt and + ( + none() + or + result = getImmediateChildOfStmt(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfIndex(Index e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfInlineAsm(InlineAsm e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfItemStmt(ItemStmt e, int index, string partialPredicateCall) { + exists(int b, int bStmt, int n | + b = 0 and + bStmt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfStmt(e, i, _)) | i) and + n = bStmt and + ( + none() + or + result = getImmediateChildOfStmt(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfLet(Let e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfLitPat(LitPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfLiteral(Literal e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfLoop(Loop e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfMatch(Match e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and ( none() or - result = getImmediateChildOfFile(e, index - b, partialPredicateCall) + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfUnknownLocation( - UnknownLocation e, int index, string partialPredicateCall + private Element getImmediateChildOfMethodCall(MethodCall e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfMissingExpr( + MissingExpr e, int index, string partialPredicateCall ) { - exists(int b, int bLocation, int n | + exists(int b, int bExpr, int n | b = 0 and - bLocation = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocation(e, i, _)) | i) and - n = bLocation and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and ( none() or - result = getImmediateChildOfLocation(e, index - b, partialPredicateCall) + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfFunction(Function e, int index, string partialPredicateCall) { - exists(int b, int bDeclaration, int n | + private Element getImmediateChildOfMissingPat(MissingPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | b = 0 and - bDeclaration = - b + 1 + max(int i | i = -1 or exists(getImmediateChildOfDeclaration(e, i, _)) | i) and - n = bDeclaration and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and ( none() or - result = getImmediateChildOfDeclaration(e, index - b, partialPredicateCall) + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) ) ) } @@ -152,6 +611,294 @@ private module Impl { ) } + private Element getImmediateChildOfOffsetOf(OffsetOf e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfOrPat(OrPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfPath(Path e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfPathPat(PathPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRange(Range e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRangePat(RangePat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRecordLit(RecordLit e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRecordPat(RecordPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRef(Ref e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRefPat(RefPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfReturn(Return e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfSlicePat(SlicePat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfTuple(Tuple e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfTuplePat(TuplePat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfTupleStructPat( + TupleStructPat e, int index, string partialPredicateCall + ) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfUnaryExpr(UnaryExpr e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfUnderscore(Underscore e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfWildPat(WildPat e, int index, string partialPredicateCall) { + exists(int b, int bPat, int n | + b = 0 and + bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and + n = bPat and + ( + none() + or + result = getImmediateChildOfPat(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfYeet(Yeet e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfYield(Yield e, int index, string partialPredicateCall) { + exists(int b, int bExpr, int n | + b = 0 and + bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and + n = bExpr and + ( + none() + or + result = getImmediateChildOfExpr(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfAsync(Async e, int index, string partialPredicateCall) { + exists(int b, int bBlock, int n | + b = 0 and + bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and + n = bBlock and + ( + none() + or + result = getImmediateChildOfBlock(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfUnsafe(Unsafe e, int index, string partialPredicateCall) { + exists(int b, int bBlock, int n | + b = 0 and + bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and + n = bBlock and + ( + none() + or + result = getImmediateChildOfBlock(e, index - b, partialPredicateCall) + ) + ) + } + cached Element getImmediateChild(Element e, int index, string partialAccessor) { // why does this look more complicated than it should? @@ -162,13 +909,119 @@ private module Impl { or result = getImmediateChildOfDbLocation(e, index, partialAccessor) or + result = getImmediateChildOfMatchArm(e, index, partialAccessor) + or + result = getImmediateChildOfTypeRef(e, index, partialAccessor) + or result = getImmediateChildOfUnknownFile(e, index, partialAccessor) or result = getImmediateChildOfUnknownLocation(e, index, partialAccessor) or + result = getImmediateChildOfArray(e, index, partialAccessor) + or + result = getImmediateChildOfAwait(e, index, partialAccessor) + or + result = getImmediateChildOfBecome(e, index, partialAccessor) + or + result = getImmediateChildOfBinaryOp(e, index, partialAccessor) + or + result = getImmediateChildOfBindPat(e, index, partialAccessor) + or + result = getImmediateChildOfBox(e, index, partialAccessor) + or + result = getImmediateChildOfBoxPat(e, index, partialAccessor) + or + result = getImmediateChildOfBreak(e, index, partialAccessor) + or + result = getImmediateChildOfCall(e, index, partialAccessor) + or + result = getImmediateChildOfCast(e, index, partialAccessor) + or + result = getImmediateChildOfClosure(e, index, partialAccessor) + or + result = getImmediateChildOfConst(e, index, partialAccessor) + or + result = getImmediateChildOfConstBlockPat(e, index, partialAccessor) + or + result = getImmediateChildOfContinue(e, index, partialAccessor) + or + result = getImmediateChildOfExprStmt(e, index, partialAccessor) + or + result = getImmediateChildOfField(e, index, partialAccessor) + or result = getImmediateChildOfFunction(e, index, partialAccessor) or + result = getImmediateChildOfIf(e, index, partialAccessor) + or + result = getImmediateChildOfIfLet(e, index, partialAccessor) + or + result = getImmediateChildOfIndex(e, index, partialAccessor) + or + result = getImmediateChildOfInlineAsm(e, index, partialAccessor) + or + result = getImmediateChildOfItemStmt(e, index, partialAccessor) + or + result = getImmediateChildOfLet(e, index, partialAccessor) + or + result = getImmediateChildOfLitPat(e, index, partialAccessor) + or + result = getImmediateChildOfLiteral(e, index, partialAccessor) + or + result = getImmediateChildOfLoop(e, index, partialAccessor) + or + result = getImmediateChildOfMatch(e, index, partialAccessor) + or + result = getImmediateChildOfMethodCall(e, index, partialAccessor) + or + result = getImmediateChildOfMissingExpr(e, index, partialAccessor) + or + result = getImmediateChildOfMissingPat(e, index, partialAccessor) + or result = getImmediateChildOfModule(e, index, partialAccessor) + or + result = getImmediateChildOfOffsetOf(e, index, partialAccessor) + or + result = getImmediateChildOfOrPat(e, index, partialAccessor) + or + result = getImmediateChildOfPath(e, index, partialAccessor) + or + result = getImmediateChildOfPathPat(e, index, partialAccessor) + or + result = getImmediateChildOfRange(e, index, partialAccessor) + or + result = getImmediateChildOfRangePat(e, index, partialAccessor) + or + result = getImmediateChildOfRecordLit(e, index, partialAccessor) + or + result = getImmediateChildOfRecordPat(e, index, partialAccessor) + or + result = getImmediateChildOfRef(e, index, partialAccessor) + or + result = getImmediateChildOfRefPat(e, index, partialAccessor) + or + result = getImmediateChildOfReturn(e, index, partialAccessor) + or + result = getImmediateChildOfSlicePat(e, index, partialAccessor) + or + result = getImmediateChildOfTuple(e, index, partialAccessor) + or + result = getImmediateChildOfTuplePat(e, index, partialAccessor) + or + result = getImmediateChildOfTupleStructPat(e, index, partialAccessor) + or + result = getImmediateChildOfUnaryExpr(e, index, partialAccessor) + or + result = getImmediateChildOfUnderscore(e, index, partialAccessor) + or + result = getImmediateChildOfWildPat(e, index, partialAccessor) + or + result = getImmediateChildOfYeet(e, index, partialAccessor) + or + result = getImmediateChildOfYield(e, index, partialAccessor) + or + result = getImmediateChildOfAsync(e, index, partialAccessor) + or + result = getImmediateChildOfUnsafe(e, index, partialAccessor) } } diff --git a/rust/ql/lib/codeql/rust/generated/Pat.qll b/rust/ql/lib/codeql/rust/generated/Pat.qll new file mode 100644 index 000000000000..af27a09e996e --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Pat.qll @@ -0,0 +1,21 @@ +// generated by codegen +/** + * This module provides the generated definition of `Pat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Locatable + +/** + * INTERNAL: This module contains the fully generated definition of `Pat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Pat` class directly. + * Use the subclass `Pat`, where the following predicates are available. + */ + class Pat extends Synth::TPat, Locatable { } +} diff --git a/rust/ql/lib/codeql/rust/generated/Path.qll b/rust/ql/lib/codeql/rust/generated/Path.qll new file mode 100644 index 000000000000..533d33535f3a --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Path.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Path`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Path` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Path` class directly. + * Use the subclass `Path`, where the following predicates are available. + */ + class Path extends Synth::TPath, Expr { + override string getAPrimaryQlClass() { result = "Path" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/PathPat.qll b/rust/ql/lib/codeql/rust/generated/PathPat.qll new file mode 100644 index 000000000000..7f4d764195fa --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/PathPat.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `PathPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `PathPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::PathPat` class directly. + * Use the subclass `PathPat`, where the following predicates are available. + */ + class PathPat extends Synth::TPathPat, Pat { + override string getAPrimaryQlClass() { result = "PathPat" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Range.qll b/rust/ql/lib/codeql/rust/generated/Range.qll new file mode 100644 index 000000000000..c1ba9ecd52de --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Range.qll @@ -0,0 +1,52 @@ +// generated by codegen +/** + * This module provides the generated definition of `Range`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Range` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Range` class directly. + * Use the subclass `Range`, where the following predicates are available. + */ + class Range extends Synth::TRange, Expr { + override string getAPrimaryQlClass() { result = "Range" } + + /** + * Gets the lhs of this range, if it exists. + */ + Expr getLhs() { + result = Synth::convertExprFromRaw(Synth::convertRangeToRaw(this).(Raw::Range).getLhs()) + } + + /** + * Holds if `getLhs()` exists. + */ + final predicate hasLhs() { exists(this.getLhs()) } + + /** + * Gets the rhs of this range, if it exists. + */ + Expr getRhs() { + result = Synth::convertExprFromRaw(Synth::convertRangeToRaw(this).(Raw::Range).getRhs()) + } + + /** + * Holds if `getRhs()` exists. + */ + final predicate hasRhs() { exists(this.getRhs()) } + + /** + * Holds if this range is inclusive. + */ + predicate isInclusive() { Synth::convertRangeToRaw(this).(Raw::Range).isInclusive() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/RangePat.qll b/rust/ql/lib/codeql/rust/generated/RangePat.qll new file mode 100644 index 000000000000..f0cfa96e869a --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/RangePat.qll @@ -0,0 +1,48 @@ +// generated by codegen +/** + * This module provides the generated definition of `RangePat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `RangePat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::RangePat` class directly. + * Use the subclass `RangePat`, where the following predicates are available. + */ + class RangePat extends Synth::TRangePat, Pat { + override string getAPrimaryQlClass() { result = "RangePat" } + + /** + * Gets the start of this range pat, if it exists. + */ + Pat getStart() { + result = + Synth::convertPatFromRaw(Synth::convertRangePatToRaw(this).(Raw::RangePat).getStart()) + } + + /** + * Holds if `getStart()` exists. + */ + final predicate hasStart() { exists(this.getStart()) } + + /** + * Gets the end of this range pat, if it exists. + */ + Pat getEnd() { + result = Synth::convertPatFromRaw(Synth::convertRangePatToRaw(this).(Raw::RangePat).getEnd()) + } + + /** + * Holds if `getEnd()` exists. + */ + final predicate hasEnd() { exists(this.getEnd()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 7f7aaba7ae25..1718b94775cf 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -79,6 +79,317 @@ module Raw { */ class Declaration extends @declaration, Locatable { } + /** + * INTERNAL: Do not use. + */ + class Expr extends @expr, Locatable { } + + /** + * INTERNAL: Do not use. + */ + class MatchArm extends @match_arm, Locatable { + override string toString() { result = "MatchArm" } + + /** + * Gets the pat of this match arm. + */ + Pat getPat() { match_arms(this, result, _) } + + /** + * Gets the guard of this match arm, if it exists. + */ + Expr getGuard() { match_arm_guards(this, result) } + + /** + * Gets the expression of this match arm. + */ + Expr getExpr() { match_arms(this, _, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Pat extends @pat, Locatable { } + + /** + * INTERNAL: Do not use. + */ + class Stmt extends @stmt, Locatable { } + + /** + * INTERNAL: Do not use. + */ + class TypeRef extends @type_ref, Locatable { + override string toString() { result = "TypeRef" } + } + + /** + * INTERNAL: Do not use. + */ + class Array extends @array, Expr { + override string toString() { result = "Array" } + } + + /** + * INTERNAL: Do not use. + */ + class Await extends @await, Expr { + override string toString() { result = "Await" } + + /** + * Gets the expression of this await. + */ + Expr getExpr() { awaits(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Become extends @become, Expr { + override string toString() { result = "Become" } + + /** + * Gets the expression of this become. + */ + Expr getExpr() { becomes(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class BinaryOp extends @binary_op, Expr { + override string toString() { result = "BinaryOp" } + + /** + * Gets the lhs of this binary op. + */ + Expr getLhs() { binary_ops(this, result, _) } + + /** + * Gets the rhs of this binary op. + */ + Expr getRhs() { binary_ops(this, _, result) } + + /** + * Gets the op of this binary op, if it exists. + */ + string getOp() { binary_op_ops(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class BindPat extends @bind_pat, Pat { + override string toString() { result = "BindPat" } + + /** + * Gets the binding of this bind pat. + */ + string getBindingId() { bind_pats(this, result) } + + /** + * Gets the subpat of this bind pat, if it exists. + */ + Pat getSubpat() { bind_pat_subpats(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Block extends @block, Expr { + /** + * Gets the `index`th statement of this block (0-based). + */ + Stmt getStatement(int index) { block_statements(this, index, result) } + + /** + * Gets the tail of this block, if it exists. + */ + Expr getTail() { block_tails(this, result) } + + /** + * Gets the label of this block, if it exists. + */ + string getLabel() { block_labels(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Box extends @box, Expr { + override string toString() { result = "Box" } + + /** + * Gets the expression of this box. + */ + Expr getExpr() { boxes(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class BoxPat extends @box_pat, Pat { + override string toString() { result = "BoxPat" } + + /** + * Gets the inner of this box pat. + */ + Pat getInner() { box_pats(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Break extends @break, Expr { + override string toString() { result = "Break" } + + /** + * Gets the expression of this break, if it exists. + */ + Expr getExpr() { break_exprs(this, result) } + + /** + * Gets the label of this break, if it exists. + */ + string getLabel() { break_labels(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Call extends @call, Expr { + override string toString() { result = "Call" } + + /** + * Gets the callee of this call. + */ + Expr getCallee() { calls(this, result) } + + /** + * Gets the `index`th argument of this call (0-based). + */ + Expr getArg(int index) { call_args(this, index, result) } + + /** + * Holds if this call is assignee expression. + */ + predicate isAssigneeExpr() { call_is_assignee_expr(this) } + } + + /** + * INTERNAL: Do not use. + */ + class Cast extends @cast, Expr { + override string toString() { result = "Cast" } + + /** + * Gets the expression of this cast. + */ + Expr getExpr() { casts(this, result, _) } + + /** + * Gets the type reference of this cast. + */ + TypeRef getTypeRef() { casts(this, _, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Closure extends @closure, Expr { + override string toString() { result = "Closure" } + + /** + * Gets the `index`th argument of this closure (0-based). + */ + Pat getArg(int index) { closure_args(this, index, result) } + + /** + * Gets the `index`th argument type of this closure (0-based). + */ + TypeRef getArgType(int index) { closure_arg_types(this, index, result) } + + /** + * Gets the ret type of this closure, if it exists. + */ + TypeRef getRetType() { closure_ret_types(this, result) } + + /** + * Gets the body of this closure. + */ + Expr getBody() { closures(this, result) } + + /** + * Holds if this closure is move. + */ + predicate isMove() { closure_is_move(this) } + } + + /** + * INTERNAL: Do not use. + */ + class Const extends @const, Expr { + override string toString() { result = "Const" } + } + + /** + * INTERNAL: Do not use. + */ + class ConstBlockPat extends @const_block_pat, Pat { + override string toString() { result = "ConstBlockPat" } + + /** + * Gets the expression of this const block pat. + */ + Expr getExpr() { const_block_pats(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Continue extends @continue, Expr { + override string toString() { result = "Continue" } + + /** + * Gets the label of this continue, if it exists. + */ + string getLabel() { continue_labels(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class ExprStmt extends @expr_stmt, Stmt { + override string toString() { result = "ExprStmt" } + + /** + * Gets the expression of this expression statement. + */ + Expr getExpr() { expr_stmts(this, result) } + + /** + * Holds if this expression statement has semi. + */ + predicate hasSemi() { expr_stmt_has_semi(this) } + } + + /** + * INTERNAL: Do not use. + */ + class Field extends @field, Expr { + override string toString() { result = "Field" } + + /** + * Gets the expression of this field. + */ + Expr getExpr() { fields(this, result, _) } + + /** + * Gets the name of this field. + */ + string getName() { fields(this, _, result) } + } + /** * INTERNAL: Do not use. */ @@ -88,7 +399,203 @@ module Raw { /** * Gets the name of this function. */ - string getName() { functions(this, result) } + string getName() { functions(this, result, _) } + + /** + * Gets the body of this function. + */ + Expr getBody() { functions(this, _, result) } + } + + /** + * INTERNAL: Do not use. + */ + class If extends @if, Expr { + override string toString() { result = "If" } + + /** + * Gets the condition of this if. + */ + Expr getCondition() { ifs(this, result, _) } + + /** + * Gets the then branch of this if. + */ + Expr getThenBranch() { ifs(this, _, result) } + + /** + * Gets the else branch of this if, if it exists. + */ + Expr getElseBranch() { if_else_branches(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class IfLet extends @if_let, Stmt { + override string toString() { result = "IfLet" } + + /** + * Gets the pat of this if let. + */ + Pat getPat() { if_lets(this, result) } + + /** + * Gets the type reference of this if let, if it exists. + */ + TypeRef getTypeRef() { if_let_type_refs(this, result) } + + /** + * Gets the initializer of this if let, if it exists. + */ + Expr getInitializer() { if_let_initializers(this, result) } + + /** + * Gets the else branch of this if let, if it exists. + */ + Expr getElseBranch() { if_let_else_branches(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Index extends @index, Expr { + override string toString() { result = "Index" } + + /** + * Gets the base of this index. + */ + Expr getBase() { indices(this, result, _) } + + /** + * Gets the index of this index. + */ + Expr getIndex() { indices(this, _, result) } + + /** + * Holds if this index is assignee expression. + */ + predicate isAssigneeExpr() { index_is_assignee_expr(this) } + } + + /** + * INTERNAL: Do not use. + */ + class InlineAsm extends @inline_asm, Expr { + override string toString() { result = "InlineAsm" } + } + + /** + * INTERNAL: Do not use. + */ + class ItemStmt extends @item_stmt, Stmt { + override string toString() { result = "ItemStmt" } + } + + /** + * INTERNAL: Do not use. + */ + class Let extends @let, Expr { + override string toString() { result = "Let" } + + /** + * Gets the pat of this let. + */ + Pat getPat() { lets(this, result, _) } + + /** + * Gets the expression of this let. + */ + Expr getExpr() { lets(this, _, result) } + } + + /** + * INTERNAL: Do not use. + */ + class LitPat extends @lit_pat, Pat { + override string toString() { result = "LitPat" } + + /** + * Gets the expression of this lit pat. + */ + Expr getExpr() { lit_pats(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Literal extends @literal, Expr { + override string toString() { result = "Literal" } + } + + /** + * INTERNAL: Do not use. + */ + class Loop extends @loop, Expr { + override string toString() { result = "Loop" } + + /** + * Gets the body of this loop. + */ + Expr getBody() { loops(this, result) } + + /** + * Gets the label of this loop, if it exists. + */ + string getLabel() { loop_labels(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Match extends @match, Expr { + override string toString() { result = "Match" } + + /** + * Gets the expression of this match. + */ + Expr getExpr() { matches(this, result) } + + /** + * Gets the `index`th branch of this match (0-based). + */ + MatchArm getBranch(int index) { match_branches(this, index, result) } + } + + /** + * INTERNAL: Do not use. + */ + class MethodCall extends @method_call, Expr { + override string toString() { result = "MethodCall" } + + /** + * Gets the receiver of this method call. + */ + Expr getReceiver() { method_calls(this, result, _) } + + /** + * Gets the method name of this method call. + */ + string getMethodName() { method_calls(this, _, result) } + + /** + * Gets the `index`th argument of this method call (0-based). + */ + Expr getArg(int index) { method_call_args(this, index, result) } + } + + /** + * INTERNAL: Do not use. + */ + class MissingExpr extends @missing_expr, Expr { + override string toString() { result = "MissingExpr" } + } + + /** + * INTERNAL: Do not use. + */ + class MissingPat extends @missing_pat, Pat { + override string toString() { result = "MissingPat" } } /** @@ -102,4 +609,263 @@ module Raw { */ Declaration getDeclaration(int index) { module_declarations(this, index, result) } } + + /** + * INTERNAL: Do not use. + */ + class OffsetOf extends @offset_of, Expr { + override string toString() { result = "OffsetOf" } + } + + /** + * INTERNAL: Do not use. + */ + class OrPat extends @or_pat, Pat { + override string toString() { result = "OrPat" } + + /** + * Gets the `index`th argument of this or pat (0-based). + */ + Pat getArg(int index) { or_pat_args(this, index, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Path extends @path, Expr { + override string toString() { result = "Path" } + } + + /** + * INTERNAL: Do not use. + */ + class PathPat extends @path_pat, Pat { + override string toString() { result = "PathPat" } + } + + /** + * INTERNAL: Do not use. + */ + class Range extends @range, Expr { + override string toString() { result = "Range" } + + /** + * Gets the lhs of this range, if it exists. + */ + Expr getLhs() { range_lhs(this, result) } + + /** + * Gets the rhs of this range, if it exists. + */ + Expr getRhs() { range_rhs(this, result) } + + /** + * Holds if this range is inclusive. + */ + predicate isInclusive() { range_is_inclusive(this) } + } + + /** + * INTERNAL: Do not use. + */ + class RangePat extends @range_pat, Pat { + override string toString() { result = "RangePat" } + + /** + * Gets the start of this range pat, if it exists. + */ + Pat getStart() { range_pat_starts(this, result) } + + /** + * Gets the end of this range pat, if it exists. + */ + Pat getEnd() { range_pat_ends(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class RecordLit extends @record_lit, Expr { + override string toString() { result = "RecordLit" } + } + + /** + * INTERNAL: Do not use. + */ + class RecordPat extends @record_pat, Pat { + override string toString() { result = "RecordPat" } + } + + /** + * INTERNAL: Do not use. + */ + class Ref extends @ref, Expr { + override string toString() { result = "Ref" } + + /** + * Gets the expression of this reference. + */ + Expr getExpr() { refs(this, result) } + + /** + * Holds if this reference is raw. + */ + predicate isRaw() { ref_is_raw(this) } + + /** + * Holds if this reference is mut. + */ + predicate isMut() { ref_is_mut(this) } + } + + /** + * INTERNAL: Do not use. + */ + class RefPat extends @ref_pat, Pat { + override string toString() { result = "RefPat" } + + /** + * Gets the pat of this reference pat. + */ + Pat getPat() { ref_pats(this, result) } + + /** + * Holds if this reference pat is mut. + */ + predicate isMut() { ref_pat_is_mut(this) } + } + + /** + * INTERNAL: Do not use. + */ + class Return extends @return, Expr { + override string toString() { result = "Return" } + + /** + * Gets the expression of this return, if it exists. + */ + Expr getExpr() { return_exprs(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class SlicePat extends @slice_pat, Pat { + override string toString() { result = "SlicePat" } + + /** + * Gets the `index`th prefix of this slice pat (0-based). + */ + Pat getPrefix(int index) { slice_pat_prefixes(this, index, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Tuple extends @tuple, Expr { + override string toString() { result = "Tuple" } + + /** + * Gets the `index`th expression of this tuple (0-based). + */ + Expr getExpr(int index) { tuple_exprs(this, index, result) } + + /** + * Holds if this tuple is assignee expression. + */ + predicate isAssigneeExpr() { tuple_is_assignee_expr(this) } + } + + /** + * INTERNAL: Do not use. + */ + class TuplePat extends @tuple_pat, Pat { + override string toString() { result = "TuplePat" } + + /** + * Gets the `index`th argument of this tuple pat (0-based). + */ + Pat getArg(int index) { tuple_pat_args(this, index, result) } + + /** + * Gets the ellipsis of this tuple pat, if it exists. + */ + int getEllipsis() { tuple_pat_ellipses(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class TupleStructPat extends @tuple_struct_pat, Pat { + override string toString() { result = "TupleStructPat" } + } + + /** + * INTERNAL: Do not use. + */ + class UnaryExpr extends @unary_expr, Expr { + override string toString() { result = "UnaryExpr" } + + /** + * Gets the expression of this unary expression. + */ + Expr getExpr() { unary_exprs(this, result, _) } + + /** + * Gets the op of this unary expression. + */ + string getOp() { unary_exprs(this, _, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Underscore extends @underscore, Expr { + override string toString() { result = "Underscore" } + } + + /** + * INTERNAL: Do not use. + */ + class WildPat extends @wild_pat, Pat { + override string toString() { result = "WildPat" } + } + + /** + * INTERNAL: Do not use. + */ + class Yeet extends @yeet, Expr { + override string toString() { result = "Yeet" } + + /** + * Gets the expression of this yeet, if it exists. + */ + Expr getExpr() { yeet_exprs(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Yield extends @yield, Expr { + override string toString() { result = "Yield" } + + /** + * Gets the expression of this yield, if it exists. + */ + Expr getExpr() { yield_exprs(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class Async extends @async, Block { + override string toString() { result = "Async" } + } + + /** + * INTERNAL: Do not use. + */ + class Unsafe extends @unsafe, Block { + override string toString() { result = "Unsafe" } + } } diff --git a/rust/ql/lib/codeql/rust/generated/RecordLit.qll b/rust/ql/lib/codeql/rust/generated/RecordLit.qll new file mode 100644 index 000000000000..2215c61c6ecf --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/RecordLit.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `RecordLit`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `RecordLit` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::RecordLit` class directly. + * Use the subclass `RecordLit`, where the following predicates are available. + */ + class RecordLit extends Synth::TRecordLit, Expr { + override string getAPrimaryQlClass() { result = "RecordLit" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/RecordPat.qll b/rust/ql/lib/codeql/rust/generated/RecordPat.qll new file mode 100644 index 000000000000..f3aeb3e609ee --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/RecordPat.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `RecordPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `RecordPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::RecordPat` class directly. + * Use the subclass `RecordPat`, where the following predicates are available. + */ + class RecordPat extends Synth::TRecordPat, Pat { + override string getAPrimaryQlClass() { result = "RecordPat" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Ref.qll b/rust/ql/lib/codeql/rust/generated/Ref.qll new file mode 100644 index 000000000000..24b27421a7cb --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Ref.qll @@ -0,0 +1,40 @@ +// generated by codegen +/** + * This module provides the generated definition of `Ref`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Ref` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Ref` class directly. + * Use the subclass `Ref`, where the following predicates are available. + */ + class Ref extends Synth::TRef, Expr { + override string getAPrimaryQlClass() { result = "Ref" } + + /** + * Gets the expression of this reference. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertRefToRaw(this).(Raw::Ref).getExpr()) + } + + /** + * Holds if this reference is raw. + */ + predicate isRaw() { Synth::convertRefToRaw(this).(Raw::Ref).isRaw() } + + /** + * Holds if this reference is mut. + */ + predicate isMut() { Synth::convertRefToRaw(this).(Raw::Ref).isMut() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/RefPat.qll b/rust/ql/lib/codeql/rust/generated/RefPat.qll new file mode 100644 index 000000000000..33674b00330b --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/RefPat.qll @@ -0,0 +1,35 @@ +// generated by codegen +/** + * This module provides the generated definition of `RefPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `RefPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::RefPat` class directly. + * Use the subclass `RefPat`, where the following predicates are available. + */ + class RefPat extends Synth::TRefPat, Pat { + override string getAPrimaryQlClass() { result = "RefPat" } + + /** + * Gets the pat of this reference pat. + */ + Pat getPat() { + result = Synth::convertPatFromRaw(Synth::convertRefPatToRaw(this).(Raw::RefPat).getPat()) + } + + /** + * Holds if this reference pat is mut. + */ + predicate isMut() { Synth::convertRefPatToRaw(this).(Raw::RefPat).isMut() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Return.qll b/rust/ql/lib/codeql/rust/generated/Return.qll new file mode 100644 index 000000000000..724970d09587 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Return.qll @@ -0,0 +1,35 @@ +// generated by codegen +/** + * This module provides the generated definition of `Return`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Return` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Return` class directly. + * Use the subclass `Return`, where the following predicates are available. + */ + class Return extends Synth::TReturn, Expr { + override string getAPrimaryQlClass() { result = "Return" } + + /** + * Gets the expression of this return, if it exists. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertReturnToRaw(this).(Raw::Return).getExpr()) + } + + /** + * Holds if `getExpr()` exists. + */ + final predicate hasExpr() { exists(this.getExpr()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/SlicePat.qll b/rust/ql/lib/codeql/rust/generated/SlicePat.qll new file mode 100644 index 000000000000..a85ad23a25cf --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/SlicePat.qll @@ -0,0 +1,41 @@ +// generated by codegen +/** + * This module provides the generated definition of `SlicePat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `SlicePat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::SlicePat` class directly. + * Use the subclass `SlicePat`, where the following predicates are available. + */ + class SlicePat extends Synth::TSlicePat, Pat { + override string getAPrimaryQlClass() { result = "SlicePat" } + + /** + * Gets the `index`th prefix of this slice pat (0-based). + */ + Pat getPrefix(int index) { + result = + Synth::convertPatFromRaw(Synth::convertSlicePatToRaw(this).(Raw::SlicePat).getPrefix(index)) + } + + /** + * Gets any of the prefixes of this slice pat. + */ + final Pat getAPrefix() { result = this.getPrefix(_) } + + /** + * Gets the number of prefixes of this slice pat. + */ + final int getNumberOfPrefixes() { result = count(int i | exists(this.getPrefix(i))) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Stmt.qll b/rust/ql/lib/codeql/rust/generated/Stmt.qll new file mode 100644 index 000000000000..48c1c8832994 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Stmt.qll @@ -0,0 +1,21 @@ +// generated by codegen +/** + * This module provides the generated definition of `Stmt`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Locatable + +/** + * INTERNAL: This module contains the fully generated definition of `Stmt` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Stmt` class directly. + * Use the subclass `Stmt`, where the following predicates are available. + */ + class Stmt extends Synth::TStmt, Locatable { } +} diff --git a/rust/ql/lib/codeql/rust/generated/Synth.qll b/rust/ql/lib/codeql/rust/generated/Synth.qll index c9ab652304b8..7be1654bae51 100644 --- a/rust/ql/lib/codeql/rust/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/generated/Synth.qll @@ -15,6 +15,66 @@ module Synth { */ cached newtype TElement = + /** + * INTERNAL: Do not use. + */ + TArray(Raw::Array id) { constructArray(id) } or + /** + * INTERNAL: Do not use. + */ + TAsync(Raw::Async id) { constructAsync(id) } or + /** + * INTERNAL: Do not use. + */ + TAwait(Raw::Await id) { constructAwait(id) } or + /** + * INTERNAL: Do not use. + */ + TBecome(Raw::Become id) { constructBecome(id) } or + /** + * INTERNAL: Do not use. + */ + TBinaryOp(Raw::BinaryOp id) { constructBinaryOp(id) } or + /** + * INTERNAL: Do not use. + */ + TBindPat(Raw::BindPat id) { constructBindPat(id) } or + /** + * INTERNAL: Do not use. + */ + TBox(Raw::Box id) { constructBox(id) } or + /** + * INTERNAL: Do not use. + */ + TBoxPat(Raw::BoxPat id) { constructBoxPat(id) } or + /** + * INTERNAL: Do not use. + */ + TBreak(Raw::Break id) { constructBreak(id) } or + /** + * INTERNAL: Do not use. + */ + TCall(Raw::Call id) { constructCall(id) } or + /** + * INTERNAL: Do not use. + */ + TCast(Raw::Cast id) { constructCast(id) } or + /** + * INTERNAL: Do not use. + */ + TClosure(Raw::Closure id) { constructClosure(id) } or + /** + * INTERNAL: Do not use. + */ + TConst(Raw::Const id) { constructConst(id) } or + /** + * INTERNAL: Do not use. + */ + TConstBlockPat(Raw::ConstBlockPat id) { constructConstBlockPat(id) } or + /** + * INTERNAL: Do not use. + */ + TContinue(Raw::Continue id) { constructContinue(id) } or /** * INTERNAL: Do not use. */ @@ -23,14 +83,150 @@ module Synth { * INTERNAL: Do not use. */ TDbLocation(Raw::DbLocation id) { constructDbLocation(id) } or + /** + * INTERNAL: Do not use. + */ + TExprStmt(Raw::ExprStmt id) { constructExprStmt(id) } or + /** + * INTERNAL: Do not use. + */ + TField(Raw::Field id) { constructField(id) } or /** * INTERNAL: Do not use. */ TFunction(Raw::Function id) { constructFunction(id) } or + /** + * INTERNAL: Do not use. + */ + TIf(Raw::If id) { constructIf(id) } or + /** + * INTERNAL: Do not use. + */ + TIfLet(Raw::IfLet id) { constructIfLet(id) } or + /** + * INTERNAL: Do not use. + */ + TIndex(Raw::Index id) { constructIndex(id) } or + /** + * INTERNAL: Do not use. + */ + TInlineAsm(Raw::InlineAsm id) { constructInlineAsm(id) } or + /** + * INTERNAL: Do not use. + */ + TItemStmt(Raw::ItemStmt id) { constructItemStmt(id) } or + /** + * INTERNAL: Do not use. + */ + TLet(Raw::Let id) { constructLet(id) } or + /** + * INTERNAL: Do not use. + */ + TLitPat(Raw::LitPat id) { constructLitPat(id) } or + /** + * INTERNAL: Do not use. + */ + TLiteral(Raw::Literal id) { constructLiteral(id) } or + /** + * INTERNAL: Do not use. + */ + TLoop(Raw::Loop id) { constructLoop(id) } or + /** + * INTERNAL: Do not use. + */ + TMatch(Raw::Match id) { constructMatch(id) } or + /** + * INTERNAL: Do not use. + */ + TMatchArm(Raw::MatchArm id) { constructMatchArm(id) } or + /** + * INTERNAL: Do not use. + */ + TMethodCall(Raw::MethodCall id) { constructMethodCall(id) } or + /** + * INTERNAL: Do not use. + */ + TMissingExpr(Raw::MissingExpr id) { constructMissingExpr(id) } or + /** + * INTERNAL: Do not use. + */ + TMissingPat(Raw::MissingPat id) { constructMissingPat(id) } or /** * INTERNAL: Do not use. */ TModule(Raw::Module id) { constructModule(id) } or + /** + * INTERNAL: Do not use. + */ + TOffsetOf(Raw::OffsetOf id) { constructOffsetOf(id) } or + /** + * INTERNAL: Do not use. + */ + TOrPat(Raw::OrPat id) { constructOrPat(id) } or + /** + * INTERNAL: Do not use. + */ + TPath(Raw::Path id) { constructPath(id) } or + /** + * INTERNAL: Do not use. + */ + TPathPat(Raw::PathPat id) { constructPathPat(id) } or + /** + * INTERNAL: Do not use. + */ + TRange(Raw::Range id) { constructRange(id) } or + /** + * INTERNAL: Do not use. + */ + TRangePat(Raw::RangePat id) { constructRangePat(id) } or + /** + * INTERNAL: Do not use. + */ + TRecordLit(Raw::RecordLit id) { constructRecordLit(id) } or + /** + * INTERNAL: Do not use. + */ + TRecordPat(Raw::RecordPat id) { constructRecordPat(id) } or + /** + * INTERNAL: Do not use. + */ + TRef(Raw::Ref id) { constructRef(id) } or + /** + * INTERNAL: Do not use. + */ + TRefPat(Raw::RefPat id) { constructRefPat(id) } or + /** + * INTERNAL: Do not use. + */ + TReturn(Raw::Return id) { constructReturn(id) } or + /** + * INTERNAL: Do not use. + */ + TSlicePat(Raw::SlicePat id) { constructSlicePat(id) } or + /** + * INTERNAL: Do not use. + */ + TTuple(Raw::Tuple id) { constructTuple(id) } or + /** + * INTERNAL: Do not use. + */ + TTuplePat(Raw::TuplePat id) { constructTuplePat(id) } or + /** + * INTERNAL: Do not use. + */ + TTupleStructPat(Raw::TupleStructPat id) { constructTupleStructPat(id) } or + /** + * INTERNAL: Do not use. + */ + TTypeRef(Raw::TypeRef id) { constructTypeRef(id) } or + /** + * INTERNAL: Do not use. + */ + TUnaryExpr(Raw::UnaryExpr id) { constructUnaryExpr(id) } or + /** + * INTERNAL: Do not use. + */ + TUnderscore(Raw::Underscore id) { constructUnderscore(id) } or /** * INTERNAL: Do not use. */ @@ -38,143 +234,918 @@ module Synth { /** * INTERNAL: Do not use. */ - TUnknownLocation() + TUnknownLocation() or + /** + * INTERNAL: Do not use. + */ + TUnsafe(Raw::Unsafe id) { constructUnsafe(id) } or + /** + * INTERNAL: Do not use. + */ + TWildPat(Raw::WildPat id) { constructWildPat(id) } or + /** + * INTERNAL: Do not use. + */ + TYeet(Raw::Yeet id) { constructYeet(id) } or + /** + * INTERNAL: Do not use. + */ + TYield(Raw::Yield id) { constructYield(id) } + + /** + * INTERNAL: Do not use. + */ + class TBlock = TAsync or TUnsafe; + + /** + * INTERNAL: Do not use. + */ + class TDeclaration = TFunction or TModule; + + /** + * INTERNAL: Do not use. + */ + class TExpr = + TArray or TAwait or TBecome or TBinaryOp or TBlock or TBox or TBreak or TCall or TCast or + TClosure or TConst or TContinue or TField or TIf or TIndex or TInlineAsm or TLet or + TLiteral or TLoop or TMatch or TMethodCall or TMissingExpr or TOffsetOf or TPath or + TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryExpr or TUnderscore or TYeet or + TYield; + + /** + * INTERNAL: Do not use. + */ + class TFile = TDbFile or TUnknownFile; + + /** + * INTERNAL: Do not use. + */ + class TLocatable = TDeclaration or TExpr or TMatchArm or TPat or TStmt or TTypeRef; + + /** + * INTERNAL: Do not use. + */ + class TLocation = TDbLocation or TUnknownLocation; + + /** + * INTERNAL: Do not use. + */ + class TPat = + TBindPat or TBoxPat or TConstBlockPat or TLitPat or TMissingPat or TOrPat or TPathPat or + TRangePat or TRecordPat or TRefPat or TSlicePat or TTuplePat or TTupleStructPat or TWildPat; + + /** + * INTERNAL: Do not use. + */ + class TStmt = TExprStmt or TIfLet or TItemStmt; + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TArray`, if possible. + */ + cached + TArray convertArrayFromRaw(Raw::Element e) { result = TArray(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TAsync`, if possible. + */ + cached + TAsync convertAsyncFromRaw(Raw::Element e) { result = TAsync(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TAwait`, if possible. + */ + cached + TAwait convertAwaitFromRaw(Raw::Element e) { result = TAwait(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBecome`, if possible. + */ + cached + TBecome convertBecomeFromRaw(Raw::Element e) { result = TBecome(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBinaryOp`, if possible. + */ + cached + TBinaryOp convertBinaryOpFromRaw(Raw::Element e) { result = TBinaryOp(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBindPat`, if possible. + */ + cached + TBindPat convertBindPatFromRaw(Raw::Element e) { result = TBindPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBox`, if possible. + */ + cached + TBox convertBoxFromRaw(Raw::Element e) { result = TBox(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBoxPat`, if possible. + */ + cached + TBoxPat convertBoxPatFromRaw(Raw::Element e) { result = TBoxPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBreak`, if possible. + */ + cached + TBreak convertBreakFromRaw(Raw::Element e) { result = TBreak(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TCall`, if possible. + */ + cached + TCall convertCallFromRaw(Raw::Element e) { result = TCall(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TCast`, if possible. + */ + cached + TCast convertCastFromRaw(Raw::Element e) { result = TCast(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TClosure`, if possible. + */ + cached + TClosure convertClosureFromRaw(Raw::Element e) { result = TClosure(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TConst`, if possible. + */ + cached + TConst convertConstFromRaw(Raw::Element e) { result = TConst(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TConstBlockPat`, if possible. + */ + cached + TConstBlockPat convertConstBlockPatFromRaw(Raw::Element e) { result = TConstBlockPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TContinue`, if possible. + */ + cached + TContinue convertContinueFromRaw(Raw::Element e) { result = TContinue(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TDbFile`, if possible. + */ + cached + TDbFile convertDbFileFromRaw(Raw::Element e) { result = TDbFile(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TDbLocation`, if possible. + */ + cached + TDbLocation convertDbLocationFromRaw(Raw::Element e) { result = TDbLocation(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TExprStmt`, if possible. + */ + cached + TExprStmt convertExprStmtFromRaw(Raw::Element e) { result = TExprStmt(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TField`, if possible. + */ + cached + TField convertFieldFromRaw(Raw::Element e) { result = TField(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TFunction`, if possible. + */ + cached + TFunction convertFunctionFromRaw(Raw::Element e) { result = TFunction(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TIf`, if possible. + */ + cached + TIf convertIfFromRaw(Raw::Element e) { result = TIf(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TIfLet`, if possible. + */ + cached + TIfLet convertIfLetFromRaw(Raw::Element e) { result = TIfLet(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TIndex`, if possible. + */ + cached + TIndex convertIndexFromRaw(Raw::Element e) { result = TIndex(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TInlineAsm`, if possible. + */ + cached + TInlineAsm convertInlineAsmFromRaw(Raw::Element e) { result = TInlineAsm(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TItemStmt`, if possible. + */ + cached + TItemStmt convertItemStmtFromRaw(Raw::Element e) { result = TItemStmt(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TLet`, if possible. + */ + cached + TLet convertLetFromRaw(Raw::Element e) { result = TLet(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TLitPat`, if possible. + */ + cached + TLitPat convertLitPatFromRaw(Raw::Element e) { result = TLitPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TLiteral`, if possible. + */ + cached + TLiteral convertLiteralFromRaw(Raw::Element e) { result = TLiteral(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TLoop`, if possible. + */ + cached + TLoop convertLoopFromRaw(Raw::Element e) { result = TLoop(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TMatch`, if possible. + */ + cached + TMatch convertMatchFromRaw(Raw::Element e) { result = TMatch(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TMatchArm`, if possible. + */ + cached + TMatchArm convertMatchArmFromRaw(Raw::Element e) { result = TMatchArm(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TMethodCall`, if possible. + */ + cached + TMethodCall convertMethodCallFromRaw(Raw::Element e) { result = TMethodCall(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TMissingExpr`, if possible. + */ + cached + TMissingExpr convertMissingExprFromRaw(Raw::Element e) { result = TMissingExpr(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TMissingPat`, if possible. + */ + cached + TMissingPat convertMissingPatFromRaw(Raw::Element e) { result = TMissingPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TModule`, if possible. + */ + cached + TModule convertModuleFromRaw(Raw::Element e) { result = TModule(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TOffsetOf`, if possible. + */ + cached + TOffsetOf convertOffsetOfFromRaw(Raw::Element e) { result = TOffsetOf(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TOrPat`, if possible. + */ + cached + TOrPat convertOrPatFromRaw(Raw::Element e) { result = TOrPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TPath`, if possible. + */ + cached + TPath convertPathFromRaw(Raw::Element e) { result = TPath(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TPathPat`, if possible. + */ + cached + TPathPat convertPathPatFromRaw(Raw::Element e) { result = TPathPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRange`, if possible. + */ + cached + TRange convertRangeFromRaw(Raw::Element e) { result = TRange(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRangePat`, if possible. + */ + cached + TRangePat convertRangePatFromRaw(Raw::Element e) { result = TRangePat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRecordLit`, if possible. + */ + cached + TRecordLit convertRecordLitFromRaw(Raw::Element e) { result = TRecordLit(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRecordPat`, if possible. + */ + cached + TRecordPat convertRecordPatFromRaw(Raw::Element e) { result = TRecordPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRef`, if possible. + */ + cached + TRef convertRefFromRaw(Raw::Element e) { result = TRef(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRefPat`, if possible. + */ + cached + TRefPat convertRefPatFromRaw(Raw::Element e) { result = TRefPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TReturn`, if possible. + */ + cached + TReturn convertReturnFromRaw(Raw::Element e) { result = TReturn(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TSlicePat`, if possible. + */ + cached + TSlicePat convertSlicePatFromRaw(Raw::Element e) { result = TSlicePat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TTuple`, if possible. + */ + cached + TTuple convertTupleFromRaw(Raw::Element e) { result = TTuple(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TTuplePat`, if possible. + */ + cached + TTuplePat convertTuplePatFromRaw(Raw::Element e) { result = TTuplePat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TTupleStructPat`, if possible. + */ + cached + TTupleStructPat convertTupleStructPatFromRaw(Raw::Element e) { result = TTupleStructPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TTypeRef`, if possible. + */ + cached + TTypeRef convertTypeRefFromRaw(Raw::Element e) { result = TTypeRef(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TUnaryExpr`, if possible. + */ + cached + TUnaryExpr convertUnaryExprFromRaw(Raw::Element e) { result = TUnaryExpr(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TUnderscore`, if possible. + */ + cached + TUnderscore convertUnderscoreFromRaw(Raw::Element e) { result = TUnderscore(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TUnknownFile`, if possible. + */ + cached + TUnknownFile convertUnknownFileFromRaw(Raw::Element e) { none() } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TUnknownLocation`, if possible. + */ + cached + TUnknownLocation convertUnknownLocationFromRaw(Raw::Element e) { none() } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TUnsafe`, if possible. + */ + cached + TUnsafe convertUnsafeFromRaw(Raw::Element e) { result = TUnsafe(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TWildPat`, if possible. + */ + cached + TWildPat convertWildPatFromRaw(Raw::Element e) { result = TWildPat(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TYeet`, if possible. + */ + cached + TYeet convertYeetFromRaw(Raw::Element e) { result = TYeet(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TYield`, if possible. + */ + cached + TYield convertYieldFromRaw(Raw::Element e) { result = TYield(e) } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TBlock`, if possible. + */ + cached + TBlock convertBlockFromRaw(Raw::Element e) { + result = convertAsyncFromRaw(e) + or + result = convertUnsafeFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TDeclaration`, if possible. + */ + cached + TDeclaration convertDeclarationFromRaw(Raw::Element e) { + result = convertFunctionFromRaw(e) + or + result = convertModuleFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TElement`, if possible. + */ + cached + TElement convertElementFromRaw(Raw::Element e) { + result = convertFileFromRaw(e) + or + result = convertLocatableFromRaw(e) + or + result = convertLocationFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TExpr`, if possible. + */ + cached + TExpr convertExprFromRaw(Raw::Element e) { + result = convertArrayFromRaw(e) + or + result = convertAwaitFromRaw(e) + or + result = convertBecomeFromRaw(e) + or + result = convertBinaryOpFromRaw(e) + or + result = convertBlockFromRaw(e) + or + result = convertBoxFromRaw(e) + or + result = convertBreakFromRaw(e) + or + result = convertCallFromRaw(e) + or + result = convertCastFromRaw(e) + or + result = convertClosureFromRaw(e) + or + result = convertConstFromRaw(e) + or + result = convertContinueFromRaw(e) + or + result = convertFieldFromRaw(e) + or + result = convertIfFromRaw(e) + or + result = convertIndexFromRaw(e) + or + result = convertInlineAsmFromRaw(e) + or + result = convertLetFromRaw(e) + or + result = convertLiteralFromRaw(e) + or + result = convertLoopFromRaw(e) + or + result = convertMatchFromRaw(e) + or + result = convertMethodCallFromRaw(e) + or + result = convertMissingExprFromRaw(e) + or + result = convertOffsetOfFromRaw(e) + or + result = convertPathFromRaw(e) + or + result = convertRangeFromRaw(e) + or + result = convertRecordLitFromRaw(e) + or + result = convertRefFromRaw(e) + or + result = convertReturnFromRaw(e) + or + result = convertTupleFromRaw(e) + or + result = convertUnaryExprFromRaw(e) + or + result = convertUnderscoreFromRaw(e) + or + result = convertYeetFromRaw(e) + or + result = convertYieldFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TFile`, if possible. + */ + cached + TFile convertFileFromRaw(Raw::Element e) { + result = convertDbFileFromRaw(e) + or + result = convertUnknownFileFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TLocatable`, if possible. + */ + cached + TLocatable convertLocatableFromRaw(Raw::Element e) { + result = convertDeclarationFromRaw(e) + or + result = convertExprFromRaw(e) + or + result = convertMatchArmFromRaw(e) + or + result = convertPatFromRaw(e) + or + result = convertStmtFromRaw(e) + or + result = convertTypeRefFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TLocation`, if possible. + */ + cached + TLocation convertLocationFromRaw(Raw::Element e) { + result = convertDbLocationFromRaw(e) + or + result = convertUnknownLocationFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TPat`, if possible. + */ + cached + TPat convertPatFromRaw(Raw::Element e) { + result = convertBindPatFromRaw(e) + or + result = convertBoxPatFromRaw(e) + or + result = convertConstBlockPatFromRaw(e) + or + result = convertLitPatFromRaw(e) + or + result = convertMissingPatFromRaw(e) + or + result = convertOrPatFromRaw(e) + or + result = convertPathPatFromRaw(e) + or + result = convertRangePatFromRaw(e) + or + result = convertRecordPatFromRaw(e) + or + result = convertRefPatFromRaw(e) + or + result = convertSlicePatFromRaw(e) + or + result = convertTuplePatFromRaw(e) + or + result = convertTupleStructPatFromRaw(e) + or + result = convertWildPatFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TStmt`, if possible. + */ + cached + TStmt convertStmtFromRaw(Raw::Element e) { + result = convertExprStmtFromRaw(e) + or + result = convertIfLetFromRaw(e) + or + result = convertItemStmtFromRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TArray` to a raw DB element, if possible. + */ + cached + Raw::Element convertArrayToRaw(TArray e) { e = TArray(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TAsync` to a raw DB element, if possible. + */ + cached + Raw::Element convertAsyncToRaw(TAsync e) { e = TAsync(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TAwait` to a raw DB element, if possible. + */ + cached + Raw::Element convertAwaitToRaw(TAwait e) { e = TAwait(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBecome` to a raw DB element, if possible. + */ + cached + Raw::Element convertBecomeToRaw(TBecome e) { e = TBecome(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBinaryOp` to a raw DB element, if possible. + */ + cached + Raw::Element convertBinaryOpToRaw(TBinaryOp e) { e = TBinaryOp(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBindPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertBindPatToRaw(TBindPat e) { e = TBindPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBox` to a raw DB element, if possible. + */ + cached + Raw::Element convertBoxToRaw(TBox e) { e = TBox(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBoxPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertBoxPatToRaw(TBoxPat e) { e = TBoxPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBreak` to a raw DB element, if possible. + */ + cached + Raw::Element convertBreakToRaw(TBreak e) { e = TBreak(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TCall` to a raw DB element, if possible. + */ + cached + Raw::Element convertCallToRaw(TCall e) { e = TCall(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TCast` to a raw DB element, if possible. + */ + cached + Raw::Element convertCastToRaw(TCast e) { e = TCast(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TClosure` to a raw DB element, if possible. + */ + cached + Raw::Element convertClosureToRaw(TClosure e) { e = TClosure(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TConst` to a raw DB element, if possible. + */ + cached + Raw::Element convertConstToRaw(TConst e) { e = TConst(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TConstBlockPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertConstBlockPatToRaw(TConstBlockPat e) { e = TConstBlockPat(result) } /** * INTERNAL: Do not use. + * Converts a synthesized `TContinue` to a raw DB element, if possible. */ - class TDeclaration = TFunction or TModule; + cached + Raw::Element convertContinueToRaw(TContinue e) { e = TContinue(result) } /** * INTERNAL: Do not use. + * Converts a synthesized `TDbFile` to a raw DB element, if possible. */ - class TFile = TDbFile or TUnknownFile; + cached + Raw::Element convertDbFileToRaw(TDbFile e) { e = TDbFile(result) } /** * INTERNAL: Do not use. + * Converts a synthesized `TDbLocation` to a raw DB element, if possible. */ - class TLocatable = TDeclaration; + cached + Raw::Element convertDbLocationToRaw(TDbLocation e) { e = TDbLocation(result) } /** * INTERNAL: Do not use. + * Converts a synthesized `TExprStmt` to a raw DB element, if possible. */ - class TLocation = TDbLocation or TUnknownLocation; + cached + Raw::Element convertExprStmtToRaw(TExprStmt e) { e = TExprStmt(result) } /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TDbFile`, if possible. + * Converts a synthesized `TField` to a raw DB element, if possible. */ cached - TDbFile convertDbFileFromRaw(Raw::Element e) { result = TDbFile(e) } + Raw::Element convertFieldToRaw(TField e) { e = TField(result) } /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TDbLocation`, if possible. + * Converts a synthesized `TFunction` to a raw DB element, if possible. */ cached - TDbLocation convertDbLocationFromRaw(Raw::Element e) { result = TDbLocation(e) } + Raw::Element convertFunctionToRaw(TFunction e) { e = TFunction(result) } /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TFunction`, if possible. + * Converts a synthesized `TIf` to a raw DB element, if possible. */ cached - TFunction convertFunctionFromRaw(Raw::Element e) { result = TFunction(e) } + Raw::Element convertIfToRaw(TIf e) { e = TIf(result) } /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TModule`, if possible. + * Converts a synthesized `TIfLet` to a raw DB element, if possible. */ cached - TModule convertModuleFromRaw(Raw::Element e) { result = TModule(e) } + Raw::Element convertIfLetToRaw(TIfLet e) { e = TIfLet(result) } /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TUnknownFile`, if possible. + * Converts a synthesized `TIndex` to a raw DB element, if possible. */ cached - TUnknownFile convertUnknownFileFromRaw(Raw::Element e) { none() } + Raw::Element convertIndexToRaw(TIndex e) { e = TIndex(result) } /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TUnknownLocation`, if possible. + * Converts a synthesized `TInlineAsm` to a raw DB element, if possible. */ cached - TUnknownLocation convertUnknownLocationFromRaw(Raw::Element e) { none() } + Raw::Element convertInlineAsmToRaw(TInlineAsm e) { e = TInlineAsm(result) } /** * INTERNAL: Do not use. - * Converts a raw DB element to a synthesized `TDeclaration`, if possible. + * Converts a synthesized `TItemStmt` to a raw DB element, if possible. */ cached - TDeclaration convertDeclarationFromRaw(Raw::Element e) { - result = convertFunctionFromRaw(e) - or - result = convertModuleFromRaw(e) - } + Raw::Element convertItemStmtToRaw(TItemStmt e) { e = TItemStmt(result) } /** * INTERNAL: Do not use. - * Converts a raw DB element to a synthesized `TElement`, if possible. + * Converts a synthesized `TLet` to a raw DB element, if possible. */ cached - TElement convertElementFromRaw(Raw::Element e) { - result = convertFileFromRaw(e) - or - result = convertLocatableFromRaw(e) - or - result = convertLocationFromRaw(e) - } + Raw::Element convertLetToRaw(TLet e) { e = TLet(result) } /** * INTERNAL: Do not use. - * Converts a raw DB element to a synthesized `TFile`, if possible. + * Converts a synthesized `TLitPat` to a raw DB element, if possible. */ cached - TFile convertFileFromRaw(Raw::Element e) { - result = convertDbFileFromRaw(e) - or - result = convertUnknownFileFromRaw(e) - } + Raw::Element convertLitPatToRaw(TLitPat e) { e = TLitPat(result) } /** * INTERNAL: Do not use. - * Converts a raw DB element to a synthesized `TLocatable`, if possible. + * Converts a synthesized `TLiteral` to a raw DB element, if possible. */ cached - TLocatable convertLocatableFromRaw(Raw::Element e) { result = convertDeclarationFromRaw(e) } + Raw::Element convertLiteralToRaw(TLiteral e) { e = TLiteral(result) } /** * INTERNAL: Do not use. - * Converts a raw DB element to a synthesized `TLocation`, if possible. + * Converts a synthesized `TLoop` to a raw DB element, if possible. */ cached - TLocation convertLocationFromRaw(Raw::Element e) { - result = convertDbLocationFromRaw(e) - or - result = convertUnknownLocationFromRaw(e) - } + Raw::Element convertLoopToRaw(TLoop e) { e = TLoop(result) } /** * INTERNAL: Do not use. - * Converts a synthesized `TDbFile` to a raw DB element, if possible. + * Converts a synthesized `TMatch` to a raw DB element, if possible. */ cached - Raw::Element convertDbFileToRaw(TDbFile e) { e = TDbFile(result) } + Raw::Element convertMatchToRaw(TMatch e) { e = TMatch(result) } /** * INTERNAL: Do not use. - * Converts a synthesized `TDbLocation` to a raw DB element, if possible. + * Converts a synthesized `TMatchArm` to a raw DB element, if possible. */ cached - Raw::Element convertDbLocationToRaw(TDbLocation e) { e = TDbLocation(result) } + Raw::Element convertMatchArmToRaw(TMatchArm e) { e = TMatchArm(result) } /** * INTERNAL: Do not use. - * Converts a synthesized `TFunction` to a raw DB element, if possible. + * Converts a synthesized `TMethodCall` to a raw DB element, if possible. */ cached - Raw::Element convertFunctionToRaw(TFunction e) { e = TFunction(result) } + Raw::Element convertMethodCallToRaw(TMethodCall e) { e = TMethodCall(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TMissingExpr` to a raw DB element, if possible. + */ + cached + Raw::Element convertMissingExprToRaw(TMissingExpr e) { e = TMissingExpr(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TMissingPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertMissingPatToRaw(TMissingPat e) { e = TMissingPat(result) } /** * INTERNAL: Do not use. @@ -183,6 +1154,132 @@ module Synth { cached Raw::Element convertModuleToRaw(TModule e) { e = TModule(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TOffsetOf` to a raw DB element, if possible. + */ + cached + Raw::Element convertOffsetOfToRaw(TOffsetOf e) { e = TOffsetOf(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TOrPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertOrPatToRaw(TOrPat e) { e = TOrPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TPath` to a raw DB element, if possible. + */ + cached + Raw::Element convertPathToRaw(TPath e) { e = TPath(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TPathPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertPathPatToRaw(TPathPat e) { e = TPathPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRange` to a raw DB element, if possible. + */ + cached + Raw::Element convertRangeToRaw(TRange e) { e = TRange(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRangePat` to a raw DB element, if possible. + */ + cached + Raw::Element convertRangePatToRaw(TRangePat e) { e = TRangePat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRecordLit` to a raw DB element, if possible. + */ + cached + Raw::Element convertRecordLitToRaw(TRecordLit e) { e = TRecordLit(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRecordPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertRecordPatToRaw(TRecordPat e) { e = TRecordPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRef` to a raw DB element, if possible. + */ + cached + Raw::Element convertRefToRaw(TRef e) { e = TRef(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRefPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertRefPatToRaw(TRefPat e) { e = TRefPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TReturn` to a raw DB element, if possible. + */ + cached + Raw::Element convertReturnToRaw(TReturn e) { e = TReturn(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TSlicePat` to a raw DB element, if possible. + */ + cached + Raw::Element convertSlicePatToRaw(TSlicePat e) { e = TSlicePat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TTuple` to a raw DB element, if possible. + */ + cached + Raw::Element convertTupleToRaw(TTuple e) { e = TTuple(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TTuplePat` to a raw DB element, if possible. + */ + cached + Raw::Element convertTuplePatToRaw(TTuplePat e) { e = TTuplePat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TTupleStructPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertTupleStructPatToRaw(TTupleStructPat e) { e = TTupleStructPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TTypeRef` to a raw DB element, if possible. + */ + cached + Raw::Element convertTypeRefToRaw(TTypeRef e) { e = TTypeRef(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TUnaryExpr` to a raw DB element, if possible. + */ + cached + Raw::Element convertUnaryExprToRaw(TUnaryExpr e) { e = TUnaryExpr(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TUnderscore` to a raw DB element, if possible. + */ + cached + Raw::Element convertUnderscoreToRaw(TUnderscore e) { e = TUnderscore(result) } + /** * INTERNAL: Do not use. * Converts a synthesized `TUnknownFile` to a raw DB element, if possible. @@ -197,6 +1294,45 @@ module Synth { cached Raw::Element convertUnknownLocationToRaw(TUnknownLocation e) { none() } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TUnsafe` to a raw DB element, if possible. + */ + cached + Raw::Element convertUnsafeToRaw(TUnsafe e) { e = TUnsafe(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TWildPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertWildPatToRaw(TWildPat e) { e = TWildPat(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TYeet` to a raw DB element, if possible. + */ + cached + Raw::Element convertYeetToRaw(TYeet e) { e = TYeet(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TYield` to a raw DB element, if possible. + */ + cached + Raw::Element convertYieldToRaw(TYield e) { e = TYield(result) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBlock` to a raw DB element, if possible. + */ + cached + Raw::Element convertBlockToRaw(TBlock e) { + result = convertAsyncToRaw(e) + or + result = convertUnsafeToRaw(e) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TDeclaration` to a raw DB element, if possible. @@ -221,6 +1357,79 @@ module Synth { result = convertLocationToRaw(e) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TExpr` to a raw DB element, if possible. + */ + cached + Raw::Element convertExprToRaw(TExpr e) { + result = convertArrayToRaw(e) + or + result = convertAwaitToRaw(e) + or + result = convertBecomeToRaw(e) + or + result = convertBinaryOpToRaw(e) + or + result = convertBlockToRaw(e) + or + result = convertBoxToRaw(e) + or + result = convertBreakToRaw(e) + or + result = convertCallToRaw(e) + or + result = convertCastToRaw(e) + or + result = convertClosureToRaw(e) + or + result = convertConstToRaw(e) + or + result = convertContinueToRaw(e) + or + result = convertFieldToRaw(e) + or + result = convertIfToRaw(e) + or + result = convertIndexToRaw(e) + or + result = convertInlineAsmToRaw(e) + or + result = convertLetToRaw(e) + or + result = convertLiteralToRaw(e) + or + result = convertLoopToRaw(e) + or + result = convertMatchToRaw(e) + or + result = convertMethodCallToRaw(e) + or + result = convertMissingExprToRaw(e) + or + result = convertOffsetOfToRaw(e) + or + result = convertPathToRaw(e) + or + result = convertRangeToRaw(e) + or + result = convertRecordLitToRaw(e) + or + result = convertRefToRaw(e) + or + result = convertReturnToRaw(e) + or + result = convertTupleToRaw(e) + or + result = convertUnaryExprToRaw(e) + or + result = convertUnderscoreToRaw(e) + or + result = convertYeetToRaw(e) + or + result = convertYieldToRaw(e) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TFile` to a raw DB element, if possible. @@ -237,7 +1446,19 @@ module Synth { * Converts a synthesized `TLocatable` to a raw DB element, if possible. */ cached - Raw::Element convertLocatableToRaw(TLocatable e) { result = convertDeclarationToRaw(e) } + Raw::Element convertLocatableToRaw(TLocatable e) { + result = convertDeclarationToRaw(e) + or + result = convertExprToRaw(e) + or + result = convertMatchArmToRaw(e) + or + result = convertPatToRaw(e) + or + result = convertStmtToRaw(e) + or + result = convertTypeRefToRaw(e) + } /** * INTERNAL: Do not use. @@ -249,4 +1470,52 @@ module Synth { or result = convertUnknownLocationToRaw(e) } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TPat` to a raw DB element, if possible. + */ + cached + Raw::Element convertPatToRaw(TPat e) { + result = convertBindPatToRaw(e) + or + result = convertBoxPatToRaw(e) + or + result = convertConstBlockPatToRaw(e) + or + result = convertLitPatToRaw(e) + or + result = convertMissingPatToRaw(e) + or + result = convertOrPatToRaw(e) + or + result = convertPathPatToRaw(e) + or + result = convertRangePatToRaw(e) + or + result = convertRecordPatToRaw(e) + or + result = convertRefPatToRaw(e) + or + result = convertSlicePatToRaw(e) + or + result = convertTuplePatToRaw(e) + or + result = convertTupleStructPatToRaw(e) + or + result = convertWildPatToRaw(e) + } + + /** + * INTERNAL: Do not use. + * Converts a synthesized `TStmt` to a raw DB element, if possible. + */ + cached + Raw::Element convertStmtToRaw(TStmt e) { + result = convertExprStmtToRaw(e) + or + result = convertIfLetToRaw(e) + or + result = convertItemStmtToRaw(e) + } } diff --git a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll index 4ca28a77c5f7..b8572eff000d 100644 --- a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll @@ -3,7 +3,60 @@ * This module exports all modules providing `Element` subclasses. */ +import codeql.rust.elements.ArrayConstructor +import codeql.rust.elements.AsyncConstructor +import codeql.rust.elements.AwaitConstructor +import codeql.rust.elements.BecomeConstructor +import codeql.rust.elements.BinaryOpConstructor +import codeql.rust.elements.BindPatConstructor +import codeql.rust.elements.BoxConstructor +import codeql.rust.elements.BoxPatConstructor +import codeql.rust.elements.BreakConstructor +import codeql.rust.elements.CallConstructor +import codeql.rust.elements.CastConstructor +import codeql.rust.elements.ClosureConstructor +import codeql.rust.elements.ConstConstructor +import codeql.rust.elements.ConstBlockPatConstructor +import codeql.rust.elements.ContinueConstructor import codeql.rust.elements.DbFileConstructor import codeql.rust.elements.DbLocationConstructor +import codeql.rust.elements.ExprStmtConstructor +import codeql.rust.elements.FieldConstructor import codeql.rust.elements.FunctionConstructor +import codeql.rust.elements.IfConstructor +import codeql.rust.elements.IfLetConstructor +import codeql.rust.elements.IndexConstructor +import codeql.rust.elements.InlineAsmConstructor +import codeql.rust.elements.ItemStmtConstructor +import codeql.rust.elements.LetConstructor +import codeql.rust.elements.LitPatConstructor +import codeql.rust.elements.LiteralConstructor +import codeql.rust.elements.LoopConstructor +import codeql.rust.elements.MatchConstructor +import codeql.rust.elements.MatchArmConstructor +import codeql.rust.elements.MethodCallConstructor +import codeql.rust.elements.MissingExprConstructor +import codeql.rust.elements.MissingPatConstructor import codeql.rust.elements.ModuleConstructor +import codeql.rust.elements.OffsetOfConstructor +import codeql.rust.elements.OrPatConstructor +import codeql.rust.elements.PathConstructor +import codeql.rust.elements.PathPatConstructor +import codeql.rust.elements.RangeConstructor +import codeql.rust.elements.RangePatConstructor +import codeql.rust.elements.RecordLitConstructor +import codeql.rust.elements.RecordPatConstructor +import codeql.rust.elements.RefConstructor +import codeql.rust.elements.RefPatConstructor +import codeql.rust.elements.ReturnConstructor +import codeql.rust.elements.SlicePatConstructor +import codeql.rust.elements.TupleConstructor +import codeql.rust.elements.TuplePatConstructor +import codeql.rust.elements.TupleStructPatConstructor +import codeql.rust.elements.TypeRefConstructor +import codeql.rust.elements.UnaryExprConstructor +import codeql.rust.elements.UnderscoreConstructor +import codeql.rust.elements.UnsafeConstructor +import codeql.rust.elements.WildPatConstructor +import codeql.rust.elements.YeetConstructor +import codeql.rust.elements.YieldConstructor diff --git a/rust/ql/lib/codeql/rust/generated/Tuple.qll b/rust/ql/lib/codeql/rust/generated/Tuple.qll new file mode 100644 index 000000000000..8a086f71838f --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Tuple.qll @@ -0,0 +1,45 @@ +// generated by codegen +/** + * This module provides the generated definition of `Tuple`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Tuple` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Tuple` class directly. + * Use the subclass `Tuple`, where the following predicates are available. + */ + class Tuple extends Synth::TTuple, Expr { + override string getAPrimaryQlClass() { result = "Tuple" } + + /** + * Gets the `index`th expression of this tuple (0-based). + */ + Expr getExpr(int index) { + result = Synth::convertExprFromRaw(Synth::convertTupleToRaw(this).(Raw::Tuple).getExpr(index)) + } + + /** + * Gets any of the expressions of this tuple. + */ + final Expr getAnExpr() { result = this.getExpr(_) } + + /** + * Gets the number of expressions of this tuple. + */ + final int getNumberOfExprs() { result = count(int i | exists(this.getExpr(i))) } + + /** + * Holds if this tuple is assignee expression. + */ + predicate isAssigneeExpr() { Synth::convertTupleToRaw(this).(Raw::Tuple).isAssigneeExpr() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/TuplePat.qll b/rust/ql/lib/codeql/rust/generated/TuplePat.qll new file mode 100644 index 000000000000..688a21eb73a0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/TuplePat.qll @@ -0,0 +1,51 @@ +// generated by codegen +/** + * This module provides the generated definition of `TuplePat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `TuplePat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::TuplePat` class directly. + * Use the subclass `TuplePat`, where the following predicates are available. + */ + class TuplePat extends Synth::TTuplePat, Pat { + override string getAPrimaryQlClass() { result = "TuplePat" } + + /** + * Gets the `index`th argument of this tuple pat (0-based). + */ + Pat getArg(int index) { + result = + Synth::convertPatFromRaw(Synth::convertTuplePatToRaw(this).(Raw::TuplePat).getArg(index)) + } + + /** + * Gets any of the arguments of this tuple pat. + */ + final Pat getAnArg() { result = this.getArg(_) } + + /** + * Gets the number of arguments of this tuple pat. + */ + final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) } + + /** + * Gets the ellipsis of this tuple pat, if it exists. + */ + int getEllipsis() { result = Synth::convertTuplePatToRaw(this).(Raw::TuplePat).getEllipsis() } + + /** + * Holds if `getEllipsis()` exists. + */ + final predicate hasEllipsis() { exists(this.getEllipsis()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/TupleStructPat.qll b/rust/ql/lib/codeql/rust/generated/TupleStructPat.qll new file mode 100644 index 000000000000..4f3ea3d9f773 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/TupleStructPat.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `TupleStructPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `TupleStructPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::TupleStructPat` class directly. + * Use the subclass `TupleStructPat`, where the following predicates are available. + */ + class TupleStructPat extends Synth::TTupleStructPat, Pat { + override string getAPrimaryQlClass() { result = "TupleStructPat" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/TypeRef.qll b/rust/ql/lib/codeql/rust/generated/TypeRef.qll new file mode 100644 index 000000000000..44baf5b50eec --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/TypeRef.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `TypeRef`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Locatable + +/** + * INTERNAL: This module contains the fully generated definition of `TypeRef` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::TypeRef` class directly. + * Use the subclass `TypeRef`, where the following predicates are available. + */ + class TypeRef extends Synth::TTypeRef, Locatable { + override string getAPrimaryQlClass() { result = "TypeRef" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/UnaryExpr.qll b/rust/ql/lib/codeql/rust/generated/UnaryExpr.qll new file mode 100644 index 000000000000..7ab93ff361ec --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/UnaryExpr.qll @@ -0,0 +1,36 @@ +// generated by codegen +/** + * This module provides the generated definition of `UnaryExpr`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `UnaryExpr` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::UnaryExpr` class directly. + * Use the subclass `UnaryExpr`, where the following predicates are available. + */ + class UnaryExpr extends Synth::TUnaryExpr, Expr { + override string getAPrimaryQlClass() { result = "UnaryExpr" } + + /** + * Gets the expression of this unary expression. + */ + Expr getExpr() { + result = + Synth::convertExprFromRaw(Synth::convertUnaryExprToRaw(this).(Raw::UnaryExpr).getExpr()) + } + + /** + * Gets the op of this unary expression. + */ + string getOp() { result = Synth::convertUnaryExprToRaw(this).(Raw::UnaryExpr).getOp() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Underscore.qll b/rust/ql/lib/codeql/rust/generated/Underscore.qll new file mode 100644 index 000000000000..9a2aee44c541 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Underscore.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Underscore`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Underscore` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Underscore` class directly. + * Use the subclass `Underscore`, where the following predicates are available. + */ + class Underscore extends Synth::TUnderscore, Expr { + override string getAPrimaryQlClass() { result = "Underscore" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Unsafe.qll b/rust/ql/lib/codeql/rust/generated/Unsafe.qll new file mode 100644 index 000000000000..bcc0aeaaa2c3 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Unsafe.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `Unsafe`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Block + +/** + * INTERNAL: This module contains the fully generated definition of `Unsafe` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Unsafe` class directly. + * Use the subclass `Unsafe`, where the following predicates are available. + */ + class Unsafe extends Synth::TUnsafe, Block { + override string getAPrimaryQlClass() { result = "Unsafe" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/WildPat.qll b/rust/ql/lib/codeql/rust/generated/WildPat.qll new file mode 100644 index 000000000000..05db09c16e0c --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/WildPat.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `WildPat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Pat + +/** + * INTERNAL: This module contains the fully generated definition of `WildPat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::WildPat` class directly. + * Use the subclass `WildPat`, where the following predicates are available. + */ + class WildPat extends Synth::TWildPat, Pat { + override string getAPrimaryQlClass() { result = "WildPat" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Yeet.qll b/rust/ql/lib/codeql/rust/generated/Yeet.qll new file mode 100644 index 000000000000..d74e065d761a --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Yeet.qll @@ -0,0 +1,35 @@ +// generated by codegen +/** + * This module provides the generated definition of `Yeet`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Yeet` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Yeet` class directly. + * Use the subclass `Yeet`, where the following predicates are available. + */ + class Yeet extends Synth::TYeet, Expr { + override string getAPrimaryQlClass() { result = "Yeet" } + + /** + * Gets the expression of this yeet, if it exists. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertYeetToRaw(this).(Raw::Yeet).getExpr()) + } + + /** + * Holds if `getExpr()` exists. + */ + final predicate hasExpr() { exists(this.getExpr()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Yield.qll b/rust/ql/lib/codeql/rust/generated/Yield.qll new file mode 100644 index 000000000000..68d85279b08c --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Yield.qll @@ -0,0 +1,35 @@ +// generated by codegen +/** + * This module provides the generated definition of `Yield`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Yield` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Yield` class directly. + * Use the subclass `Yield`, where the following predicates are available. + */ + class Yield extends Synth::TYield, Expr { + override string getAPrimaryQlClass() { result = "Yield" } + + /** + * Gets the expression of this yield, if it exists. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertYieldToRaw(this).(Raw::Yield).getExpr()) + } + + /** + * Holds if `getExpr()` exists. + */ + final predicate hasExpr() { exists(this.getExpr()) } + } +} diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 4ebc9480c4e1..2424ac438197 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -29,6 +29,11 @@ files( @locatable = @declaration +| @expr +| @match_arm +| @pat +| @stmt +| @type_ref ; #keyset[id] @@ -64,9 +69,373 @@ db_locations( | @module ; +@expr = + @array +| @await +| @become +| @binary_op +| @block +| @box +| @break +| @call +| @cast +| @closure +| @const +| @continue +| @field +| @if +| @index +| @inline_asm +| @let +| @literal +| @loop +| @match +| @method_call +| @missing_expr +| @offset_of +| @path +| @range +| @record_lit +| @ref +| @return +| @tuple +| @unary_expr +| @underscore +| @yeet +| @yield +; + +match_arms( + unique int id: @match_arm, + int pat: @pat ref, + int expr: @expr ref +); + +#keyset[id] +match_arm_guards( + int id: @match_arm ref, + int guard: @expr ref +); + +@pat = + @bind_pat +| @box_pat +| @const_block_pat +| @lit_pat +| @missing_pat +| @or_pat +| @path_pat +| @range_pat +| @record_pat +| @ref_pat +| @slice_pat +| @tuple_pat +| @tuple_struct_pat +| @wild_pat +; + +@stmt = + @expr_stmt +| @if_let +| @item_stmt +; + +type_refs( + unique int id: @type_ref +); + +arrays( + unique int id: @array +); + +awaits( + unique int id: @await, + int expr: @expr ref +); + +becomes( + unique int id: @become, + int expr: @expr ref +); + +binary_ops( + unique int id: @binary_op, + int lhs: @expr ref, + int rhs: @expr ref +); + +#keyset[id] +binary_op_ops( + int id: @binary_op ref, + string op: string ref +); + +bind_pats( + unique int id: @bind_pat, + string binding_id: string ref +); + +#keyset[id] +bind_pat_subpats( + int id: @bind_pat ref, + int subpat: @pat ref +); + +@block = + @async +| @unsafe +; + +#keyset[id, index] +block_statements( + int id: @block ref, + int index: int ref, + int statement: @stmt ref +); + +#keyset[id] +block_tails( + int id: @block ref, + int tail: @expr ref +); + +#keyset[id] +block_labels( + int id: @block ref, + string label: string ref +); + +boxes( + unique int id: @box, + int expr: @expr ref +); + +box_pats( + unique int id: @box_pat, + int inner: @pat ref +); + +breaks( + unique int id: @break +); + +#keyset[id] +break_exprs( + int id: @break ref, + int expr: @expr ref +); + +#keyset[id] +break_labels( + int id: @break ref, + string label: string ref +); + +calls( + unique int id: @call, + int callee: @expr ref +); + +#keyset[id, index] +call_args( + int id: @call ref, + int index: int ref, + int arg: @expr ref +); + +#keyset[id] +call_is_assignee_expr( + int id: @call ref +); + +casts( + unique int id: @cast, + int expr: @expr ref, + int type_ref: @type_ref ref +); + +closures( + unique int id: @closure, + int body: @expr ref +); + +#keyset[id, index] +closure_args( + int id: @closure ref, + int index: int ref, + int arg: @pat ref +); + +#keyset[id, index] +closure_arg_types( + int id: @closure ref, + int index: int ref, + int arg_type: @type_ref ref +); + +#keyset[id] +closure_ret_types( + int id: @closure ref, + int ret_type: @type_ref ref +); + +#keyset[id] +closure_is_move( + int id: @closure ref +); + +consts( + unique int id: @const +); + +const_block_pats( + unique int id: @const_block_pat, + int expr: @expr ref +); + +continues( + unique int id: @continue +); + +#keyset[id] +continue_labels( + int id: @continue ref, + string label: string ref +); + +expr_stmts( + unique int id: @expr_stmt, + int expr: @expr ref +); + +#keyset[id] +expr_stmt_has_semi( + int id: @expr_stmt ref +); + +fields( + unique int id: @field, + int expr: @expr ref, + string name: string ref +); + functions( unique int id: @function, - string name: string ref + string name: string ref, + int body: @expr ref +); + +ifs( + unique int id: @if, + int condition: @expr ref, + int then_branch: @expr ref +); + +#keyset[id] +if_else_branches( + int id: @if ref, + int else_branch: @expr ref +); + +if_lets( + unique int id: @if_let, + int pat: @pat ref +); + +#keyset[id] +if_let_type_refs( + int id: @if_let ref, + int type_ref: @type_ref ref +); + +#keyset[id] +if_let_initializers( + int id: @if_let ref, + int initializer: @expr ref +); + +#keyset[id] +if_let_else_branches( + int id: @if_let ref, + int else_branch: @expr ref +); + +indices( + unique int id: @index, + int base: @expr ref, + int index: @expr ref +); + +#keyset[id] +index_is_assignee_expr( + int id: @index ref +); + +inline_asms( + unique int id: @inline_asm +); + +item_stmts( + unique int id: @item_stmt +); + +lets( + unique int id: @let, + int pat: @pat ref, + int expr: @expr ref +); + +lit_pats( + unique int id: @lit_pat, + int expr: @expr ref +); + +literals( + unique int id: @literal +); + +loops( + unique int id: @loop, + int body: @expr ref +); + +#keyset[id] +loop_labels( + int id: @loop ref, + string label: string ref +); + +matches( + unique int id: @match, + int expr: @expr ref +); + +#keyset[id, index] +match_branches( + int id: @match ref, + int index: int ref, + int branch: @match_arm ref +); + +method_calls( + unique int id: @method_call, + int receiver: @expr ref, + string method_name: string ref +); + +#keyset[id, index] +method_call_args( + int id: @method_call ref, + int index: int ref, + int arg: @expr ref +); + +missing_exprs( + unique int id: @missing_expr +); + +missing_pats( + unique int id: @missing_pat ); modules( @@ -79,3 +448,196 @@ module_declarations( int index: int ref, int declaration: @declaration ref ); + +offset_ofs( + unique int id: @offset_of +); + +or_pats( + unique int id: @or_pat +); + +#keyset[id, index] +or_pat_args( + int id: @or_pat ref, + int index: int ref, + int arg: @pat ref +); + +paths( + unique int id: @path +); + +path_pats( + unique int id: @path_pat +); + +ranges( + unique int id: @range +); + +#keyset[id] +range_lhs( + int id: @range ref, + int lhs: @expr ref +); + +#keyset[id] +range_rhs( + int id: @range ref, + int rhs: @expr ref +); + +#keyset[id] +range_is_inclusive( + int id: @range ref +); + +range_pats( + unique int id: @range_pat +); + +#keyset[id] +range_pat_starts( + int id: @range_pat ref, + int start: @pat ref +); + +#keyset[id] +range_pat_ends( + int id: @range_pat ref, + int end: @pat ref +); + +record_lits( + unique int id: @record_lit +); + +record_pats( + unique int id: @record_pat +); + +refs( + unique int id: @ref, + int expr: @expr ref +); + +#keyset[id] +ref_is_raw( + int id: @ref ref +); + +#keyset[id] +ref_is_mut( + int id: @ref ref +); + +ref_pats( + unique int id: @ref_pat, + int pat: @pat ref +); + +#keyset[id] +ref_pat_is_mut( + int id: @ref_pat ref +); + +returns( + unique int id: @return +); + +#keyset[id] +return_exprs( + int id: @return ref, + int expr: @expr ref +); + +slice_pats( + unique int id: @slice_pat +); + +#keyset[id, index] +slice_pat_prefixes( + int id: @slice_pat ref, + int index: int ref, + int prefix: @pat ref +); + +tuples( + unique int id: @tuple +); + +#keyset[id, index] +tuple_exprs( + int id: @tuple ref, + int index: int ref, + int expr: @expr ref +); + +#keyset[id] +tuple_is_assignee_expr( + int id: @tuple ref +); + +tuple_pats( + unique int id: @tuple_pat +); + +#keyset[id, index] +tuple_pat_args( + int id: @tuple_pat ref, + int index: int ref, + int arg: @pat ref +); + +#keyset[id] +tuple_pat_ellipses( + int id: @tuple_pat ref, + int ellipsis: int ref +); + +tuple_struct_pats( + unique int id: @tuple_struct_pat +); + +unary_exprs( + unique int id: @unary_expr, + int expr: @expr ref, + string op: string ref +); + +underscores( + unique int id: @underscore +); + +wild_pats( + unique int id: @wild_pat +); + +yeets( + unique int id: @yeet +); + +#keyset[id] +yeet_exprs( + int id: @yeet ref, + int expr: @expr ref +); + +yields( + unique int id: @yield +); + +#keyset[id] +yield_exprs( + int id: @yield ref, + int expr: @expr ref +); + +asyncs( + unique int id: @async +); + +unsaves( + unique int id: @unsafe +); diff --git a/rust/ql/test/extractor-tests/generated/Expr/MISSING_SOURCE.txt b/rust/ql/test/extractor-tests/generated/Expr/MISSING_SOURCE.txt new file mode 100644 index 000000000000..9cb54ddd059e --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/Expr/MISSING_SOURCE.txt @@ -0,0 +1,4 @@ +// generated by codegen + +After a source file is added in this directory and codegen is run again, test queries +will appear and this file will be deleted diff --git a/rust/ql/test/extractor-tests/generated/Function/Function.ql b/rust/ql/test/extractor-tests/generated/Function/Function.ql index 78201284e1f5..1cff30407106 100644 --- a/rust/ql/test/extractor-tests/generated/Function/Function.ql +++ b/rust/ql/test/extractor-tests/generated/Function/Function.ql @@ -2,9 +2,10 @@ import codeql.rust.elements import TestUtils -from Function x, string getName +from Function x, string getName, Expr getBody where toBeTested(x) and not x.isUnknown() and - getName = x.getName() -select x, "getName:", getName + getName = x.getName() and + getBody = x.getBody() +select x, "getName:", getName, "getBody:", getBody diff --git a/rust/ql/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt b/rust/ql/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt new file mode 100644 index 000000000000..9cb54ddd059e --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt @@ -0,0 +1,4 @@ +// generated by codegen + +After a source file is added in this directory and codegen is run again, test queries +will appear and this file will be deleted diff --git a/rust/ql/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt b/rust/ql/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt new file mode 100644 index 000000000000..9cb54ddd059e --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt @@ -0,0 +1,4 @@ +// generated by codegen + +After a source file is added in this directory and codegen is run again, test queries +will appear and this file will be deleted diff --git a/rust/ql/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt b/rust/ql/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt new file mode 100644 index 000000000000..9cb54ddd059e --- /dev/null +++ b/rust/ql/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt @@ -0,0 +1,4 @@ +// generated by codegen + +After a source file is added in this directory and codegen is run again, test queries +will appear and this file will be deleted From 679d81ab00ee3b970d107362ea3922601e92a9e4 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Thu, 5 Sep 2024 16:39:26 +0200 Subject: [PATCH 03/13] Rust: extract dummy Function body --- rust/extractor/src/translate.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/extractor/src/translate.rs b/rust/extractor/src/translate.rs index 9555a068e689..0a8fcd7833a1 100644 --- a/rust/extractor/src/translate.rs +++ b/rust/extractor/src/translate.rs @@ -94,10 +94,15 @@ impl CrateTranslator<'_> { ModuleDef::Function(function) => { let name = function.name(self.db); let location = self.emit_location(function); + let body = self.trap.emit(generated::MissingExpr { + id: TrapId::Star, + location: None, + }); labels.push(self.trap.emit(generated::Function { id: trap_key![module_label, name.as_str()], location, name: name.as_str().into(), + body, })); } ModuleDef::Adt(_) => {} From ce2fdb3463bb004ed1a87c95b81b6dfd1ec3dc1f Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 11:47:08 +0200 Subject: [PATCH 04/13] Address comments --- rust/.generated.list | 44 +++--- rust/.gitattributes | 20 +-- rust/extractor/src/generated/top.rs | 28 ++-- rust/ql/lib/codeql/rust/elements.qll | 7 +- .../rust/elements/{Async.qll => AstNode.qll} | 6 +- .../{UnaryExpr.qll => AsyncBlock.qll} | 6 +- ...structor.qll => AsyncBlockConstructor.qll} | 6 +- .../rust/elements/{Unsafe.qll => UnaryOp.qll} | 6 +- ...Constructor.qll => UnaryOpConstructor.qll} | 6 +- .../lib/codeql/rust/elements/UnsafeBlock.qll | 8 ++ ...tructor.qll => UnsafeBlockConstructor.qll} | 6 +- rust/ql/lib/codeql/rust/generated/AstNode.qll | 21 +++ rust/ql/lib/codeql/rust/generated/Async.qll | 23 ---- .../lib/codeql/rust/generated/AsyncBlock.qll | 23 ++++ .../lib/codeql/rust/generated/Declaration.qll | 4 +- rust/ql/lib/codeql/rust/generated/Expr.qll | 4 +- rust/ql/lib/codeql/rust/generated/If.qll | 16 +-- .../ql/lib/codeql/rust/generated/MatchArm.qll | 4 +- .../lib/codeql/rust/generated/ParentChild.qll | 125 ++++++++++-------- rust/ql/lib/codeql/rust/generated/Pat.qll | 4 +- rust/ql/lib/codeql/rust/generated/Raw.qll | 45 ++++--- rust/ql/lib/codeql/rust/generated/Stmt.qll | 4 +- rust/ql/lib/codeql/rust/generated/Synth.qll | 119 ++++++++++------- .../rust/generated/SynthConstructors.qll | 6 +- rust/ql/lib/codeql/rust/generated/TypeRef.qll | 4 +- .../lib/codeql/rust/generated/UnaryExpr.qll | 36 ----- rust/ql/lib/codeql/rust/generated/UnaryOp.qll | 35 +++++ rust/ql/lib/codeql/rust/generated/Unsafe.qll | 23 ---- .../lib/codeql/rust/generated/UnsafeBlock.qll | 23 ++++ rust/ql/lib/rust.dbscheme | 40 +++--- rust/schema.py | 27 ++-- 31 files changed, 405 insertions(+), 324 deletions(-) rename rust/ql/lib/codeql/rust/elements/{Async.qll => AstNode.qll} (56%) rename rust/ql/lib/codeql/rust/elements/{UnaryExpr.qll => AsyncBlock.qll} (54%) rename rust/ql/lib/codeql/rust/elements/{AsyncConstructor.qll => AsyncBlockConstructor.qll} (61%) rename rust/ql/lib/codeql/rust/elements/{Unsafe.qll => UnaryOp.qll} (56%) rename rust/ql/lib/codeql/rust/elements/{UnsafeConstructor.qll => UnaryOpConstructor.qll} (63%) create mode 100644 rust/ql/lib/codeql/rust/elements/UnsafeBlock.qll rename rust/ql/lib/codeql/rust/elements/{UnaryExprConstructor.qll => UnsafeBlockConstructor.qll} (61%) create mode 100644 rust/ql/lib/codeql/rust/generated/AstNode.qll delete mode 100644 rust/ql/lib/codeql/rust/generated/Async.qll create mode 100644 rust/ql/lib/codeql/rust/generated/AsyncBlock.qll delete mode 100644 rust/ql/lib/codeql/rust/generated/UnaryExpr.qll create mode 100644 rust/ql/lib/codeql/rust/generated/UnaryOp.qll delete mode 100644 rust/ql/lib/codeql/rust/generated/Unsafe.qll create mode 100644 rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll diff --git a/rust/.generated.list b/rust/.generated.list index de1101499f18..4fb901eb718b 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -1,7 +1,8 @@ ql/lib/codeql/rust/elements/Array.qll c33de8fd2c0acbf221441dd67b061d3ab169f0bf548c0c957884455a215fce5c c54c716551746afd895da187e3d03acbe481bdf1ca4461065555641480801c2d ql/lib/codeql/rust/elements/ArrayConstructor.qll aba72e72a26013fe0c665870bbdc20903ff287d890cbcabc0dc62be32ace8422 6c539b9008c27646c5708f92e8691f41d752676045953516117eb3bb23e3f88c -ql/lib/codeql/rust/elements/Async.qll 96cb9c26e6b8b2b28686aeb3b0aa442c59d48f8a14e9ad838df3c846a2daae64 c55d9db2402f7a04692ed61a187d581231327b675af8ca7a4bd6467195ce4263 -ql/lib/codeql/rust/elements/AsyncConstructor.qll 27248231035b78fd8961003168a30b8b6e79102fe9d858bd9b94090a4d970317 23a8799e3ee39281c167a29dd835e220571af6419f907e3cee606863c51f333c +ql/lib/codeql/rust/elements/AstNode.qll 2069047c779514867c12d845dcdf889db6f27fa6a9e484966a3c28a77973b7d4 e214616c81418b0018c0d36896ac2ec7273634e3213bc8257d8b172f396c00ee +ql/lib/codeql/rust/elements/AsyncBlock.qll ac5899827719dae561540d1c460540bd3242b79ee98f0ea3f9391e98f7a6b680 a0d64b5896fcc2c8292b757645a0041c716ac0e9b85264729898347361061c8b +ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll c094b929e6f3e7053973e80b26b13989e90d603da0cc073679c9e6594c3eceba 95e55c95007e392ebcc43a895bf26ff5983598f7ffb1e3fdee2858ce61b50ea0 ql/lib/codeql/rust/elements/Await.qll b143784cf3a536d67bcddc6145fca944e34b5262975d1f13fc8922dda8cac39d bf8b3b173708b0dfcab5c84407e17d488ac1e94e285f6ee8723a71cae81eeea3 ql/lib/codeql/rust/elements/AwaitConstructor.qll b34c0592c512ab38f7a7106b3416ba53dad650a801e1a3adb4afc1dadf56ed1e dfbf6ff965abe7791898e7fb026c997a22ac7af23fa84ab87b4f9f74b89c2a70 ql/lib/codeql/rust/elements/Become.qll 57a2a0a42f03ff8ebf29e3829762bf49cdbd01666a51ff83437124b281ecb31b a4ff816fb6d93151ab9cd6ec51739c1f869bb740d87b522dca1917f13fab1978 @@ -104,21 +105,22 @@ ql/lib/codeql/rust/elements/TupleStructPat.qll 50b7d89498dbe6737d97325037156c768 ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll 15a15362572ac2dc98ed3257f195f20bb8dfe34a1fe203cf2a1a193ce16c406f 9e590b50cf865f6bc573b6fc17acea073f0d9389be241b01e820d9f3f8f14acb ql/lib/codeql/rust/elements/TypeRef.qll 223844544eab3e07b6edda805c6344fa8b486aeea7bbe62e4b98e235ce2008d8 7517748b0e7a57c925168f5ce7a31ecc1b59f7521a2095578f599b8d9045a4e5 ql/lib/codeql/rust/elements/TypeRefConstructor.qll f8b2e5ef15517890a8b2d56643f471ae64cc74c420187049e33b182417e72e4f 683611e732b842756e301a77625b385bca0c4969971020c9e11220a1aa665a29 -ql/lib/codeql/rust/elements/UnaryExpr.qll b996aedbb0cb7aa36ef403fd1b8a378d29f1d62c3cdaf89dbe2ec2c2baf6ff4b f24cd5740efbd75d3f79c0428a1401d089c0dd76af77ea0de45289150e3026d3 -ql/lib/codeql/rust/elements/UnaryExprConstructor.qll cad00e01caaf5c5e56457ba7f33fae7e72900ef695312af56525128605a0cc63 205f7e12f691f937f473094a0f0bcca4b0c36e7e2c88d9d1928e849b8e455356 +ql/lib/codeql/rust/elements/UnaryOp.qll d0a80dee319119a4fd6b655a10451c390f7e41e096cf79bb3757c120c28de679 1fc33adb745b50fb6472be969b8df073208d8d092b459e35a65a4e978e436145 +ql/lib/codeql/rust/elements/UnaryOpConstructor.qll 63fac5b262777aaac01eb9a67a990db578faadfc248149822453f6ece0f1dff7 f37488ee4acfa19095ef16e73042d7f17e66b30d936c691d54ef3b2d39663432 ql/lib/codeql/rust/elements/Underscore.qll a988d966016984c82ca1a22b86be751d3ee3da117b9333126cebe969e6cdc74b 81da73806731d80bd723bfa1c3c6be6ef0a0a906f49d2a20c52363e5ba39fafe ql/lib/codeql/rust/elements/UnderscoreConstructor.qll 044463d55ca7d4cc1193b79fdc3140e33f68a1e3973a3d9262da4c49879999ac e024c4b988d5441dd032bdb0b521fed1074542e3e402e2fadae10bc9cab40aac -ql/lib/codeql/rust/elements/Unsafe.qll 49407b17db3b442a1365cc89db21bfcdb6b86bfbd03f9e0cf12281b77b319cda 7961b94982b7b7ad6356c13c057b822c89efb3e8830cb264534f761a09313666 -ql/lib/codeql/rust/elements/UnsafeConstructor.qll 5133f965cbf8fcfa3ae4d779f5c5a896e33939328d6613f0bcc359faa0c64097 c6ec48ba7cf32fc127845944a2692d7c2d2b34f3fd3284c5e78df5b313456d2f +ql/lib/codeql/rust/elements/UnsafeBlock.qll 5a91fb3e0d05fa1379c02cee502732c020c9f33698cfdbef7ea2456cba40d2af 52b15480e82de093de9dc5993635f1c7d0d5c8c8cca310da0f58dc90dab80547 +ql/lib/codeql/rust/elements/UnsafeBlockConstructor.qll c8ce086a87323a5223a9c815ae645f03d87534d09b72354d32db82dd082afe75 4f3880ecaacf46c28c8672a911edaaa18712b6b3a16e3cc0c4cb53fedaff256d ql/lib/codeql/rust/elements/WildPat.qll 9791bcd2b36516da82a81c10655fe6b4ef0f788d548cc99cb88578dd9c1278f0 03c192da4f92db637001854f904f5f0ea7406b74c02c1ce26cd375d9cfb26108 ql/lib/codeql/rust/elements/WildPatConstructor.qll 538cde83119510e0b3fc9728127cbf980d17f7f4a9371b4572de26329ab08341 66b96aee3862d5c314a2fbcc6930258f755189c4359394b432e8edb13a9d0eaf ql/lib/codeql/rust/elements/Yeet.qll 07f967352be486b7e2b787c292c16195a7084699cbdf23e2214574afc455261a 593cf9528a531ad140e69b3ea3a885a7a2780abe3ea0d8ec1ef0a9b36b0c013d ql/lib/codeql/rust/elements/YeetConstructor.qll 835afa5ff4b4102335525c41d67380e59f272f95b4b7b0196e0475eae4b9f738 6c51946d661aea16d91010e0639b4ea8f3d161bd56a029e955dc7f7bca025c00 ql/lib/codeql/rust/elements/Yield.qll 9a484b5b5c2c32ef61395213c376ce4b1ef7f699f08330d08faf071ea8919af1 e45fe09b794a2a05a1c125d112dfb36d9c7d538ff1953440d6c580cd8c987f8a ql/lib/codeql/rust/elements/YieldConstructor.qll 16f393593cf9cf126f048c6f36eba7ca45e78c44577c7bda51c9a66bac95487e f49c9c3d4d17f64f44111bea2bb197cf8b11a0aa88b53b9a527c6aab4733c4b5 -ql/lib/codeql/rust/elements.qll 4aca3b30770f4e9b358af1e08727dad8a9e1faf652814741238c54967d2f9574 4aca3b30770f4e9b358af1e08727dad8a9e1faf652814741238c54967d2f9574 +ql/lib/codeql/rust/elements.qll 2f6912dc51cebbfb6e69064c05ce139bdaa9fcc3cabc0fceab390217b327c0c6 2f6912dc51cebbfb6e69064c05ce139bdaa9fcc3cabc0fceab390217b327c0c6 ql/lib/codeql/rust/generated/Array.qll 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 -ql/lib/codeql/rust/generated/Async.qll 4e050ff6d9a61a821c4fc1220f783b86bcad9eb53bceb15cc947cc21e78ce9f8 4e050ff6d9a61a821c4fc1220f783b86bcad9eb53bceb15cc947cc21e78ce9f8 +ql/lib/codeql/rust/generated/AstNode.qll 0598fac7859906f4103124270dfb2fbdb838387b1c45000bf50a4b62c797ec41 f47c84878c7c9676109e358073bddab92a1dbeb4d977d236ecc1eae44d81c894 +ql/lib/codeql/rust/generated/AsyncBlock.qll 4fbb02d4afe512201d78849f52845f7533d7c0482cea84bbf0ef9952fafdfcfa 4fbb02d4afe512201d78849f52845f7533d7c0482cea84bbf0ef9952fafdfcfa ql/lib/codeql/rust/generated/Await.qll f5d65ee72d03205b95b9f507a4da5706f5c66d0da8b4a8a5d67bfae5643a4766 382ad8a5e1098ec697370cdf5453404128abd9d56a1e578e0255aa29d33fcf74 ql/lib/codeql/rust/generated/Become.qll 7cfe61271eb91293014ebf16cd1029454705f4b569bba8afeec7d683f378efaf 9a31140d67ae8e77762aa2bd09ab018c88fe464a1b2205035e957d889abfe42a ql/lib/codeql/rust/generated/BinaryOp.qll ec80f6cb6a0a03496814a629ecc8736f77c46e22a6c26b4e11fe1e650eb91441 67cd9c875556034a7afe78857c2d50d9ae1af084bee87e0d0c691c8baaaae72f @@ -135,14 +137,14 @@ ql/lib/codeql/rust/generated/ConstBlockPat.qll d0818fe4cee066f1e6d3439c82122942a ql/lib/codeql/rust/generated/Continue.qll 73a86f272288f0383b8cb3a8f72e954447a343715d8d82b2b58729077295905f e5d6cc9c7b0c47f01b8a5f076cc5790e837ade852b485ac8c323c540b7e7cd23 ql/lib/codeql/rust/generated/DbFile.qll 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a ql/lib/codeql/rust/generated/DbLocation.qll 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 -ql/lib/codeql/rust/generated/Declaration.qll 4487ac3f5ffa5b92e8628bc04b51e818d4ea1c9a333375cf1b729428d36a4ee7 6481d5e2d99a548f857213a283da75d45db8b3adac949e90fd5d17ceb5e22b54 +ql/lib/codeql/rust/generated/Declaration.qll bbf5ba3792797a829b0032c41fa99d22c26e4277d655099912cdbafb80f0c8cd c4666a71099b21ad5cd83ef6f991ba18f9bef03b3ffbcedfa10aec081d6501d5 ql/lib/codeql/rust/generated/Element.qll 21567fa7348dccdf69dd34e73cb6de7cc9c7e0f3f7bb419a1abd787f7dc851a1 21567fa7348dccdf69dd34e73cb6de7cc9c7e0f3f7bb419a1abd787f7dc851a1 -ql/lib/codeql/rust/generated/Expr.qll 67ed928bc76950917f86e0099c8eb3a57cbd2fc1d2ba5f84a57b4f580e3e553c 3082181dec8f2dbe6d3b858bf8e48bd2d99868d4962be83802d01f7c67cdb9f3 +ql/lib/codeql/rust/generated/Expr.qll 32cdd43d17e8b2fb7c73ec723eba89704d1e853e29d304db5eea3979fcdd2e0b 0b8382b0659afa1bd1d13d0cd492d7fbdc0fd7a5162fa658ca2973bc15ee6534 ql/lib/codeql/rust/generated/ExprStmt.qll 1aba8c482a307f27612317b4d895ac59389e23ff905b6061931fced12ff7c3d1 c4e42a8863cfe4e83eddcd82236da2dbb1fc7bbdf12cab63d39fd1df4b1cb013 ql/lib/codeql/rust/generated/Field.qll c3249b8dd1aed1978077875fbd6090327d431af8cf8888b432cacfa33b76f976 0977ff2fd039f4d6a82ce209d7a7d60a0747a1a3a29be69cf3f136f76429c917 ql/lib/codeql/rust/generated/File.qll 2eff5c882d044d2e360fe6382fb55e5a45f6ccb9df323cfa1fae41eae9d2a47f 87e7a906b3a1b4de056952e288ddd7f69fa7cb1bd9dc7dd3972868a9002ac1e4 ql/lib/codeql/rust/generated/Function.qll 8d5607035adebdb5f1a80ac2688b57ca751bfc010295e4982e6a432d402fc523 337d5aebc38e4413b8a87af87ea91219a51a46d1a04dd8f124b6431dba034a67 -ql/lib/codeql/rust/generated/If.qll 617ac0b7cb00683423245bd16d8e9bcd3c606215fe64afaabab8a5288c6f31e3 7d056c81ef17304acfba52e5bfb2589e8f2231e8524c712d68a7f461a78c3d19 +ql/lib/codeql/rust/generated/If.qll b8040f4bdc6ca2db2cf0435edd9aca432d1ba5f36170f5588a7746f0e4174c51 6033f72ff2d0d3b640b0ef8399d8ef39bc1eec33242a1567cd7dc5ccd2463797 ql/lib/codeql/rust/generated/IfLet.qll 0f51d1f708282a622d075e635698b2020b7d21e77abad6ea12516af13edb5d06 1b9f9c058c888f77a225025b984145a886928caaad26f20e869d9f8a0f5843b4 ql/lib/codeql/rust/generated/Index.qll f1b78db475006a0779a079f9600987932e638bcfaf35ce4e9b2b872798e35d50 7fa2b22497c3bd80161f7e3ef5477c82a0d4f961dce557ed3fd1a62d9f9328f7 ql/lib/codeql/rust/generated/InlineAsm.qll f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 @@ -154,39 +156,39 @@ ql/lib/codeql/rust/generated/Locatable.qll 9e9685bba50ad2220701f3465e63af9331f7f ql/lib/codeql/rust/generated/Location.qll bce4c72988ec6fedd1439c60a37c45aa6147c962904709ef9f12206937174be4 d57000571771a2d997c50d9a43ef1c2f075960f847effa0e80ea91fd4c6b4d6c ql/lib/codeql/rust/generated/Loop.qll e310e7e885374a653a2c3e6b86783b4a5dd71db72cf5f208785c17ea3f90737e 99c52a112d56f8e44a987159122091f46ba9a22b71456e8ba109369ff58db931 ql/lib/codeql/rust/generated/Match.qll e0dd9a39cfcb5cd56efd89c3c009a62ff39c887511ba2962dfeed978830b5000 7378a8a30d7bde2a06a23e7037bddbd64d656ec047ba18142d22086cc7d7da32 -ql/lib/codeql/rust/generated/MatchArm.qll c0aaeab8f7d405de821095686b8065daf4ad600da97658b087203716671bee93 670d2b879eae365204966b4e904f57c76098ce9b9f9d784e4b63a5bad9e9931e +ql/lib/codeql/rust/generated/MatchArm.qll 5ad0dc254b6d58ccd856e4235b68ca0226a898c33f1f6b6fe7b48266a01ca627 f519af39f45e820eb3a70cefb0e4dfb541c3cf17952c00c6dd7e59f854a629bd ql/lib/codeql/rust/generated/MethodCall.qll 1d7afd5e8795b89f3cd20569fe7e0b7fd339aa178ed6ecb2a3a9cadd1a49eede 7a6396ce629a46db16de523fd39e2bb2c56837df80990ff1dd3bdfe242c20761 ql/lib/codeql/rust/generated/MissingExpr.qll 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 231b3332f96ddd4ebe180c069267ca58d935f193f1437432ae3fc2e136f16800 6b7810b3e296a4dbf899c4d5da2c80dd66d8d7665bef8ec75a6f2dbc00917c3e -ql/lib/codeql/rust/generated/Pat.qll 0334fff3df2bd0ea6f25c150c79ac462b35095b14e6f5208f947b9759b2396fc f02694d64b29637eaa5c7ef04ec0d1fddc01c85d38f0df6f2fb82ebcdc458923 +ql/lib/codeql/rust/generated/ParentChild.qll 0f030634cebcef8f5057032eac1507db56be4a63b3e6d5dc1bc2ca7a5efb47ae cfd2a4a19279118616d435cbfe4141d8cd2bc4bba62ac389f35c752d7c46924e +ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 119ace38b931d203b0728441c813f662715b24a0abf0faff06e6fe52b9b24cf8 828ac11f4660cf126969472ff2a4224acb00869db169f259abe26bb23a825898 +ql/lib/codeql/rust/generated/Raw.qll 9e527657ad4eaa36585a786e83a03adb93493b496bd241bef1cc6acefab37009 8974d8dcd0914c109e6792f448bb1d504ff0cee73ee883134dc5f64b2a643c8f ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb50a9f2bf62e49bf182d64b6d 804efbd32869f92e5515d34852fed6416288f99b0aab95b5be5cb5bdd1eea806 ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511 ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533 -ql/lib/codeql/rust/generated/Stmt.qll 6eb11dfb08004f762c3825d3433b6981b011ab906092d38764102bfde70a94ba 07d2fa92c4b5f14a08d80391ce74eacf89045097451498d0902800ba19328f65 -ql/lib/codeql/rust/generated/Synth.qll 58bde7feae55a29e10d47a2acc0a76c531b754096bc84d43b57b6763000d210c a363d9a61182e011370ea03de2e22ca5991da5f0a963d21ef17dee8df72104cc -ql/lib/codeql/rust/generated/SynthConstructors.qll e6bc351d69b548ba047c02415d1919c448cebe2d55578499f64d5ac87fbc246a e6bc351d69b548ba047c02415d1919c448cebe2d55578499f64d5ac87fbc246a +ql/lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd +ql/lib/codeql/rust/generated/Synth.qll b0227cc6042034c1f5ad6829b4b8d2574ef16cf1a5b4dd81bb172a0756fae4a2 209b97b56028449709f9e1477ed9f060c6ac3a51f0a72c84d2dc58c6c9cc0c82 +ql/lib/codeql/rust/generated/SynthConstructors.qll c3393b74c66e2d9606e82581f393491152f97ebbc91d49f1688a62d071d6e28d c3393b74c66e2d9606e82581f393491152f97ebbc91d49f1688a62d071d6e28d ql/lib/codeql/rust/generated/Tuple.qll 3fde94f0c23c6af6bcb58d0245a3cd0a8bbd6ef7999fbeed805baf2615e6226d c1aa7fc201aebb34dc6cd7760e817032b86fd16b8facac450c74deda860bc821 ql/lib/codeql/rust/generated/TuplePat.qll fdb2c66fe6291106fe125de6a91c4d74b2c715d276c2fee9751d0523b618d095 330098460ccac28479a2b522048d6f1191bf01b40b3eceef4adf722c01c8360b ql/lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 -ql/lib/codeql/rust/generated/TypeRef.qll d9c43cb829076091f06aa23ff2151e1d832ea355d5fcfdff732796299b14811d d9c43cb829076091f06aa23ff2151e1d832ea355d5fcfdff732796299b14811d -ql/lib/codeql/rust/generated/UnaryExpr.qll c9756e03ea83bb17250528f896e29c05d105534637353cd383d0de2e2e52b764 98bfc8e1c675e975181edf43816971647176bc5d12f7d1cfb642f8f741fead07 +ql/lib/codeql/rust/generated/TypeRef.qll 7cc468c2f473ee13c11a97c4360100376560e8fc42f25a136f1500fe31a31533 7cc468c2f473ee13c11a97c4360100376560e8fc42f25a136f1500fe31a31533 +ql/lib/codeql/rust/generated/UnaryOp.qll fa587434c234c68606e3d0e32f6f07f89fa468dc97b582242f42c23c009e489a cef0fcfff7527435486b4ba642c5c5d5a17935b41b7388e70311646195bcf5fc ql/lib/codeql/rust/generated/Underscore.qll d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d ql/lib/codeql/rust/generated/UnknownFile.qll ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ql/lib/codeql/rust/generated/UnknownLocation.qll a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf -ql/lib/codeql/rust/generated/Unsafe.qll 3688228843b32ff905f1fdc462213bdfe3449d572388b85114d2e59fba099b4c 3688228843b32ff905f1fdc462213bdfe3449d572388b85114d2e59fba099b4c +ql/lib/codeql/rust/generated/UnsafeBlock.qll c15dcb7b1ea1b4b269bd7eba4cc798852d714319d16495ba660f4f34cfd70306 c15dcb7b1ea1b4b269bd7eba4cc798852d714319d16495ba660f4f34cfd70306 ql/lib/codeql/rust/generated/WildPat.qll 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 ql/lib/codeql/rust/generated/Yeet.qll 41b05d32a1b93cee770d6706cc044efe8ce57f11ae2f009c59666264cd1aaec1 8a6c8a1ae59e5a7e1b64abea85f6362c0460cbd5fcace1520b213ef5e08331ef ql/lib/codeql/rust/generated/Yield.qll afefea932d770b61b633feeaa05973943c2bb45ea3cd4f960a0be1bbce33a405 c975fba823b05ad40b3c1bd908880e65511b59f9e6882fa207009194a45134a0 diff --git a/rust/.gitattributes b/rust/.gitattributes index aeb7bf93c363..e7814c65445b 100644 --- a/rust/.gitattributes +++ b/rust/.gitattributes @@ -2,8 +2,9 @@ /.gitattributes linguist-generated /ql/lib/codeql/rust/elements/Array.qll linguist-generated /ql/lib/codeql/rust/elements/ArrayConstructor.qll linguist-generated -/ql/lib/codeql/rust/elements/Async.qll linguist-generated -/ql/lib/codeql/rust/elements/AsyncConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/AstNode.qll linguist-generated +/ql/lib/codeql/rust/elements/AsyncBlock.qll linguist-generated +/ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Await.qll linguist-generated /ql/lib/codeql/rust/elements/AwaitConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Become.qll linguist-generated @@ -106,12 +107,12 @@ /ql/lib/codeql/rust/elements/TupleStructPatConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/TypeRef.qll linguist-generated /ql/lib/codeql/rust/elements/TypeRefConstructor.qll linguist-generated -/ql/lib/codeql/rust/elements/UnaryExpr.qll linguist-generated -/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/UnaryOp.qll linguist-generated +/ql/lib/codeql/rust/elements/UnaryOpConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Underscore.qll linguist-generated /ql/lib/codeql/rust/elements/UnderscoreConstructor.qll linguist-generated -/ql/lib/codeql/rust/elements/Unsafe.qll linguist-generated -/ql/lib/codeql/rust/elements/UnsafeConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/UnsafeBlock.qll linguist-generated +/ql/lib/codeql/rust/elements/UnsafeBlockConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/WildPat.qll linguist-generated /ql/lib/codeql/rust/elements/WildPatConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Yeet.qll linguist-generated @@ -120,7 +121,8 @@ /ql/lib/codeql/rust/elements/YieldConstructor.qll linguist-generated /ql/lib/codeql/rust/elements.qll linguist-generated /ql/lib/codeql/rust/generated/Array.qll linguist-generated -/ql/lib/codeql/rust/generated/Async.qll linguist-generated +/ql/lib/codeql/rust/generated/AstNode.qll linguist-generated +/ql/lib/codeql/rust/generated/AsyncBlock.qll linguist-generated /ql/lib/codeql/rust/generated/Await.qll linguist-generated /ql/lib/codeql/rust/generated/Become.qll linguist-generated /ql/lib/codeql/rust/generated/BinaryOp.qll linguist-generated @@ -184,11 +186,11 @@ /ql/lib/codeql/rust/generated/TuplePat.qll linguist-generated /ql/lib/codeql/rust/generated/TupleStructPat.qll linguist-generated /ql/lib/codeql/rust/generated/TypeRef.qll linguist-generated -/ql/lib/codeql/rust/generated/UnaryExpr.qll linguist-generated +/ql/lib/codeql/rust/generated/UnaryOp.qll linguist-generated /ql/lib/codeql/rust/generated/Underscore.qll linguist-generated /ql/lib/codeql/rust/generated/UnknownFile.qll linguist-generated /ql/lib/codeql/rust/generated/UnknownLocation.qll linguist-generated -/ql/lib/codeql/rust/generated/Unsafe.qll linguist-generated +/ql/lib/codeql/rust/generated/UnsafeBlock.qll linguist-generated /ql/lib/codeql/rust/generated/WildPat.qll linguist-generated /ql/lib/codeql/rust/generated/Yeet.qll linguist-generated /ql/lib/codeql/rust/generated/Yield.qll linguist-generated diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 93705e171e37..06f4ec674911 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -478,8 +478,8 @@ pub struct If { pub id: TrapId, pub location: Option, pub condition: trap::Label, - pub then_branch: trap::Label, - pub else_branch: Option, + pub then: trap::Label, + pub else_: Option, } impl TrapEntry for If { @@ -488,12 +488,12 @@ impl TrapEntry for If { } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("ifs", vec![trap::Arg::Label(id), self.condition.into(), self.then_branch.into()]); + out.add_tuple("ifs", vec![trap::Arg::Label(id), self.condition.into(), self.then.into()]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - if let Some(v) = self.else_branch { - out.add_tuple("if_else_branches", vec![trap::Arg::Label(id), v.into()]); + if let Some(v) = self.else_ { + out.add_tuple("if_elses", vec![trap::Arg::Label(id), v.into()]); } } } @@ -1135,20 +1135,20 @@ impl TrapEntry for TupleStructPat { } #[derive(Debug)] -pub struct UnaryExpr { +pub struct UnaryOp { pub id: TrapId, pub location: Option, pub expr: trap::Label, pub op: String, } -impl TrapEntry for UnaryExpr { +impl TrapEntry for UnaryOp { fn extract_id(&mut self) -> TrapId { std::mem::replace(&mut self.id, TrapId::Star) } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("unary_exprs", vec![trap::Arg::Label(id), self.expr.into(), self.op.into()]); + out.add_tuple("unary_ops", vec![trap::Arg::Label(id), self.expr.into(), self.op.into()]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } @@ -1240,7 +1240,7 @@ impl TrapEntry for Yield { } #[derive(Debug)] -pub struct Async { +pub struct AsyncBlock { pub id: TrapId, pub location: Option, pub statements: Vec, @@ -1248,13 +1248,13 @@ pub struct Async { pub label: Option, } -impl TrapEntry for Async { +impl TrapEntry for AsyncBlock { fn extract_id(&mut self) -> TrapId { std::mem::replace(&mut self.id, TrapId::Star) } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("asyncs", vec![trap::Arg::Label(id)]); + out.add_tuple("async_blocks", vec![trap::Arg::Label(id)]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } @@ -1271,7 +1271,7 @@ impl TrapEntry for Async { } #[derive(Debug)] -pub struct Unsafe { +pub struct UnsafeBlock { pub id: TrapId, pub location: Option, pub statements: Vec, @@ -1279,13 +1279,13 @@ pub struct Unsafe { pub label: Option, } -impl TrapEntry for Unsafe { +impl TrapEntry for UnsafeBlock { fn extract_id(&mut self) -> TrapId { std::mem::replace(&mut self.id, TrapId::Star) } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("unsaves", vec![trap::Arg::Label(id)]); + out.add_tuple("unsafe_blocks", vec![trap::Arg::Label(id)]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index 8b7d6dfb04a3..45292a045588 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -4,7 +4,8 @@ */ import codeql.rust.elements.Array -import codeql.rust.elements.Async +import codeql.rust.elements.AstNode +import codeql.rust.elements.AsyncBlock import codeql.rust.elements.Await import codeql.rust.elements.Become import codeql.rust.elements.BinaryOp @@ -63,11 +64,11 @@ import codeql.rust.elements.Tuple import codeql.rust.elements.TuplePat import codeql.rust.elements.TupleStructPat import codeql.rust.elements.TypeRef -import codeql.rust.elements.UnaryExpr +import codeql.rust.elements.UnaryOp import codeql.rust.elements.Underscore import codeql.rust.elements.UnknownFile import codeql.rust.elements.UnknownLocation -import codeql.rust.elements.Unsafe +import codeql.rust.elements.UnsafeBlock import codeql.rust.elements.WildPat import codeql.rust.elements.Yeet import codeql.rust.elements.Yield diff --git a/rust/ql/lib/codeql/rust/elements/Async.qll b/rust/ql/lib/codeql/rust/elements/AstNode.qll similarity index 56% rename from rust/ql/lib/codeql/rust/elements/Async.qll rename to rust/ql/lib/codeql/rust/elements/AstNode.qll index dc24a0419013..f1edc4ac4932 100644 --- a/rust/ql/lib/codeql/rust/elements/Async.qll +++ b/rust/ql/lib/codeql/rust/elements/AstNode.qll @@ -1,8 +1,8 @@ // generated by codegen, remove this comment if you wish to edit this file /** - * This module provides a hand-modifiable wrapper around the generated class `Async`. + * This module provides a hand-modifiable wrapper around the generated class `AstNode`. */ -private import codeql.rust.generated.Async +private import codeql.rust.generated.AstNode -class Async extends Generated::Async { } +class AstNode extends Generated::AstNode { } diff --git a/rust/ql/lib/codeql/rust/elements/UnaryExpr.qll b/rust/ql/lib/codeql/rust/elements/AsyncBlock.qll similarity index 54% rename from rust/ql/lib/codeql/rust/elements/UnaryExpr.qll rename to rust/ql/lib/codeql/rust/elements/AsyncBlock.qll index e763808e7c81..122709ac8551 100644 --- a/rust/ql/lib/codeql/rust/elements/UnaryExpr.qll +++ b/rust/ql/lib/codeql/rust/elements/AsyncBlock.qll @@ -1,8 +1,8 @@ // generated by codegen, remove this comment if you wish to edit this file /** - * This module provides a hand-modifiable wrapper around the generated class `UnaryExpr`. + * This module provides a hand-modifiable wrapper around the generated class `AsyncBlock`. */ -private import codeql.rust.generated.UnaryExpr +private import codeql.rust.generated.AsyncBlock -class UnaryExpr extends Generated::UnaryExpr { } +class AsyncBlock extends Generated::AsyncBlock { } diff --git a/rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll b/rust/ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll similarity index 61% rename from rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll rename to rust/ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll index 0f4ad56a6366..17c04027e7d6 100644 --- a/rust/ql/lib/codeql/rust/elements/AsyncConstructor.qll +++ b/rust/ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll @@ -1,14 +1,14 @@ // generated by codegen, remove this comment if you wish to edit this file /** * This module defines the hook used internally to tweak the characteristic predicate of - * `Async` synthesized instances. + * `AsyncBlock` synthesized instances. * INTERNAL: Do not use. */ private import codeql.rust.generated.Raw /** - * The characteristic predicate of `Async` synthesized instances. + * The characteristic predicate of `AsyncBlock` synthesized instances. * INTERNAL: Do not use. */ -predicate constructAsync(Raw::Async id) { any() } +predicate constructAsyncBlock(Raw::AsyncBlock id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Unsafe.qll b/rust/ql/lib/codeql/rust/elements/UnaryOp.qll similarity index 56% rename from rust/ql/lib/codeql/rust/elements/Unsafe.qll rename to rust/ql/lib/codeql/rust/elements/UnaryOp.qll index 741e504b740a..532610e178b1 100644 --- a/rust/ql/lib/codeql/rust/elements/Unsafe.qll +++ b/rust/ql/lib/codeql/rust/elements/UnaryOp.qll @@ -1,8 +1,8 @@ // generated by codegen, remove this comment if you wish to edit this file /** - * This module provides a hand-modifiable wrapper around the generated class `Unsafe`. + * This module provides a hand-modifiable wrapper around the generated class `UnaryOp`. */ -private import codeql.rust.generated.Unsafe +private import codeql.rust.generated.UnaryOp -class Unsafe extends Generated::Unsafe { } +class UnaryOp extends Generated::UnaryOp { } diff --git a/rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll b/rust/ql/lib/codeql/rust/elements/UnaryOpConstructor.qll similarity index 63% rename from rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll rename to rust/ql/lib/codeql/rust/elements/UnaryOpConstructor.qll index 63d6f0f9a29e..e3178f957fee 100644 --- a/rust/ql/lib/codeql/rust/elements/UnsafeConstructor.qll +++ b/rust/ql/lib/codeql/rust/elements/UnaryOpConstructor.qll @@ -1,14 +1,14 @@ // generated by codegen, remove this comment if you wish to edit this file /** * This module defines the hook used internally to tweak the characteristic predicate of - * `Unsafe` synthesized instances. + * `UnaryOp` synthesized instances. * INTERNAL: Do not use. */ private import codeql.rust.generated.Raw /** - * The characteristic predicate of `Unsafe` synthesized instances. + * The characteristic predicate of `UnaryOp` synthesized instances. * INTERNAL: Do not use. */ -predicate constructUnsafe(Raw::Unsafe id) { any() } +predicate constructUnaryOp(Raw::UnaryOp id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/UnsafeBlock.qll b/rust/ql/lib/codeql/rust/elements/UnsafeBlock.qll new file mode 100644 index 000000000000..d50f59a517e0 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/UnsafeBlock.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `UnsafeBlock`. + */ + +private import codeql.rust.generated.UnsafeBlock + +class UnsafeBlock extends Generated::UnsafeBlock { } diff --git a/rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll b/rust/ql/lib/codeql/rust/elements/UnsafeBlockConstructor.qll similarity index 61% rename from rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll rename to rust/ql/lib/codeql/rust/elements/UnsafeBlockConstructor.qll index ddc00a7d864b..ac16d6f86578 100644 --- a/rust/ql/lib/codeql/rust/elements/UnaryExprConstructor.qll +++ b/rust/ql/lib/codeql/rust/elements/UnsafeBlockConstructor.qll @@ -1,14 +1,14 @@ // generated by codegen, remove this comment if you wish to edit this file /** * This module defines the hook used internally to tweak the characteristic predicate of - * `UnaryExpr` synthesized instances. + * `UnsafeBlock` synthesized instances. * INTERNAL: Do not use. */ private import codeql.rust.generated.Raw /** - * The characteristic predicate of `UnaryExpr` synthesized instances. + * The characteristic predicate of `UnsafeBlock` synthesized instances. * INTERNAL: Do not use. */ -predicate constructUnaryExpr(Raw::UnaryExpr id) { any() } +predicate constructUnsafeBlock(Raw::UnsafeBlock id) { any() } diff --git a/rust/ql/lib/codeql/rust/generated/AstNode.qll b/rust/ql/lib/codeql/rust/generated/AstNode.qll new file mode 100644 index 000000000000..e4e922b64e2a --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/AstNode.qll @@ -0,0 +1,21 @@ +// generated by codegen +/** + * This module provides the generated definition of `AstNode`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Locatable + +/** + * INTERNAL: This module contains the fully generated definition of `AstNode` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::AstNode` class directly. + * Use the subclass `AstNode`, where the following predicates are available. + */ + class AstNode extends Synth::TAstNode, Locatable { } +} diff --git a/rust/ql/lib/codeql/rust/generated/Async.qll b/rust/ql/lib/codeql/rust/generated/Async.qll deleted file mode 100644 index cdf45b869775..000000000000 --- a/rust/ql/lib/codeql/rust/generated/Async.qll +++ /dev/null @@ -1,23 +0,0 @@ -// generated by codegen -/** - * This module provides the generated definition of `Async`. - * INTERNAL: Do not import directly. - */ - -private import codeql.rust.generated.Synth -private import codeql.rust.generated.Raw -import codeql.rust.elements.Block - -/** - * INTERNAL: This module contains the fully generated definition of `Async` and should not - * be referenced directly. - */ -module Generated { - /** - * INTERNAL: Do not reference the `Generated::Async` class directly. - * Use the subclass `Async`, where the following predicates are available. - */ - class Async extends Synth::TAsync, Block { - override string getAPrimaryQlClass() { result = "Async" } - } -} diff --git a/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll b/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll new file mode 100644 index 000000000000..b24fa152387d --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `AsyncBlock`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Block + +/** + * INTERNAL: This module contains the fully generated definition of `AsyncBlock` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::AsyncBlock` class directly. + * Use the subclass `AsyncBlock`, where the following predicates are available. + */ + class AsyncBlock extends Synth::TAsyncBlock, Block { + override string getAPrimaryQlClass() { result = "AsyncBlock" } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Declaration.qll b/rust/ql/lib/codeql/rust/generated/Declaration.qll index 62e9f185387f..0cc2a30f178b 100644 --- a/rust/ql/lib/codeql/rust/generated/Declaration.qll +++ b/rust/ql/lib/codeql/rust/generated/Declaration.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Locatable +import codeql.rust.elements.AstNode /** * INTERNAL: This module contains the fully generated definition of `Declaration` and should not @@ -17,5 +17,5 @@ module Generated { * INTERNAL: Do not reference the `Generated::Declaration` class directly. * Use the subclass `Declaration`, where the following predicates are available. */ - class Declaration extends Synth::TDeclaration, Locatable { } + class Declaration extends Synth::TDeclaration, AstNode { } } diff --git a/rust/ql/lib/codeql/rust/generated/Expr.qll b/rust/ql/lib/codeql/rust/generated/Expr.qll index cfb39a35590c..f395ff11840e 100644 --- a/rust/ql/lib/codeql/rust/generated/Expr.qll +++ b/rust/ql/lib/codeql/rust/generated/Expr.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Locatable +import codeql.rust.elements.AstNode /** * INTERNAL: This module contains the fully generated definition of `Expr` and should not @@ -17,5 +17,5 @@ module Generated { * INTERNAL: Do not reference the `Generated::Expr` class directly. * Use the subclass `Expr`, where the following predicates are available. */ - class Expr extends Synth::TExpr, Locatable { } + class Expr extends Synth::TExpr, AstNode { } } diff --git a/rust/ql/lib/codeql/rust/generated/If.qll b/rust/ql/lib/codeql/rust/generated/If.qll index bdb9542980b6..6430d2153fd5 100644 --- a/rust/ql/lib/codeql/rust/generated/If.qll +++ b/rust/ql/lib/codeql/rust/generated/If.qll @@ -28,22 +28,22 @@ module Generated { } /** - * Gets the then branch of this if. + * Gets the then of this if. */ - Expr getThenBranch() { - result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getThenBranch()) + Expr getThen() { + result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getThen()) } /** - * Gets the else branch of this if, if it exists. + * Gets the else of this if, if it exists. */ - Expr getElseBranch() { - result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getElseBranch()) + Expr getElse() { + result = Synth::convertExprFromRaw(Synth::convertIfToRaw(this).(Raw::If).getElse()) } /** - * Holds if `getElseBranch()` exists. + * Holds if `getElse()` exists. */ - final predicate hasElseBranch() { exists(this.getElseBranch()) } + final predicate hasElse() { exists(this.getElse()) } } } diff --git a/rust/ql/lib/codeql/rust/generated/MatchArm.qll b/rust/ql/lib/codeql/rust/generated/MatchArm.qll index a6e4f49ea59d..cec99d17c321 100644 --- a/rust/ql/lib/codeql/rust/generated/MatchArm.qll +++ b/rust/ql/lib/codeql/rust/generated/MatchArm.qll @@ -6,8 +6,8 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw +import codeql.rust.elements.AstNode import codeql.rust.elements.Expr -import codeql.rust.elements.Locatable import codeql.rust.elements.Pat /** @@ -19,7 +19,7 @@ module Generated { * INTERNAL: Do not reference the `Generated::MatchArm` class directly. * Use the subclass `MatchArm`, where the following predicates are available. */ - class MatchArm extends Synth::TMatchArm, Locatable { + class MatchArm extends Synth::TMatchArm, AstNode { override string getAPrimaryQlClass() { result = "MatchArm" } /** diff --git a/rust/ql/lib/codeql/rust/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/generated/ParentChild.qll index b780774d754f..7aafef78ab45 100644 --- a/rust/ql/lib/codeql/rust/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/generated/ParentChild.qll @@ -49,6 +49,19 @@ private module Impl { ) } + private Element getImmediateChildOfAstNode(AstNode e, int index, string partialPredicateCall) { + exists(int b, int bLocatable, int n | + b = 0 and + bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and + n = bLocatable and + ( + none() + or + result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + ) + ) + } + private Element getImmediateChildOfDbFile(DbFile e, int index, string partialPredicateCall) { exists(int b, int bFile, int n | b = 0 and @@ -75,112 +88,112 @@ private module Impl { ) } - private Element getImmediateChildOfDeclaration( - Declaration e, int index, string partialPredicateCall + private Element getImmediateChildOfUnknownFile( + UnknownFile e, int index, string partialPredicateCall ) { - exists(int b, int bLocatable, int n | + exists(int b, int bFile, int n | b = 0 and - bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and - n = bLocatable and + bFile = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfFile(e, i, _)) | i) and + n = bFile and ( none() or - result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + result = getImmediateChildOfFile(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfExpr(Expr e, int index, string partialPredicateCall) { - exists(int b, int bLocatable, int n | + private Element getImmediateChildOfUnknownLocation( + UnknownLocation e, int index, string partialPredicateCall + ) { + exists(int b, int bLocation, int n | b = 0 and - bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and - n = bLocatable and + bLocation = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocation(e, i, _)) | i) and + n = bLocation and ( none() or - result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + result = getImmediateChildOfLocation(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfMatchArm(MatchArm e, int index, string partialPredicateCall) { - exists(int b, int bLocatable, int n | + private Element getImmediateChildOfDeclaration( + Declaration e, int index, string partialPredicateCall + ) { + exists(int b, int bAstNode, int n | b = 0 and - bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and - n = bLocatable and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and ( none() or - result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfPat(Pat e, int index, string partialPredicateCall) { - exists(int b, int bLocatable, int n | + private Element getImmediateChildOfExpr(Expr e, int index, string partialPredicateCall) { + exists(int b, int bAstNode, int n | b = 0 and - bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and - n = bLocatable and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and ( none() or - result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfStmt(Stmt e, int index, string partialPredicateCall) { - exists(int b, int bLocatable, int n | + private Element getImmediateChildOfMatchArm(MatchArm e, int index, string partialPredicateCall) { + exists(int b, int bAstNode, int n | b = 0 and - bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and - n = bLocatable and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and ( none() or - result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfTypeRef(TypeRef e, int index, string partialPredicateCall) { - exists(int b, int bLocatable, int n | + private Element getImmediateChildOfPat(Pat e, int index, string partialPredicateCall) { + exists(int b, int bAstNode, int n | b = 0 and - bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and - n = bLocatable and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and ( none() or - result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall) + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfUnknownFile( - UnknownFile e, int index, string partialPredicateCall - ) { - exists(int b, int bFile, int n | + private Element getImmediateChildOfStmt(Stmt e, int index, string partialPredicateCall) { + exists(int b, int bAstNode, int n | b = 0 and - bFile = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfFile(e, i, _)) | i) and - n = bFile and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and ( none() or - result = getImmediateChildOfFile(e, index - b, partialPredicateCall) + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) ) ) } - private Element getImmediateChildOfUnknownLocation( - UnknownLocation e, int index, string partialPredicateCall - ) { - exists(int b, int bLocation, int n | + private Element getImmediateChildOfTypeRef(TypeRef e, int index, string partialPredicateCall) { + exists(int b, int bAstNode, int n | b = 0 and - bLocation = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocation(e, i, _)) | i) and - n = bLocation and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and ( none() or - result = getImmediateChildOfLocation(e, index - b, partialPredicateCall) + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) ) ) } @@ -808,7 +821,7 @@ private module Impl { ) } - private Element getImmediateChildOfUnaryExpr(UnaryExpr e, int index, string partialPredicateCall) { + private Element getImmediateChildOfUnaryOp(UnaryOp e, int index, string partialPredicateCall) { exists(int b, int bExpr, int n | b = 0 and bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and @@ -873,7 +886,7 @@ private module Impl { ) } - private Element getImmediateChildOfAsync(Async e, int index, string partialPredicateCall) { + private Element getImmediateChildOfAsyncBlock(AsyncBlock e, int index, string partialPredicateCall) { exists(int b, int bBlock, int n | b = 0 and bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and @@ -886,7 +899,9 @@ private module Impl { ) } - private Element getImmediateChildOfUnsafe(Unsafe e, int index, string partialPredicateCall) { + private Element getImmediateChildOfUnsafeBlock( + UnsafeBlock e, int index, string partialPredicateCall + ) { exists(int b, int bBlock, int n | b = 0 and bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and @@ -909,14 +924,14 @@ private module Impl { or result = getImmediateChildOfDbLocation(e, index, partialAccessor) or - result = getImmediateChildOfMatchArm(e, index, partialAccessor) - or - result = getImmediateChildOfTypeRef(e, index, partialAccessor) - or result = getImmediateChildOfUnknownFile(e, index, partialAccessor) or result = getImmediateChildOfUnknownLocation(e, index, partialAccessor) or + result = getImmediateChildOfMatchArm(e, index, partialAccessor) + or + result = getImmediateChildOfTypeRef(e, index, partialAccessor) + or result = getImmediateChildOfArray(e, index, partialAccessor) or result = getImmediateChildOfAwait(e, index, partialAccessor) @@ -1009,7 +1024,7 @@ private module Impl { or result = getImmediateChildOfTupleStructPat(e, index, partialAccessor) or - result = getImmediateChildOfUnaryExpr(e, index, partialAccessor) + result = getImmediateChildOfUnaryOp(e, index, partialAccessor) or result = getImmediateChildOfUnderscore(e, index, partialAccessor) or @@ -1019,9 +1034,9 @@ private module Impl { or result = getImmediateChildOfYield(e, index, partialAccessor) or - result = getImmediateChildOfAsync(e, index, partialAccessor) + result = getImmediateChildOfAsyncBlock(e, index, partialAccessor) or - result = getImmediateChildOfUnsafe(e, index, partialAccessor) + result = getImmediateChildOfUnsafeBlock(e, index, partialAccessor) } } diff --git a/rust/ql/lib/codeql/rust/generated/Pat.qll b/rust/ql/lib/codeql/rust/generated/Pat.qll index af27a09e996e..c21fcf46d715 100644 --- a/rust/ql/lib/codeql/rust/generated/Pat.qll +++ b/rust/ql/lib/codeql/rust/generated/Pat.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Locatable +import codeql.rust.elements.AstNode /** * INTERNAL: This module contains the fully generated definition of `Pat` and should not @@ -17,5 +17,5 @@ module Generated { * INTERNAL: Do not reference the `Generated::Pat` class directly. * Use the subclass `Pat`, where the following predicates are available. */ - class Pat extends Synth::TPat, Locatable { } + class Pat extends Synth::TPat, AstNode { } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 1718b94775cf..2e44be7d26e7 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -60,6 +60,11 @@ module Raw { int getEndColumn() { locations(this, _, _, _, _, result) } } + /** + * INTERNAL: Do not use. + */ + class AstNode extends @ast_node, Locatable { } + /** * INTERNAL: Do not use. */ @@ -77,17 +82,17 @@ module Raw { /** * INTERNAL: Do not use. */ - class Declaration extends @declaration, Locatable { } + class Declaration extends @declaration, AstNode { } /** * INTERNAL: Do not use. */ - class Expr extends @expr, Locatable { } + class Expr extends @expr, AstNode { } /** * INTERNAL: Do not use. */ - class MatchArm extends @match_arm, Locatable { + class MatchArm extends @match_arm, AstNode { override string toString() { result = "MatchArm" } /** @@ -109,17 +114,17 @@ module Raw { /** * INTERNAL: Do not use. */ - class Pat extends @pat, Locatable { } + class Pat extends @pat, AstNode { } /** * INTERNAL: Do not use. */ - class Stmt extends @stmt, Locatable { } + class Stmt extends @stmt, AstNode { } /** * INTERNAL: Do not use. */ - class TypeRef extends @type_ref, Locatable { + class TypeRef extends @type_ref, AstNode { override string toString() { result = "TypeRef" } } @@ -419,14 +424,14 @@ module Raw { Expr getCondition() { ifs(this, result, _) } /** - * Gets the then branch of this if. + * Gets the then of this if. */ - Expr getThenBranch() { ifs(this, _, result) } + Expr getThen() { ifs(this, _, result) } /** - * Gets the else branch of this if, if it exists. + * Gets the else of this if, if it exists. */ - Expr getElseBranch() { if_else_branches(this, result) } + Expr getElse() { if_elses(this, result) } } /** @@ -803,18 +808,18 @@ module Raw { /** * INTERNAL: Do not use. */ - class UnaryExpr extends @unary_expr, Expr { - override string toString() { result = "UnaryExpr" } + class UnaryOp extends @unary_op, Expr { + override string toString() { result = "UnaryOp" } /** - * Gets the expression of this unary expression. + * Gets the expression of this unary op. */ - Expr getExpr() { unary_exprs(this, result, _) } + Expr getExpr() { unary_ops(this, result, _) } /** - * Gets the op of this unary expression. + * Gets the op of this unary op. */ - string getOp() { unary_exprs(this, _, result) } + string getOp() { unary_ops(this, _, result) } } /** @@ -858,14 +863,14 @@ module Raw { /** * INTERNAL: Do not use. */ - class Async extends @async, Block { - override string toString() { result = "Async" } + class AsyncBlock extends @async_block, Block { + override string toString() { result = "AsyncBlock" } } /** * INTERNAL: Do not use. */ - class Unsafe extends @unsafe, Block { - override string toString() { result = "Unsafe" } + class UnsafeBlock extends @unsafe_block, Block { + override string toString() { result = "UnsafeBlock" } } } diff --git a/rust/ql/lib/codeql/rust/generated/Stmt.qll b/rust/ql/lib/codeql/rust/generated/Stmt.qll index 48c1c8832994..d1536f06e7cd 100644 --- a/rust/ql/lib/codeql/rust/generated/Stmt.qll +++ b/rust/ql/lib/codeql/rust/generated/Stmt.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Locatable +import codeql.rust.elements.AstNode /** * INTERNAL: This module contains the fully generated definition of `Stmt` and should not @@ -17,5 +17,5 @@ module Generated { * INTERNAL: Do not reference the `Generated::Stmt` class directly. * Use the subclass `Stmt`, where the following predicates are available. */ - class Stmt extends Synth::TStmt, Locatable { } + class Stmt extends Synth::TStmt, AstNode { } } diff --git a/rust/ql/lib/codeql/rust/generated/Synth.qll b/rust/ql/lib/codeql/rust/generated/Synth.qll index 7be1654bae51..539ccd58e250 100644 --- a/rust/ql/lib/codeql/rust/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/generated/Synth.qll @@ -22,7 +22,7 @@ module Synth { /** * INTERNAL: Do not use. */ - TAsync(Raw::Async id) { constructAsync(id) } or + TAsyncBlock(Raw::AsyncBlock id) { constructAsyncBlock(id) } or /** * INTERNAL: Do not use. */ @@ -222,7 +222,7 @@ module Synth { /** * INTERNAL: Do not use. */ - TUnaryExpr(Raw::UnaryExpr id) { constructUnaryExpr(id) } or + TUnaryOp(Raw::UnaryOp id) { constructUnaryOp(id) } or /** * INTERNAL: Do not use. */ @@ -238,7 +238,7 @@ module Synth { /** * INTERNAL: Do not use. */ - TUnsafe(Raw::Unsafe id) { constructUnsafe(id) } or + TUnsafeBlock(Raw::UnsafeBlock id) { constructUnsafeBlock(id) } or /** * INTERNAL: Do not use. */ @@ -255,7 +255,12 @@ module Synth { /** * INTERNAL: Do not use. */ - class TBlock = TAsync or TUnsafe; + class TAstNode = TDeclaration or TExpr or TMatchArm or TPat or TStmt or TTypeRef; + + /** + * INTERNAL: Do not use. + */ + class TBlock = TAsyncBlock or TUnsafeBlock; /** * INTERNAL: Do not use. @@ -269,7 +274,7 @@ module Synth { TArray or TAwait or TBecome or TBinaryOp or TBlock or TBox or TBreak or TCall or TCast or TClosure or TConst or TContinue or TField or TIf or TIndex or TInlineAsm or TLet or TLiteral or TLoop or TMatch or TMethodCall or TMissingExpr or TOffsetOf or TPath or - TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryExpr or TUnderscore or TYeet or + TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryOp or TUnderscore or TYeet or TYield; /** @@ -280,7 +285,7 @@ module Synth { /** * INTERNAL: Do not use. */ - class TLocatable = TDeclaration or TExpr or TMatchArm or TPat or TStmt or TTypeRef; + class TLocatable = TAstNode; /** * INTERNAL: Do not use. @@ -308,10 +313,10 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TAsync`, if possible. + * Converts a raw element to a synthesized `TAsyncBlock`, if possible. */ cached - TAsync convertAsyncFromRaw(Raw::Element e) { result = TAsync(e) } + TAsyncBlock convertAsyncBlockFromRaw(Raw::Element e) { result = TAsyncBlock(e) } /** * INTERNAL: Do not use. @@ -658,10 +663,10 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TUnaryExpr`, if possible. + * Converts a raw element to a synthesized `TUnaryOp`, if possible. */ cached - TUnaryExpr convertUnaryExprFromRaw(Raw::Element e) { result = TUnaryExpr(e) } + TUnaryOp convertUnaryOpFromRaw(Raw::Element e) { result = TUnaryOp(e) } /** * INTERNAL: Do not use. @@ -686,10 +691,10 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TUnsafe`, if possible. + * Converts a raw element to a synthesized `TUnsafeBlock`, if possible. */ cached - TUnsafe convertUnsafeFromRaw(Raw::Element e) { result = TUnsafe(e) } + TUnsafeBlock convertUnsafeBlockFromRaw(Raw::Element e) { result = TUnsafeBlock(e) } /** * INTERNAL: Do not use. @@ -712,15 +717,34 @@ module Synth { cached TYield convertYieldFromRaw(Raw::Element e) { result = TYield(e) } + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TAstNode`, if possible. + */ + cached + TAstNode convertAstNodeFromRaw(Raw::Element e) { + result = convertDeclarationFromRaw(e) + or + result = convertExprFromRaw(e) + or + result = convertMatchArmFromRaw(e) + or + result = convertPatFromRaw(e) + or + result = convertStmtFromRaw(e) + or + result = convertTypeRefFromRaw(e) + } + /** * INTERNAL: Do not use. * Converts a raw DB element to a synthesized `TBlock`, if possible. */ cached TBlock convertBlockFromRaw(Raw::Element e) { - result = convertAsyncFromRaw(e) + result = convertAsyncBlockFromRaw(e) or - result = convertUnsafeFromRaw(e) + result = convertUnsafeBlockFromRaw(e) } /** @@ -811,7 +835,7 @@ module Synth { or result = convertTupleFromRaw(e) or - result = convertUnaryExprFromRaw(e) + result = convertUnaryOpFromRaw(e) or result = convertUnderscoreFromRaw(e) or @@ -836,19 +860,7 @@ module Synth { * Converts a raw DB element to a synthesized `TLocatable`, if possible. */ cached - TLocatable convertLocatableFromRaw(Raw::Element e) { - result = convertDeclarationFromRaw(e) - or - result = convertExprFromRaw(e) - or - result = convertMatchArmFromRaw(e) - or - result = convertPatFromRaw(e) - or - result = convertStmtFromRaw(e) - or - result = convertTypeRefFromRaw(e) - } + TLocatable convertLocatableFromRaw(Raw::Element e) { result = convertAstNodeFromRaw(e) } /** * INTERNAL: Do not use. @@ -918,10 +930,10 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a synthesized `TAsync` to a raw DB element, if possible. + * Converts a synthesized `TAsyncBlock` to a raw DB element, if possible. */ cached - Raw::Element convertAsyncToRaw(TAsync e) { e = TAsync(result) } + Raw::Element convertAsyncBlockToRaw(TAsyncBlock e) { e = TAsyncBlock(result) } /** * INTERNAL: Do not use. @@ -1268,10 +1280,10 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a synthesized `TUnaryExpr` to a raw DB element, if possible. + * Converts a synthesized `TUnaryOp` to a raw DB element, if possible. */ cached - Raw::Element convertUnaryExprToRaw(TUnaryExpr e) { e = TUnaryExpr(result) } + Raw::Element convertUnaryOpToRaw(TUnaryOp e) { e = TUnaryOp(result) } /** * INTERNAL: Do not use. @@ -1296,10 +1308,10 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a synthesized `TUnsafe` to a raw DB element, if possible. + * Converts a synthesized `TUnsafeBlock` to a raw DB element, if possible. */ cached - Raw::Element convertUnsafeToRaw(TUnsafe e) { e = TUnsafe(result) } + Raw::Element convertUnsafeBlockToRaw(TUnsafeBlock e) { e = TUnsafeBlock(result) } /** * INTERNAL: Do not use. @@ -1322,15 +1334,34 @@ module Synth { cached Raw::Element convertYieldToRaw(TYield e) { e = TYield(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TAstNode` to a raw DB element, if possible. + */ + cached + Raw::Element convertAstNodeToRaw(TAstNode e) { + result = convertDeclarationToRaw(e) + or + result = convertExprToRaw(e) + or + result = convertMatchArmToRaw(e) + or + result = convertPatToRaw(e) + or + result = convertStmtToRaw(e) + or + result = convertTypeRefToRaw(e) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TBlock` to a raw DB element, if possible. */ cached Raw::Element convertBlockToRaw(TBlock e) { - result = convertAsyncToRaw(e) + result = convertAsyncBlockToRaw(e) or - result = convertUnsafeToRaw(e) + result = convertUnsafeBlockToRaw(e) } /** @@ -1421,7 +1452,7 @@ module Synth { or result = convertTupleToRaw(e) or - result = convertUnaryExprToRaw(e) + result = convertUnaryOpToRaw(e) or result = convertUnderscoreToRaw(e) or @@ -1446,19 +1477,7 @@ module Synth { * Converts a synthesized `TLocatable` to a raw DB element, if possible. */ cached - Raw::Element convertLocatableToRaw(TLocatable e) { - result = convertDeclarationToRaw(e) - or - result = convertExprToRaw(e) - or - result = convertMatchArmToRaw(e) - or - result = convertPatToRaw(e) - or - result = convertStmtToRaw(e) - or - result = convertTypeRefToRaw(e) - } + Raw::Element convertLocatableToRaw(TLocatable e) { result = convertAstNodeToRaw(e) } /** * INTERNAL: Do not use. diff --git a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll index b8572eff000d..33704b60a68f 100644 --- a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll @@ -4,7 +4,7 @@ */ import codeql.rust.elements.ArrayConstructor -import codeql.rust.elements.AsyncConstructor +import codeql.rust.elements.AsyncBlockConstructor import codeql.rust.elements.AwaitConstructor import codeql.rust.elements.BecomeConstructor import codeql.rust.elements.BinaryOpConstructor @@ -54,9 +54,9 @@ import codeql.rust.elements.TupleConstructor import codeql.rust.elements.TuplePatConstructor import codeql.rust.elements.TupleStructPatConstructor import codeql.rust.elements.TypeRefConstructor -import codeql.rust.elements.UnaryExprConstructor +import codeql.rust.elements.UnaryOpConstructor import codeql.rust.elements.UnderscoreConstructor -import codeql.rust.elements.UnsafeConstructor +import codeql.rust.elements.UnsafeBlockConstructor import codeql.rust.elements.WildPatConstructor import codeql.rust.elements.YeetConstructor import codeql.rust.elements.YieldConstructor diff --git a/rust/ql/lib/codeql/rust/generated/TypeRef.qll b/rust/ql/lib/codeql/rust/generated/TypeRef.qll index 44baf5b50eec..b75359dbbec7 100644 --- a/rust/ql/lib/codeql/rust/generated/TypeRef.qll +++ b/rust/ql/lib/codeql/rust/generated/TypeRef.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Locatable +import codeql.rust.elements.AstNode /** * INTERNAL: This module contains the fully generated definition of `TypeRef` and should not @@ -17,7 +17,7 @@ module Generated { * INTERNAL: Do not reference the `Generated::TypeRef` class directly. * Use the subclass `TypeRef`, where the following predicates are available. */ - class TypeRef extends Synth::TTypeRef, Locatable { + class TypeRef extends Synth::TTypeRef, AstNode { override string getAPrimaryQlClass() { result = "TypeRef" } } } diff --git a/rust/ql/lib/codeql/rust/generated/UnaryExpr.qll b/rust/ql/lib/codeql/rust/generated/UnaryExpr.qll deleted file mode 100644 index 7ab93ff361ec..000000000000 --- a/rust/ql/lib/codeql/rust/generated/UnaryExpr.qll +++ /dev/null @@ -1,36 +0,0 @@ -// generated by codegen -/** - * This module provides the generated definition of `UnaryExpr`. - * INTERNAL: Do not import directly. - */ - -private import codeql.rust.generated.Synth -private import codeql.rust.generated.Raw -import codeql.rust.elements.Expr - -/** - * INTERNAL: This module contains the fully generated definition of `UnaryExpr` and should not - * be referenced directly. - */ -module Generated { - /** - * INTERNAL: Do not reference the `Generated::UnaryExpr` class directly. - * Use the subclass `UnaryExpr`, where the following predicates are available. - */ - class UnaryExpr extends Synth::TUnaryExpr, Expr { - override string getAPrimaryQlClass() { result = "UnaryExpr" } - - /** - * Gets the expression of this unary expression. - */ - Expr getExpr() { - result = - Synth::convertExprFromRaw(Synth::convertUnaryExprToRaw(this).(Raw::UnaryExpr).getExpr()) - } - - /** - * Gets the op of this unary expression. - */ - string getOp() { result = Synth::convertUnaryExprToRaw(this).(Raw::UnaryExpr).getOp() } - } -} diff --git a/rust/ql/lib/codeql/rust/generated/UnaryOp.qll b/rust/ql/lib/codeql/rust/generated/UnaryOp.qll new file mode 100644 index 000000000000..4001514a3469 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/UnaryOp.qll @@ -0,0 +1,35 @@ +// generated by codegen +/** + * This module provides the generated definition of `UnaryOp`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `UnaryOp` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::UnaryOp` class directly. + * Use the subclass `UnaryOp`, where the following predicates are available. + */ + class UnaryOp extends Synth::TUnaryOp, Expr { + override string getAPrimaryQlClass() { result = "UnaryOp" } + + /** + * Gets the expression of this unary op. + */ + Expr getExpr() { + result = Synth::convertExprFromRaw(Synth::convertUnaryOpToRaw(this).(Raw::UnaryOp).getExpr()) + } + + /** + * Gets the op of this unary op. + */ + string getOp() { result = Synth::convertUnaryOpToRaw(this).(Raw::UnaryOp).getOp() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Unsafe.qll b/rust/ql/lib/codeql/rust/generated/Unsafe.qll deleted file mode 100644 index bcc0aeaaa2c3..000000000000 --- a/rust/ql/lib/codeql/rust/generated/Unsafe.qll +++ /dev/null @@ -1,23 +0,0 @@ -// generated by codegen -/** - * This module provides the generated definition of `Unsafe`. - * INTERNAL: Do not import directly. - */ - -private import codeql.rust.generated.Synth -private import codeql.rust.generated.Raw -import codeql.rust.elements.Block - -/** - * INTERNAL: This module contains the fully generated definition of `Unsafe` and should not - * be referenced directly. - */ -module Generated { - /** - * INTERNAL: Do not reference the `Generated::Unsafe` class directly. - * Use the subclass `Unsafe`, where the following predicates are available. - */ - class Unsafe extends Synth::TUnsafe, Block { - override string getAPrimaryQlClass() { result = "Unsafe" } - } -} diff --git a/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll b/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll new file mode 100644 index 000000000000..68be317c4b24 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll @@ -0,0 +1,23 @@ +// generated by codegen +/** + * This module provides the generated definition of `UnsafeBlock`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Block + +/** + * INTERNAL: This module contains the fully generated definition of `UnsafeBlock` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::UnsafeBlock` class directly. + * Use the subclass `UnsafeBlock`, where the following predicates are available. + */ + class UnsafeBlock extends Synth::TUnsafeBlock, Block { + override string getAPrimaryQlClass() { result = "UnsafeBlock" } + } +} diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 2424ac438197..62fd37d82fd9 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -28,12 +28,7 @@ files( ); @locatable = - @declaration -| @expr -| @match_arm -| @pat -| @stmt -| @type_ref + @ast_node ; #keyset[id] @@ -56,6 +51,15 @@ locations( int end_column: int ref ); +@ast_node = + @declaration +| @expr +| @match_arm +| @pat +| @stmt +| @type_ref +; + db_files( unique int id: @db_file ); @@ -99,7 +103,7 @@ db_locations( | @ref | @return | @tuple -| @unary_expr +| @unary_op | @underscore | @yeet | @yield @@ -182,8 +186,8 @@ bind_pat_subpats( ); @block = - @async -| @unsafe + @async_block +| @unsafe_block ; #keyset[id, index] @@ -328,13 +332,13 @@ functions( ifs( unique int id: @if, int condition: @expr ref, - int then_branch: @expr ref + int then: @expr ref ); #keyset[id] -if_else_branches( +if_elses( int id: @if ref, - int else_branch: @expr ref + int else: @expr ref ); if_lets( @@ -600,8 +604,8 @@ tuple_struct_pats( unique int id: @tuple_struct_pat ); -unary_exprs( - unique int id: @unary_expr, +unary_ops( + unique int id: @unary_op, int expr: @expr ref, string op: string ref ); @@ -634,10 +638,10 @@ yield_exprs( int expr: @expr ref ); -asyncs( - unique int id: @async +async_blocks( + unique int id: @async_block ); -unsaves( - unique int id: @unsafe +unsafe_blocks( + unique int id: @unsafe_block ); diff --git a/rust/schema.py b/rust/schema.py index 54d0a7104e1c..9adb16cb1552 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -57,7 +57,12 @@ class Locatable(Element): location: optional[Location] -class Declaration(Locatable): +@qltest.skip +class AstNode(Locatable): + pass + + +class Declaration(AstNode): pass @@ -67,22 +72,22 @@ class Module(Declaration): @qltest.collapse_hierarchy -class Expr(Locatable): +class Expr(AstNode): pass @qltest.collapse_hierarchy -class Pat(Locatable): +class Pat(AstNode): pass @qltest.collapse_hierarchy -class Stmt(Locatable): +class Stmt(AstNode): pass @qltest.collapse_hierarchy -class TypeRef(Locatable): +class TypeRef(AstNode): # TODO pass @@ -112,8 +117,8 @@ class Path(Expr): class If(Expr): condition: Expr - then_branch: Expr - else_branch: optional[Expr] + then: Expr + else_: optional[Expr] # Let { # pat: PatId, @@ -145,7 +150,7 @@ class Block(Expr): # }, -class Async(Block): +class AsyncBlock(Block): pass # Const(ConstBlockId), @@ -162,7 +167,7 @@ class Const(Expr): # }, -class Unsafe(Block): +class UnsafeBlock(Block): pass # Loop { @@ -210,7 +215,7 @@ class MethodCall(Expr): @qltest.skip -class MatchArm(Locatable): +class MatchArm(AstNode): pat: Pat guard: optional[Expr] expr: Expr @@ -335,7 +340,7 @@ class Box(Expr): # }, -class UnaryExpr(Expr): +class UnaryOp(Expr): expr: Expr op: string From e14b62691710a05e583749aa86231e99c643e0d0 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 12:15:35 +0200 Subject: [PATCH 05/13] Add 'BlockBase' class --- rust/.generated.list | 19 ++++--- rust/.gitattributes | 3 + rust/extractor/src/generated/top.rs | 41 +++++++++++--- rust/ql/lib/codeql/rust/elements.qll | 1 + .../ql/lib/codeql/rust/elements/BlockBase.qll | 8 +++ .../codeql/rust/elements/BlockConstructor.qll | 14 +++++ .../lib/codeql/rust/generated/AsyncBlock.qll | 4 +- rust/ql/lib/codeql/rust/generated/Block.qll | 35 +----------- .../lib/codeql/rust/generated/BlockBase.qll | 55 +++++++++++++++++++ .../lib/codeql/rust/generated/ParentChild.qll | 33 ++++++++--- rust/ql/lib/codeql/rust/generated/Raw.qll | 31 +++++++---- rust/ql/lib/codeql/rust/generated/Synth.qll | 38 ++++++++++--- .../rust/generated/SynthConstructors.qll | 1 + .../lib/codeql/rust/generated/UnsafeBlock.qll | 4 +- rust/ql/lib/rust.dbscheme | 29 ++++++---- rust/schema.py | 9 ++- 16 files changed, 228 insertions(+), 97 deletions(-) create mode 100644 rust/ql/lib/codeql/rust/elements/BlockBase.qll create mode 100644 rust/ql/lib/codeql/rust/elements/BlockConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/generated/BlockBase.qll diff --git a/rust/.generated.list b/rust/.generated.list index 4fb901eb718b..e9d0bfee997c 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -12,6 +12,8 @@ ql/lib/codeql/rust/elements/BinaryOpConstructor.qll 4e9b81d972c3ce4cd38baa0bbb5a ql/lib/codeql/rust/elements/BindPat.qll f0209f781d8a14ab7fbb4b4d6a654469aecb0ff1a8ff4810f18a90f3b171e1c3 9734b7907855e46eeded6c3f59912a16212f7e8639fba35c740bb04462240287 ql/lib/codeql/rust/elements/BindPatConstructor.qll 2bbcc296bcdcd945313d83294b90d327c51c9f1e96f92d37dd10bf0c32dfaf6a 612b4fc651f32129155727e866796edee8fff939614c6fd0b7baa1392930a38c ql/lib/codeql/rust/elements/Block.qll 03adb9118a899bfdd3790d82426eb6ee3df83d03d6e0eceb5d05bc9b8f08c576 c65f594a7d576889ddb13b3ec16175e1ceb09e9f289a23e91708be6d728573bb +ql/lib/codeql/rust/elements/BlockBase.qll 3ce5ef025d1fb293a6708e74a78761590a6ed3fdeabb70795f18170598d45566 6aeac52ec999f2b2e8f96c425a44c4eb3a3efb77bbcf76e9c496137c5773769b +ql/lib/codeql/rust/elements/BlockConstructor.qll 07cd9123ae847a04b84fd410eee835fbf1088e88d1f1bfcf3e2a66ee5ac3ca8c 15d9e5be5a43c70aea9a280e114889f277fc3c2d83638d9e5cb7dbfb559c56c4 ql/lib/codeql/rust/elements/Box.qll 8fa74f14d72cb8613e9ddc4effc19054cb745c91582aa7a440d68f02b9c13b9c 1e196173be41e5059fc538c1cda01ccfea644425030584e2689c68abf7850935 ql/lib/codeql/rust/elements/BoxConstructor.qll 9a76f8b87367812ac7be252d04802f09a97659869098391bcdd46e6da72840cc 8225e3743257dd1a927a7c6eabdfd082011e1124ffeb10e4020b52c41556fa12 ql/lib/codeql/rust/elements/BoxPat.qll 1df08d5443c63e21d40d25023da58da50bd6cf6e156b9f5dbd6d41a3193faee9 9837752be4d4a1c3f16d6438bd361c596b6b983d9ae4e486083651e8f4e090ff @@ -117,15 +119,16 @@ ql/lib/codeql/rust/elements/Yeet.qll 07f967352be486b7e2b787c292c16195a7084699cbd ql/lib/codeql/rust/elements/YeetConstructor.qll 835afa5ff4b4102335525c41d67380e59f272f95b4b7b0196e0475eae4b9f738 6c51946d661aea16d91010e0639b4ea8f3d161bd56a029e955dc7f7bca025c00 ql/lib/codeql/rust/elements/Yield.qll 9a484b5b5c2c32ef61395213c376ce4b1ef7f699f08330d08faf071ea8919af1 e45fe09b794a2a05a1c125d112dfb36d9c7d538ff1953440d6c580cd8c987f8a ql/lib/codeql/rust/elements/YieldConstructor.qll 16f393593cf9cf126f048c6f36eba7ca45e78c44577c7bda51c9a66bac95487e f49c9c3d4d17f64f44111bea2bb197cf8b11a0aa88b53b9a527c6aab4733c4b5 -ql/lib/codeql/rust/elements.qll 2f6912dc51cebbfb6e69064c05ce139bdaa9fcc3cabc0fceab390217b327c0c6 2f6912dc51cebbfb6e69064c05ce139bdaa9fcc3cabc0fceab390217b327c0c6 +ql/lib/codeql/rust/elements.qll e1531dc71a60381eb4b708b966a8f9645ef39cb1aebd2cf7a5dfd2e17fff6c5a e1531dc71a60381eb4b708b966a8f9645ef39cb1aebd2cf7a5dfd2e17fff6c5a ql/lib/codeql/rust/generated/Array.qll 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 ql/lib/codeql/rust/generated/AstNode.qll 0598fac7859906f4103124270dfb2fbdb838387b1c45000bf50a4b62c797ec41 f47c84878c7c9676109e358073bddab92a1dbeb4d977d236ecc1eae44d81c894 -ql/lib/codeql/rust/generated/AsyncBlock.qll 4fbb02d4afe512201d78849f52845f7533d7c0482cea84bbf0ef9952fafdfcfa 4fbb02d4afe512201d78849f52845f7533d7c0482cea84bbf0ef9952fafdfcfa +ql/lib/codeql/rust/generated/AsyncBlock.qll 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c ql/lib/codeql/rust/generated/Await.qll f5d65ee72d03205b95b9f507a4da5706f5c66d0da8b4a8a5d67bfae5643a4766 382ad8a5e1098ec697370cdf5453404128abd9d56a1e578e0255aa29d33fcf74 ql/lib/codeql/rust/generated/Become.qll 7cfe61271eb91293014ebf16cd1029454705f4b569bba8afeec7d683f378efaf 9a31140d67ae8e77762aa2bd09ab018c88fe464a1b2205035e957d889abfe42a ql/lib/codeql/rust/generated/BinaryOp.qll ec80f6cb6a0a03496814a629ecc8736f77c46e22a6c26b4e11fe1e650eb91441 67cd9c875556034a7afe78857c2d50d9ae1af084bee87e0d0c691c8baaaae72f ql/lib/codeql/rust/generated/BindPat.qll 15d3a33c5f56f7659a331f72735f00930fddd6066659e54c5c19d5e7eb8ef078 bc0a916622b2c426b71760caf15b8e005eed276e06e04d04cc5f19f4c31c34f6 -ql/lib/codeql/rust/generated/Block.qll 5f769e5bf7484552e1cee031d7ba1ac8811e8d1e1a712d44fc28a3c2ec88a672 5d3da26a524cb8c79f190cc9c960c989752ea651055d7fc882de58ee9a05bf19 +ql/lib/codeql/rust/generated/Block.qll 7a50beadbbe3e7f778797b4a69ba20c56c389803335cec54a701761e74d94cf8 93c5148dc0540fca7233a231ecd5d4e744a1e73398306a652db521ce560bba47 +ql/lib/codeql/rust/generated/BlockBase.qll f1984b819cb8d2257c7e6323041c32bc106153c1a3fba75f052a545b84e9f09f 7e2767cee8967b5b8a53c1ad1de578a11f46629422ff1b2cebe051fe53293a91 ql/lib/codeql/rust/generated/Box.qll c64ff6a3e495d5729e091d275f04573ca820df2df1f42773dd04b0da0bf1d3d1 6d0778ae8347530f9ed5be9b24206f02d9437dd5265fdb308dfefce70f5d8829 ql/lib/codeql/rust/generated/BoxPat.qll b69ba2bc341a1bf4c613279e45fb97a530619d4148d5ccc4f05436a316db29eb bf52730243bd1836d5890c745232aba50544c2046d00e80e7d22eebcd104f821 ql/lib/codeql/rust/generated/Break.qll a1131a39a8b57398937b7e35108c83a92aabb284289acf5e8da1bbb9e603ae8d 4a2059cc94e028f080e984e485f1760c92ad2def6993ba68e023a2c9720ba00a @@ -163,14 +166,14 @@ ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a2568 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 0f030634cebcef8f5057032eac1507db56be4a63b3e6d5dc1bc2ca7a5efb47ae cfd2a4a19279118616d435cbfe4141d8cd2bc4bba62ac389f35c752d7c46924e +ql/lib/codeql/rust/generated/ParentChild.qll 9365b29f55a6ca6353a0fc61ec9ac01a53ca5c12c997b804ec143ca6de5600ac 5d39a2063541af98d60fc6b989c2f3aacaa803422b718414f095d3af02a88e79 ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 9e527657ad4eaa36585a786e83a03adb93493b496bd241bef1cc6acefab37009 8974d8dcd0914c109e6792f448bb1d504ff0cee73ee883134dc5f64b2a643c8f +ql/lib/codeql/rust/generated/Raw.qll 8285e7937d3a375b5a882ecccbe2ac8db3cbff59bdb2ed4f7a32059362826255 beaceb79727f4a1244238599c39cdd696e6be13a8c1c9c49c3bac8845b881558 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd @@ -178,8 +181,8 @@ ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511 ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533 ql/lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd -ql/lib/codeql/rust/generated/Synth.qll b0227cc6042034c1f5ad6829b4b8d2574ef16cf1a5b4dd81bb172a0756fae4a2 209b97b56028449709f9e1477ed9f060c6ac3a51f0a72c84d2dc58c6c9cc0c82 -ql/lib/codeql/rust/generated/SynthConstructors.qll c3393b74c66e2d9606e82581f393491152f97ebbc91d49f1688a62d071d6e28d c3393b74c66e2d9606e82581f393491152f97ebbc91d49f1688a62d071d6e28d +ql/lib/codeql/rust/generated/Synth.qll 9c71ab766b07e4d1c2b89e6ae0631a4f4e2b5dfda12f1e55dd5544327217a463 e56058f18c9b9e9d540bd5f12f9600f4e3522e18f67919119e60975f35a46e79 +ql/lib/codeql/rust/generated/SynthConstructors.qll bd3b69d1a153260761399fdc10b589c87f1295e894946b8e33d672c14b08df5f bd3b69d1a153260761399fdc10b589c87f1295e894946b8e33d672c14b08df5f ql/lib/codeql/rust/generated/Tuple.qll 3fde94f0c23c6af6bcb58d0245a3cd0a8bbd6ef7999fbeed805baf2615e6226d c1aa7fc201aebb34dc6cd7760e817032b86fd16b8facac450c74deda860bc821 ql/lib/codeql/rust/generated/TuplePat.qll fdb2c66fe6291106fe125de6a91c4d74b2c715d276c2fee9751d0523b618d095 330098460ccac28479a2b522048d6f1191bf01b40b3eceef4adf722c01c8360b ql/lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 @@ -188,7 +191,7 @@ ql/lib/codeql/rust/generated/UnaryOp.qll fa587434c234c68606e3d0e32f6f07f89fa468d ql/lib/codeql/rust/generated/Underscore.qll d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d d9980518479f771e164e4fc8d4c180f2a16691afbea65aa163939bae89e9005d ql/lib/codeql/rust/generated/UnknownFile.qll ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ec9d1a3f15ecbf1743d4e39cb3b2f217aa9b54951c93302c2c4c238c3f0ce595 ql/lib/codeql/rust/generated/UnknownLocation.qll a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf a19e2838c52d702d268ae530f3dbd6fcd8bb28a237a52636a960f225454103cf -ql/lib/codeql/rust/generated/UnsafeBlock.qll c15dcb7b1ea1b4b269bd7eba4cc798852d714319d16495ba660f4f34cfd70306 c15dcb7b1ea1b4b269bd7eba4cc798852d714319d16495ba660f4f34cfd70306 +ql/lib/codeql/rust/generated/UnsafeBlock.qll 2a968ab223354bd81527fe53c59d02364f4389536fb75da3347771e1cf798560 2a968ab223354bd81527fe53c59d02364f4389536fb75da3347771e1cf798560 ql/lib/codeql/rust/generated/WildPat.qll 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 ql/lib/codeql/rust/generated/Yeet.qll 41b05d32a1b93cee770d6706cc044efe8ce57f11ae2f009c59666264cd1aaec1 8a6c8a1ae59e5a7e1b64abea85f6362c0460cbd5fcace1520b213ef5e08331ef ql/lib/codeql/rust/generated/Yield.qll afefea932d770b61b633feeaa05973943c2bb45ea3cd4f960a0be1bbce33a405 c975fba823b05ad40b3c1bd908880e65511b59f9e6882fa207009194a45134a0 diff --git a/rust/.gitattributes b/rust/.gitattributes index e7814c65445b..f12c235b32ae 100644 --- a/rust/.gitattributes +++ b/rust/.gitattributes @@ -14,6 +14,8 @@ /ql/lib/codeql/rust/elements/BindPat.qll linguist-generated /ql/lib/codeql/rust/elements/BindPatConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Block.qll linguist-generated +/ql/lib/codeql/rust/elements/BlockBase.qll linguist-generated +/ql/lib/codeql/rust/elements/BlockConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Box.qll linguist-generated /ql/lib/codeql/rust/elements/BoxConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/BoxPat.qll linguist-generated @@ -128,6 +130,7 @@ /ql/lib/codeql/rust/generated/BinaryOp.qll linguist-generated /ql/lib/codeql/rust/generated/BindPat.qll linguist-generated /ql/lib/codeql/rust/generated/Block.qll linguist-generated +/ql/lib/codeql/rust/generated/BlockBase.qll linguist-generated /ql/lib/codeql/rust/generated/Box.qll linguist-generated /ql/lib/codeql/rust/generated/BoxPat.qll linguist-generated /ql/lib/codeql/rust/generated/Break.qll linguist-generated diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 06f4ec674911..2c0840e56527 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -1245,7 +1245,6 @@ pub struct AsyncBlock { pub location: Option, pub statements: Vec, pub tail: Option, - pub label: Option, } impl TrapEntry for AsyncBlock { @@ -1259,10 +1258,38 @@ impl TrapEntry for AsyncBlock { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } for (i, &v) in self.statements.iter().enumerate() { - out.add_tuple("block_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); + out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if let Some(v) = self.tail { + out.add_tuple("block_base_tails", vec![trap::Arg::Label(id), v.into()]); + } + } +} + +#[derive(Debug)] +pub struct Block { + pub id: TrapId, + pub location: Option, + pub statements: Vec, + pub tail: Option, + pub label: Option, +} + +impl TrapEntry for Block { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("blocks", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.statements.iter().enumerate() { + out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.tail { - out.add_tuple("block_tails", vec![trap::Arg::Label(id), v.into()]); + out.add_tuple("block_base_tails", vec![trap::Arg::Label(id), v.into()]); } if let Some(v) = self.label { out.add_tuple("block_labels", vec![trap::Arg::Label(id), v.into()]); @@ -1276,7 +1303,6 @@ pub struct UnsafeBlock { pub location: Option, pub statements: Vec, pub tail: Option, - pub label: Option, } impl TrapEntry for UnsafeBlock { @@ -1290,13 +1316,10 @@ impl TrapEntry for UnsafeBlock { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } for (i, &v) in self.statements.iter().enumerate() { - out.add_tuple("block_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); + out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.tail { - out.add_tuple("block_tails", vec![trap::Arg::Label(id), v.into()]); - } - if let Some(v) = self.label { - out.add_tuple("block_labels", vec![trap::Arg::Label(id), v.into()]); + out.add_tuple("block_base_tails", vec![trap::Arg::Label(id), v.into()]); } } } diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index 45292a045588..9586676476fb 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -11,6 +11,7 @@ import codeql.rust.elements.Become import codeql.rust.elements.BinaryOp import codeql.rust.elements.BindPat import codeql.rust.elements.Block +import codeql.rust.elements.BlockBase import codeql.rust.elements.Box import codeql.rust.elements.BoxPat import codeql.rust.elements.Break diff --git a/rust/ql/lib/codeql/rust/elements/BlockBase.qll b/rust/ql/lib/codeql/rust/elements/BlockBase.qll new file mode 100644 index 000000000000..22c50c5f499b --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BlockBase.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `BlockBase`. + */ + +private import codeql.rust.generated.BlockBase + +class BlockBase extends Generated::BlockBase { } diff --git a/rust/ql/lib/codeql/rust/elements/BlockConstructor.qll b/rust/ql/lib/codeql/rust/elements/BlockConstructor.qll new file mode 100644 index 000000000000..7938491041cc --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/BlockConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Block` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Block` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructBlock(Raw::Block id) { any() } diff --git a/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll b/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll index b24fa152387d..b380b36e1472 100644 --- a/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll +++ b/rust/ql/lib/codeql/rust/generated/AsyncBlock.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Block +import codeql.rust.elements.BlockBase /** * INTERNAL: This module contains the fully generated definition of `AsyncBlock` and should not @@ -17,7 +17,7 @@ module Generated { * INTERNAL: Do not reference the `Generated::AsyncBlock` class directly. * Use the subclass `AsyncBlock`, where the following predicates are available. */ - class AsyncBlock extends Synth::TAsyncBlock, Block { + class AsyncBlock extends Synth::TAsyncBlock, BlockBase { override string getAPrimaryQlClass() { result = "AsyncBlock" } } } diff --git a/rust/ql/lib/codeql/rust/generated/Block.qll b/rust/ql/lib/codeql/rust/generated/Block.qll index 9ceded8eb363..eec7f3cf8588 100644 --- a/rust/ql/lib/codeql/rust/generated/Block.qll +++ b/rust/ql/lib/codeql/rust/generated/Block.qll @@ -6,8 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Expr -import codeql.rust.elements.Stmt +import codeql.rust.elements.BlockBase /** * INTERNAL: This module contains the fully generated definition of `Block` and should not @@ -18,36 +17,8 @@ module Generated { * INTERNAL: Do not reference the `Generated::Block` class directly. * Use the subclass `Block`, where the following predicates are available. */ - class Block extends Synth::TBlock, Expr { - /** - * Gets the `index`th statement of this block (0-based). - */ - Stmt getStatement(int index) { - result = - Synth::convertStmtFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getStatement(index)) - } - - /** - * Gets any of the statements of this block. - */ - final Stmt getAStatement() { result = this.getStatement(_) } - - /** - * Gets the number of statements of this block. - */ - final int getNumberOfStatements() { result = count(int i | exists(this.getStatement(i))) } - - /** - * Gets the tail of this block, if it exists. - */ - Expr getTail() { - result = Synth::convertExprFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getTail()) - } - - /** - * Holds if `getTail()` exists. - */ - final predicate hasTail() { exists(this.getTail()) } + class Block extends Synth::TBlock, BlockBase { + override string getAPrimaryQlClass() { result = "Block" } /** * Gets the label of this block, if it exists. diff --git a/rust/ql/lib/codeql/rust/generated/BlockBase.qll b/rust/ql/lib/codeql/rust/generated/BlockBase.qll new file mode 100644 index 000000000000..fd0c292ac416 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/BlockBase.qll @@ -0,0 +1,55 @@ +// generated by codegen +/** + * This module provides the generated definition of `BlockBase`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Expr +import codeql.rust.elements.Stmt + +/** + * INTERNAL: This module contains the fully generated definition of `BlockBase` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::BlockBase` class directly. + * Use the subclass `BlockBase`, where the following predicates are available. + */ + class BlockBase extends Synth::TBlockBase, Expr { + /** + * Gets the `index`th statement of this block base (0-based). + */ + Stmt getStatement(int index) { + result = + Synth::convertStmtFromRaw(Synth::convertBlockBaseToRaw(this) + .(Raw::BlockBase) + .getStatement(index)) + } + + /** + * Gets any of the statements of this block base. + */ + final Stmt getAStatement() { result = this.getStatement(_) } + + /** + * Gets the number of statements of this block base. + */ + final int getNumberOfStatements() { result = count(int i | exists(this.getStatement(i))) } + + /** + * Gets the tail of this block base, if it exists. + */ + Expr getTail() { + result = + Synth::convertExprFromRaw(Synth::convertBlockBaseToRaw(this).(Raw::BlockBase).getTail()) + } + + /** + * Holds if `getTail()` exists. + */ + final predicate hasTail() { exists(this.getTail()) } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/generated/ParentChild.qll index 7aafef78ab45..d08d1d0171a9 100644 --- a/rust/ql/lib/codeql/rust/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/generated/ParentChild.qll @@ -263,7 +263,7 @@ private module Impl { ) } - private Element getImmediateChildOfBlock(Block e, int index, string partialPredicateCall) { + private Element getImmediateChildOfBlockBase(BlockBase e, int index, string partialPredicateCall) { exists(int b, int bExpr, int n | b = 0 and bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and @@ -887,14 +887,27 @@ private module Impl { } private Element getImmediateChildOfAsyncBlock(AsyncBlock e, int index, string partialPredicateCall) { - exists(int b, int bBlock, int n | + exists(int b, int bBlockBase, int n | b = 0 and - bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and - n = bBlock and + bBlockBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlockBase(e, i, _)) | i) and + n = bBlockBase and ( none() or - result = getImmediateChildOfBlock(e, index - b, partialPredicateCall) + result = getImmediateChildOfBlockBase(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfBlock(Block e, int index, string partialPredicateCall) { + exists(int b, int bBlockBase, int n | + b = 0 and + bBlockBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlockBase(e, i, _)) | i) and + n = bBlockBase and + ( + none() + or + result = getImmediateChildOfBlockBase(e, index - b, partialPredicateCall) ) ) } @@ -902,14 +915,14 @@ private module Impl { private Element getImmediateChildOfUnsafeBlock( UnsafeBlock e, int index, string partialPredicateCall ) { - exists(int b, int bBlock, int n | + exists(int b, int bBlockBase, int n | b = 0 and - bBlock = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlock(e, i, _)) | i) and - n = bBlock and + bBlockBase = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfBlockBase(e, i, _)) | i) and + n = bBlockBase and ( none() or - result = getImmediateChildOfBlock(e, index - b, partialPredicateCall) + result = getImmediateChildOfBlockBase(e, index - b, partialPredicateCall) ) ) } @@ -1036,6 +1049,8 @@ private module Impl { or result = getImmediateChildOfAsyncBlock(e, index, partialAccessor) or + result = getImmediateChildOfBlock(e, index, partialAccessor) + or result = getImmediateChildOfUnsafeBlock(e, index, partialAccessor) } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 2e44be7d26e7..728379529bce 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -201,21 +201,16 @@ module Raw { /** * INTERNAL: Do not use. */ - class Block extends @block, Expr { + class BlockBase extends @block_base, Expr { /** - * Gets the `index`th statement of this block (0-based). + * Gets the `index`th statement of this block base (0-based). */ - Stmt getStatement(int index) { block_statements(this, index, result) } + Stmt getStatement(int index) { block_base_statements(this, index, result) } /** - * Gets the tail of this block, if it exists. + * Gets the tail of this block base, if it exists. */ - Expr getTail() { block_tails(this, result) } - - /** - * Gets the label of this block, if it exists. - */ - string getLabel() { block_labels(this, result) } + Expr getTail() { block_base_tails(this, result) } } /** @@ -863,14 +858,26 @@ module Raw { /** * INTERNAL: Do not use. */ - class AsyncBlock extends @async_block, Block { + class AsyncBlock extends @async_block, BlockBase { override string toString() { result = "AsyncBlock" } } /** * INTERNAL: Do not use. */ - class UnsafeBlock extends @unsafe_block, Block { + class Block extends @block, BlockBase { + override string toString() { result = "Block" } + + /** + * Gets the label of this block, if it exists. + */ + string getLabel() { block_labels(this, result) } + } + + /** + * INTERNAL: Do not use. + */ + class UnsafeBlock extends @unsafe_block, BlockBase { override string toString() { result = "UnsafeBlock" } } } diff --git a/rust/ql/lib/codeql/rust/generated/Synth.qll b/rust/ql/lib/codeql/rust/generated/Synth.qll index 539ccd58e250..16a0dc283b29 100644 --- a/rust/ql/lib/codeql/rust/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/generated/Synth.qll @@ -39,6 +39,10 @@ module Synth { * INTERNAL: Do not use. */ TBindPat(Raw::BindPat id) { constructBindPat(id) } or + /** + * INTERNAL: Do not use. + */ + TBlock(Raw::Block id) { constructBlock(id) } or /** * INTERNAL: Do not use. */ @@ -260,7 +264,7 @@ module Synth { /** * INTERNAL: Do not use. */ - class TBlock = TAsyncBlock or TUnsafeBlock; + class TBlockBase = TAsyncBlock or TBlock or TUnsafeBlock; /** * INTERNAL: Do not use. @@ -271,7 +275,7 @@ module Synth { * INTERNAL: Do not use. */ class TExpr = - TArray or TAwait or TBecome or TBinaryOp or TBlock or TBox or TBreak or TCall or TCast or + TArray or TAwait or TBecome or TBinaryOp or TBlockBase or TBox or TBreak or TCall or TCast or TClosure or TConst or TContinue or TField or TIf or TIndex or TInlineAsm or TLet or TLiteral or TLoop or TMatch or TMethodCall or TMissingExpr or TOffsetOf or TPath or TRange or TRecordLit or TRef or TReturn or TTuple or TUnaryOp or TUnderscore or TYeet or @@ -346,6 +350,13 @@ module Synth { cached TBindPat convertBindPatFromRaw(Raw::Element e) { result = TBindPat(e) } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TBlock`, if possible. + */ + cached + TBlock convertBlockFromRaw(Raw::Element e) { result = TBlock(e) } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TBox`, if possible. @@ -738,12 +749,14 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a raw DB element to a synthesized `TBlock`, if possible. + * Converts a raw DB element to a synthesized `TBlockBase`, if possible. */ cached - TBlock convertBlockFromRaw(Raw::Element e) { + TBlockBase convertBlockBaseFromRaw(Raw::Element e) { result = convertAsyncBlockFromRaw(e) or + result = convertBlockFromRaw(e) + or result = convertUnsafeBlockFromRaw(e) } @@ -785,7 +798,7 @@ module Synth { or result = convertBinaryOpFromRaw(e) or - result = convertBlockFromRaw(e) + result = convertBlockBaseFromRaw(e) or result = convertBoxFromRaw(e) or @@ -963,6 +976,13 @@ module Synth { cached Raw::Element convertBindPatToRaw(TBindPat e) { e = TBindPat(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TBlock` to a raw DB element, if possible. + */ + cached + Raw::Element convertBlockToRaw(TBlock e) { e = TBlock(result) } + /** * INTERNAL: Do not use. * Converts a synthesized `TBox` to a raw DB element, if possible. @@ -1355,12 +1375,14 @@ module Synth { /** * INTERNAL: Do not use. - * Converts a synthesized `TBlock` to a raw DB element, if possible. + * Converts a synthesized `TBlockBase` to a raw DB element, if possible. */ cached - Raw::Element convertBlockToRaw(TBlock e) { + Raw::Element convertBlockBaseToRaw(TBlockBase e) { result = convertAsyncBlockToRaw(e) or + result = convertBlockToRaw(e) + or result = convertUnsafeBlockToRaw(e) } @@ -1402,7 +1424,7 @@ module Synth { or result = convertBinaryOpToRaw(e) or - result = convertBlockToRaw(e) + result = convertBlockBaseToRaw(e) or result = convertBoxToRaw(e) or diff --git a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll index 33704b60a68f..74681f51e745 100644 --- a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll @@ -9,6 +9,7 @@ import codeql.rust.elements.AwaitConstructor import codeql.rust.elements.BecomeConstructor import codeql.rust.elements.BinaryOpConstructor import codeql.rust.elements.BindPatConstructor +import codeql.rust.elements.BlockConstructor import codeql.rust.elements.BoxConstructor import codeql.rust.elements.BoxPatConstructor import codeql.rust.elements.BreakConstructor diff --git a/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll b/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll index 68be317c4b24..a26f5d4ac744 100644 --- a/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll +++ b/rust/ql/lib/codeql/rust/generated/UnsafeBlock.qll @@ -6,7 +6,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw -import codeql.rust.elements.Block +import codeql.rust.elements.BlockBase /** * INTERNAL: This module contains the fully generated definition of `UnsafeBlock` and should not @@ -17,7 +17,7 @@ module Generated { * INTERNAL: Do not reference the `Generated::UnsafeBlock` class directly. * Use the subclass `UnsafeBlock`, where the following predicates are available. */ - class UnsafeBlock extends Synth::TUnsafeBlock, Block { + class UnsafeBlock extends Synth::TUnsafeBlock, BlockBase { override string getAPrimaryQlClass() { result = "UnsafeBlock" } } } diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 62fd37d82fd9..b4723b01dab5 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -78,7 +78,7 @@ db_locations( | @await | @become | @binary_op -| @block +| @block_base | @box | @break | @call @@ -185,30 +185,25 @@ bind_pat_subpats( int subpat: @pat ref ); -@block = +@block_base = @async_block +| @block | @unsafe_block ; #keyset[id, index] -block_statements( - int id: @block ref, +block_base_statements( + int id: @block_base ref, int index: int ref, int statement: @stmt ref ); #keyset[id] -block_tails( - int id: @block ref, +block_base_tails( + int id: @block_base ref, int tail: @expr ref ); -#keyset[id] -block_labels( - int id: @block ref, - string label: string ref -); - boxes( unique int id: @box, int expr: @expr ref @@ -642,6 +637,16 @@ async_blocks( unique int id: @async_block ); +blocks( + unique int id: @block +); + +#keyset[id] +block_labels( + int id: @block ref, + string label: string ref +); + unsafe_blocks( unique int id: @unsafe_block ); diff --git a/rust/schema.py b/rust/schema.py index 9adb16cb1552..2a385926e996 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -138,9 +138,12 @@ class Let(Expr): # }, -class Block(Expr): +class BlockBase(Expr): statements: list[Stmt] tail: optional[Expr] + + +class Block(BlockBase): label: optional[string] # Async { @@ -150,7 +153,7 @@ class Block(Expr): # }, -class AsyncBlock(Block): +class AsyncBlock(BlockBase): pass # Const(ConstBlockId), @@ -167,7 +170,7 @@ class Const(Expr): # }, -class UnsafeBlock(Block): +class UnsafeBlock(BlockBase): pass # Loop { From a33c7703cd54a567f19f00d20238e120e311ddb4 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 12:42:43 +0200 Subject: [PATCH 06/13] Add Label class --- rust/.generated.list | 21 ++++++++------ rust/.gitattributes | 3 ++ rust/extractor/src/generated/top.rs | 28 ++++++++++++++++--- rust/ql/lib/codeql/rust/elements.qll | 1 + rust/ql/lib/codeql/rust/elements/Label.qll | 8 ++++++ .../codeql/rust/elements/LabelConstructor.qll | 14 ++++++++++ rust/ql/lib/codeql/rust/generated/Block.qll | 5 +++- rust/ql/lib/codeql/rust/generated/Break.qll | 5 +++- .../ql/lib/codeql/rust/generated/Continue.qll | 6 +++- rust/ql/lib/codeql/rust/generated/Label.qll | 28 +++++++++++++++++++ rust/ql/lib/codeql/rust/generated/Loop.qll | 5 +++- .../lib/codeql/rust/generated/ParentChild.qll | 15 ++++++++++ rust/ql/lib/codeql/rust/generated/Raw.qll | 20 ++++++++++--- rust/ql/lib/codeql/rust/generated/Synth.qll | 24 +++++++++++++++- .../rust/generated/SynthConstructors.qll | 1 + rust/ql/lib/rust.dbscheme | 14 +++++++--- rust/schema.py | 13 ++++++--- 17 files changed, 181 insertions(+), 30 deletions(-) create mode 100644 rust/ql/lib/codeql/rust/elements/Label.qll create mode 100644 rust/ql/lib/codeql/rust/elements/LabelConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Label.qll diff --git a/rust/.generated.list b/rust/.generated.list index e9d0bfee997c..4c22daff2671 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -53,6 +53,8 @@ ql/lib/codeql/rust/elements/InlineAsm.qll 3ff6a13840a083ac39672aa694213b3740bc2c ql/lib/codeql/rust/elements/InlineAsmConstructor.qll 3923d1b0d772e0686ce891e63c39b984fabbc9c2656f9177df1696e85eff12bf 3ce886c37495ee40eb9d12c2b4ee0222b34f3d9df5a23a47ea2e629c54c30a58 ql/lib/codeql/rust/elements/ItemStmt.qll 70fc3f9df9794dc78199dfd81b8136701d4ca0c9b3c6e88ecec42f75fbc41f32 df122241e3868b1c376e2d2501328ad47020a0837826f165c7e54640bc018156 ql/lib/codeql/rust/elements/ItemStmtConstructor.qll cd27051f73ab2897b1f7a725313f97d36507fc9f5e0dd7b2ad8bd1caaf8c42ad 67596c97386fbe6cb9e5e6abc45b674158f411d927297345cb25359587380bcd +ql/lib/codeql/rust/elements/Label.qll f48209b24876d581e95120bc548c44033b6552a7875eea73ce44aa57b675eeb3 d17163f3adc9f94a462269f565153aa2822533d03487e521d9c5d5e72afaa1ac +ql/lib/codeql/rust/elements/LabelConstructor.qll 0625a149cb34b9f603b76efd76e679bb63808d47f9fa529959784347d8e7d447 2115bc7de878af444777f96247bc0a775161f3766e38c3c4d363c2f59b2144da ql/lib/codeql/rust/elements/Let.qll 2148dd54c4f109f1668b724d547ee4e4fe86820fa554a57f2806da102ec8d5cf 7a44c96aadba848b36d26325499d2011e3a1f2f3ee26f78b9202fc39130a6a57 ql/lib/codeql/rust/elements/LetConstructor.qll c696cefd2d2c8e2a56e5df6e63cd5302833bf5bc1d16ff87666cd8a8b01eb7f0 8065946e2b996abbd58fef9f03ae30c98369367153acd8681a87422d07b36a68 ql/lib/codeql/rust/elements/LitPat.qll 539b414883b0b86ff446fa81254f2c71f467e5ea0bda21dc3bd66cf3abf95b13 d54eeb618cfb8f0c4a48ce5ab1922fca2622f4a0c703760aa344028172f37642 @@ -119,7 +121,7 @@ ql/lib/codeql/rust/elements/Yeet.qll 07f967352be486b7e2b787c292c16195a7084699cbd ql/lib/codeql/rust/elements/YeetConstructor.qll 835afa5ff4b4102335525c41d67380e59f272f95b4b7b0196e0475eae4b9f738 6c51946d661aea16d91010e0639b4ea8f3d161bd56a029e955dc7f7bca025c00 ql/lib/codeql/rust/elements/Yield.qll 9a484b5b5c2c32ef61395213c376ce4b1ef7f699f08330d08faf071ea8919af1 e45fe09b794a2a05a1c125d112dfb36d9c7d538ff1953440d6c580cd8c987f8a ql/lib/codeql/rust/elements/YieldConstructor.qll 16f393593cf9cf126f048c6f36eba7ca45e78c44577c7bda51c9a66bac95487e f49c9c3d4d17f64f44111bea2bb197cf8b11a0aa88b53b9a527c6aab4733c4b5 -ql/lib/codeql/rust/elements.qll e1531dc71a60381eb4b708b966a8f9645ef39cb1aebd2cf7a5dfd2e17fff6c5a e1531dc71a60381eb4b708b966a8f9645ef39cb1aebd2cf7a5dfd2e17fff6c5a +ql/lib/codeql/rust/elements.qll 4631074c9b001a91ed3c3bd300d56aa57f518112925a58fbf6333705f500b642 4631074c9b001a91ed3c3bd300d56aa57f518112925a58fbf6333705f500b642 ql/lib/codeql/rust/generated/Array.qll 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 ql/lib/codeql/rust/generated/AstNode.qll 0598fac7859906f4103124270dfb2fbdb838387b1c45000bf50a4b62c797ec41 f47c84878c7c9676109e358073bddab92a1dbeb4d977d236ecc1eae44d81c894 ql/lib/codeql/rust/generated/AsyncBlock.qll 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c @@ -127,17 +129,17 @@ ql/lib/codeql/rust/generated/Await.qll f5d65ee72d03205b95b9f507a4da5706f5c66d0da ql/lib/codeql/rust/generated/Become.qll 7cfe61271eb91293014ebf16cd1029454705f4b569bba8afeec7d683f378efaf 9a31140d67ae8e77762aa2bd09ab018c88fe464a1b2205035e957d889abfe42a ql/lib/codeql/rust/generated/BinaryOp.qll ec80f6cb6a0a03496814a629ecc8736f77c46e22a6c26b4e11fe1e650eb91441 67cd9c875556034a7afe78857c2d50d9ae1af084bee87e0d0c691c8baaaae72f ql/lib/codeql/rust/generated/BindPat.qll 15d3a33c5f56f7659a331f72735f00930fddd6066659e54c5c19d5e7eb8ef078 bc0a916622b2c426b71760caf15b8e005eed276e06e04d04cc5f19f4c31c34f6 -ql/lib/codeql/rust/generated/Block.qll 7a50beadbbe3e7f778797b4a69ba20c56c389803335cec54a701761e74d94cf8 93c5148dc0540fca7233a231ecd5d4e744a1e73398306a652db521ce560bba47 +ql/lib/codeql/rust/generated/Block.qll 25ce7676fb0a0925f039cb35ba94283d7c4a2fb806652374a198b56796497111 8efecec53c2964e546ce7ed6328f89923c57d58d572d42b63423b99709b50077 ql/lib/codeql/rust/generated/BlockBase.qll f1984b819cb8d2257c7e6323041c32bc106153c1a3fba75f052a545b84e9f09f 7e2767cee8967b5b8a53c1ad1de578a11f46629422ff1b2cebe051fe53293a91 ql/lib/codeql/rust/generated/Box.qll c64ff6a3e495d5729e091d275f04573ca820df2df1f42773dd04b0da0bf1d3d1 6d0778ae8347530f9ed5be9b24206f02d9437dd5265fdb308dfefce70f5d8829 ql/lib/codeql/rust/generated/BoxPat.qll b69ba2bc341a1bf4c613279e45fb97a530619d4148d5ccc4f05436a316db29eb bf52730243bd1836d5890c745232aba50544c2046d00e80e7d22eebcd104f821 -ql/lib/codeql/rust/generated/Break.qll a1131a39a8b57398937b7e35108c83a92aabb284289acf5e8da1bbb9e603ae8d 4a2059cc94e028f080e984e485f1760c92ad2def6993ba68e023a2c9720ba00a +ql/lib/codeql/rust/generated/Break.qll 36f28582b12840a529514fcf0aac84ceaa452eca4442b347dd7b199659833ec7 ff03dc895c3c2baca41b17d358863cf9bd9209dc306d95c22f03db0716f664c7 ql/lib/codeql/rust/generated/Call.qll b2dc0c89cc8ca855cf38b82b5bcbbf0fb5cce2b5dafbb3eb253accea89818908 13441bcc3f0f68595cea49c4af14165335e67ceb83d2546ab4c45a5d054c2923 ql/lib/codeql/rust/generated/Cast.qll bfd3e61c0a7458adbed7d63bd5351ebdfcb11d42769fc2d34bafa6523f6e94ba e46d9a648e23a5e15e5c02d5d9666d827ef4732b7ac6b2edfc00d56cc239c845 ql/lib/codeql/rust/generated/Closure.qll e6f93c79fe2a9a5f842b30d443d4abb64a72bf400102d2e2287e0a1885bfd0df 4659dfc3b325c44c82013c5e198144ad93dba9c1ee43a0efaa4b83262b7db7f4 ql/lib/codeql/rust/generated/Const.qll a1c6725f1b7b2482dfd996d44ec695c63230c1c28ee00d9bf694dd3f01831323 a1c6725f1b7b2482dfd996d44ec695c63230c1c28ee00d9bf694dd3f01831323 ql/lib/codeql/rust/generated/ConstBlockPat.qll d0818fe4cee066f1e6d3439c82122942ae62941e69da686b7d5c399e820c395c 2fae5a2f0457bb7106d52ac7457afb597d7ac9658b8dcff8e76294f5fe34019a -ql/lib/codeql/rust/generated/Continue.qll 73a86f272288f0383b8cb3a8f72e954447a343715d8d82b2b58729077295905f e5d6cc9c7b0c47f01b8a5f076cc5790e837ade852b485ac8c323c540b7e7cd23 +ql/lib/codeql/rust/generated/Continue.qll 2aa6a5c99a66a852ee15322f931eeaeb2020732267a33e44adbc5218a77aa994 faf0c36fb1773233dd3c8f43bfb84037a36ef96d0f5b97b01865faf4ff79891e ql/lib/codeql/rust/generated/DbFile.qll 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a ql/lib/codeql/rust/generated/DbLocation.qll 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 ql/lib/codeql/rust/generated/Declaration.qll bbf5ba3792797a829b0032c41fa99d22c26e4277d655099912cdbafb80f0c8cd c4666a71099b21ad5cd83ef6f991ba18f9bef03b3ffbcedfa10aec081d6501d5 @@ -152,12 +154,13 @@ ql/lib/codeql/rust/generated/IfLet.qll 0f51d1f708282a622d075e635698b2020b7d21e77 ql/lib/codeql/rust/generated/Index.qll f1b78db475006a0779a079f9600987932e638bcfaf35ce4e9b2b872798e35d50 7fa2b22497c3bd80161f7e3ef5477c82a0d4f961dce557ed3fd1a62d9f9328f7 ql/lib/codeql/rust/generated/InlineAsm.qll f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 ql/lib/codeql/rust/generated/ItemStmt.qll b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa +ql/lib/codeql/rust/generated/Label.qll 7de504ea71f2847e305ab5ea3b30403cb0aafbaa0eb4cff3956a2931da6c024b 61e3c6a74b573aadcccefe0d4abe5d8e2542b1e5116c95f4e595b36efa3a86dc ql/lib/codeql/rust/generated/Let.qll 2cdec11bcb64d8c5c9db9ff3c8fff41fc4e5e705c0ff4327ae053ff10579fb6d c7e1742274635ded0088acdfe8cbc9e9d967f27e833ac8a1a37e3a06d207f004 ql/lib/codeql/rust/generated/LitPat.qll 92c3c0f32ab9d5b08e246231e5465fe18536dee99351f73e158048bb007baf8a 6736a7824e5bdb0cc16de1231bdb5169d2f48251d5917bf2c31a36422b0bf2fd ql/lib/codeql/rust/generated/Literal.qll eba217bbd4917c3674406c9538a0114d77d04f23467c4a362898a3020cb7d999 eba217bbd4917c3674406c9538a0114d77d04f23467c4a362898a3020cb7d999 ql/lib/codeql/rust/generated/Locatable.qll 9e9685bba50ad2220701f3465e63af9331f7f9dc548ad906ff954fc2ce0a4400 78c89b2cc78a357d682ab65310dd474603071f07c1eaaab07711714ce17549f2 ql/lib/codeql/rust/generated/Location.qll bce4c72988ec6fedd1439c60a37c45aa6147c962904709ef9f12206937174be4 d57000571771a2d997c50d9a43ef1c2f075960f847effa0e80ea91fd4c6b4d6c -ql/lib/codeql/rust/generated/Loop.qll e310e7e885374a653a2c3e6b86783b4a5dd71db72cf5f208785c17ea3f90737e 99c52a112d56f8e44a987159122091f46ba9a22b71456e8ba109369ff58db931 +ql/lib/codeql/rust/generated/Loop.qll 25e4ed09d3f47980cd9d0974cf3f0c0f73ea6177d5c81380a4346fc5ccfcc3d3 3565a431522b753736c8e880a40524870a92a9b6b2101a25c40232c2b0f20493 ql/lib/codeql/rust/generated/Match.qll e0dd9a39cfcb5cd56efd89c3c009a62ff39c887511ba2962dfeed978830b5000 7378a8a30d7bde2a06a23e7037bddbd64d656ec047ba18142d22086cc7d7da32 ql/lib/codeql/rust/generated/MatchArm.qll 5ad0dc254b6d58ccd856e4235b68ca0226a898c33f1f6b6fe7b48266a01ca627 f519af39f45e820eb3a70cefb0e4dfb541c3cf17952c00c6dd7e59f854a629bd ql/lib/codeql/rust/generated/MethodCall.qll 1d7afd5e8795b89f3cd20569fe7e0b7fd339aa178ed6ecb2a3a9cadd1a49eede 7a6396ce629a46db16de523fd39e2bb2c56837df80990ff1dd3bdfe242c20761 @@ -166,14 +169,14 @@ ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a2568 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 9365b29f55a6ca6353a0fc61ec9ac01a53ca5c12c997b804ec143ca6de5600ac 5d39a2063541af98d60fc6b989c2f3aacaa803422b718414f095d3af02a88e79 +ql/lib/codeql/rust/generated/ParentChild.qll 017401ffacb07315aba6c365fa5750f641d48bef13f3b14c64d29a32f53157e6 b9395225775cb390d959f617e61a42b39a1a2a201656bdc26315e27f743e8736 ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 8285e7937d3a375b5a882ecccbe2ac8db3cbff59bdb2ed4f7a32059362826255 beaceb79727f4a1244238599c39cdd696e6be13a8c1c9c49c3bac8845b881558 +ql/lib/codeql/rust/generated/Raw.qll 907592ecfe4cce2814f3e24b81de9885fd01e8147d9857fb23614677bcf32808 08271096b8af2d9e55265a2a66acc0fafff4e013c9661ef27b3ac322c75a01e9 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd @@ -181,8 +184,8 @@ ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511 ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533 ql/lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd -ql/lib/codeql/rust/generated/Synth.qll 9c71ab766b07e4d1c2b89e6ae0631a4f4e2b5dfda12f1e55dd5544327217a463 e56058f18c9b9e9d540bd5f12f9600f4e3522e18f67919119e60975f35a46e79 -ql/lib/codeql/rust/generated/SynthConstructors.qll bd3b69d1a153260761399fdc10b589c87f1295e894946b8e33d672c14b08df5f bd3b69d1a153260761399fdc10b589c87f1295e894946b8e33d672c14b08df5f +ql/lib/codeql/rust/generated/Synth.qll b1bacde93009d59195d61882f1faceee5e39a628328fa9d6cdd43f3df8898d22 dc6e278bf9ee8a4ab275f6f8f0de62529547a2a646510637e9dedf71b97343b0 +ql/lib/codeql/rust/generated/SynthConstructors.qll 1fc8279b904e4388af746ca1355381509ac242530856a01d7e8fbdba482cc273 1fc8279b904e4388af746ca1355381509ac242530856a01d7e8fbdba482cc273 ql/lib/codeql/rust/generated/Tuple.qll 3fde94f0c23c6af6bcb58d0245a3cd0a8bbd6ef7999fbeed805baf2615e6226d c1aa7fc201aebb34dc6cd7760e817032b86fd16b8facac450c74deda860bc821 ql/lib/codeql/rust/generated/TuplePat.qll fdb2c66fe6291106fe125de6a91c4d74b2c715d276c2fee9751d0523b618d095 330098460ccac28479a2b522048d6f1191bf01b40b3eceef4adf722c01c8360b ql/lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 diff --git a/rust/.gitattributes b/rust/.gitattributes index f12c235b32ae..452ad07743e8 100644 --- a/rust/.gitattributes +++ b/rust/.gitattributes @@ -55,6 +55,8 @@ /ql/lib/codeql/rust/elements/InlineAsmConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/ItemStmt.qll linguist-generated /ql/lib/codeql/rust/elements/ItemStmtConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Label.qll linguist-generated +/ql/lib/codeql/rust/elements/LabelConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Let.qll linguist-generated /ql/lib/codeql/rust/elements/LetConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/LitPat.qll linguist-generated @@ -154,6 +156,7 @@ /ql/lib/codeql/rust/generated/Index.qll linguist-generated /ql/lib/codeql/rust/generated/InlineAsm.qll linguist-generated /ql/lib/codeql/rust/generated/ItemStmt.qll linguist-generated +/ql/lib/codeql/rust/generated/Label.qll linguist-generated /ql/lib/codeql/rust/generated/Let.qll linguist-generated /ql/lib/codeql/rust/generated/LitPat.qll linguist-generated /ql/lib/codeql/rust/generated/Literal.qll linguist-generated diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 2c0840e56527..ac66cdadbe6d 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -41,6 +41,26 @@ impl TrapEntry for DbLocation { } } +#[derive(Debug)] +pub struct Label { + pub id: TrapId, + pub location: Option, + pub name: String, +} + +impl TrapEntry for Label { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("labels", vec![trap::Arg::Label(id), self.name.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + #[derive(Debug)] pub struct MatchArm { pub id: TrapId, @@ -238,7 +258,7 @@ pub struct Break { pub id: TrapId, pub location: Option, pub expr: Option, - pub label: Option, + pub label: Option, } impl TrapEntry for Break { @@ -388,7 +408,7 @@ impl TrapEntry for ConstBlockPat { pub struct Continue { pub id: TrapId, pub location: Option, - pub label: Option, + pub label: Option, } impl TrapEntry for Continue { @@ -658,7 +678,7 @@ pub struct Loop { pub id: TrapId, pub location: Option, pub body: trap::Label, - pub label: Option, + pub label: Option, } impl TrapEntry for Loop { @@ -1272,7 +1292,7 @@ pub struct Block { pub location: Option, pub statements: Vec, pub tail: Option, - pub label: Option, + pub label: Option, } impl TrapEntry for Block { diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index 9586676476fb..4e40e539d2a3 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -35,6 +35,7 @@ import codeql.rust.elements.IfLet import codeql.rust.elements.Index import codeql.rust.elements.InlineAsm import codeql.rust.elements.ItemStmt +import codeql.rust.elements.Label import codeql.rust.elements.Let import codeql.rust.elements.LitPat import codeql.rust.elements.Literal diff --git a/rust/ql/lib/codeql/rust/elements/Label.qll b/rust/ql/lib/codeql/rust/elements/Label.qll new file mode 100644 index 000000000000..20a006754e9f --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Label.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Label`. + */ + +private import codeql.rust.generated.Label + +class Label extends Generated::Label { } diff --git a/rust/ql/lib/codeql/rust/elements/LabelConstructor.qll b/rust/ql/lib/codeql/rust/elements/LabelConstructor.qll new file mode 100644 index 000000000000..0d82f1eb1c91 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/LabelConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `Label` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `Label` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructLabel(Raw::Label id) { any() } diff --git a/rust/ql/lib/codeql/rust/generated/Block.qll b/rust/ql/lib/codeql/rust/generated/Block.qll index eec7f3cf8588..531af6ac8324 100644 --- a/rust/ql/lib/codeql/rust/generated/Block.qll +++ b/rust/ql/lib/codeql/rust/generated/Block.qll @@ -7,6 +7,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw import codeql.rust.elements.BlockBase +import codeql.rust.elements.Label /** * INTERNAL: This module contains the fully generated definition of `Block` and should not @@ -23,7 +24,9 @@ module Generated { /** * Gets the label of this block, if it exists. */ - string getLabel() { result = Synth::convertBlockToRaw(this).(Raw::Block).getLabel() } + Label getLabel() { + result = Synth::convertLabelFromRaw(Synth::convertBlockToRaw(this).(Raw::Block).getLabel()) + } /** * Holds if `getLabel()` exists. diff --git a/rust/ql/lib/codeql/rust/generated/Break.qll b/rust/ql/lib/codeql/rust/generated/Break.qll index b356d07f5a18..7b5a1d95c75a 100644 --- a/rust/ql/lib/codeql/rust/generated/Break.qll +++ b/rust/ql/lib/codeql/rust/generated/Break.qll @@ -7,6 +7,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw import codeql.rust.elements.Expr +import codeql.rust.elements.Label /** * INTERNAL: This module contains the fully generated definition of `Break` and should not @@ -35,7 +36,9 @@ module Generated { /** * Gets the label of this break, if it exists. */ - string getLabel() { result = Synth::convertBreakToRaw(this).(Raw::Break).getLabel() } + Label getLabel() { + result = Synth::convertLabelFromRaw(Synth::convertBreakToRaw(this).(Raw::Break).getLabel()) + } /** * Holds if `getLabel()` exists. diff --git a/rust/ql/lib/codeql/rust/generated/Continue.qll b/rust/ql/lib/codeql/rust/generated/Continue.qll index 148743cffc88..27f24ac727fb 100644 --- a/rust/ql/lib/codeql/rust/generated/Continue.qll +++ b/rust/ql/lib/codeql/rust/generated/Continue.qll @@ -7,6 +7,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw import codeql.rust.elements.Expr +import codeql.rust.elements.Label /** * INTERNAL: This module contains the fully generated definition of `Continue` and should not @@ -23,7 +24,10 @@ module Generated { /** * Gets the label of this continue, if it exists. */ - string getLabel() { result = Synth::convertContinueToRaw(this).(Raw::Continue).getLabel() } + Label getLabel() { + result = + Synth::convertLabelFromRaw(Synth::convertContinueToRaw(this).(Raw::Continue).getLabel()) + } /** * Holds if `getLabel()` exists. diff --git a/rust/ql/lib/codeql/rust/generated/Label.qll b/rust/ql/lib/codeql/rust/generated/Label.qll new file mode 100644 index 000000000000..6922dd193acd --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Label.qll @@ -0,0 +1,28 @@ +// generated by codegen +/** + * This module provides the generated definition of `Label`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.AstNode + +/** + * INTERNAL: This module contains the fully generated definition of `Label` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Label` class directly. + * Use the subclass `Label`, where the following predicates are available. + */ + class Label extends Synth::TLabel, AstNode { + override string getAPrimaryQlClass() { result = "Label" } + + /** + * Gets the name of this label. + */ + string getName() { result = Synth::convertLabelToRaw(this).(Raw::Label).getName() } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Loop.qll b/rust/ql/lib/codeql/rust/generated/Loop.qll index f8ebefa5451e..6b5956f01b33 100644 --- a/rust/ql/lib/codeql/rust/generated/Loop.qll +++ b/rust/ql/lib/codeql/rust/generated/Loop.qll @@ -7,6 +7,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw import codeql.rust.elements.Expr +import codeql.rust.elements.Label /** * INTERNAL: This module contains the fully generated definition of `Loop` and should not @@ -30,7 +31,9 @@ module Generated { /** * Gets the label of this loop, if it exists. */ - string getLabel() { result = Synth::convertLoopToRaw(this).(Raw::Loop).getLabel() } + Label getLabel() { + result = Synth::convertLabelFromRaw(Synth::convertLoopToRaw(this).(Raw::Loop).getLabel()) + } /** * Holds if `getLabel()` exists. diff --git a/rust/ql/lib/codeql/rust/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/generated/ParentChild.qll index d08d1d0171a9..f8b7fff1ee4a 100644 --- a/rust/ql/lib/codeql/rust/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/generated/ParentChild.qll @@ -146,6 +146,19 @@ private module Impl { ) } + private Element getImmediateChildOfLabel(Label e, int index, string partialPredicateCall) { + exists(int b, int bAstNode, int n | + b = 0 and + bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and + n = bAstNode and + ( + none() + or + result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall) + ) + ) + } + private Element getImmediateChildOfMatchArm(MatchArm e, int index, string partialPredicateCall) { exists(int b, int bAstNode, int n | b = 0 and @@ -941,6 +954,8 @@ private module Impl { or result = getImmediateChildOfUnknownLocation(e, index, partialAccessor) or + result = getImmediateChildOfLabel(e, index, partialAccessor) + or result = getImmediateChildOfMatchArm(e, index, partialAccessor) or result = getImmediateChildOfTypeRef(e, index, partialAccessor) diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 728379529bce..d7663e5889e4 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -89,6 +89,18 @@ module Raw { */ class Expr extends @expr, AstNode { } + /** + * INTERNAL: Do not use. + */ + class Label extends @label, AstNode { + override string toString() { result = "Label" } + + /** + * Gets the name of this label. + */ + string getName() { labels(this, result) } + } + /** * INTERNAL: Do not use. */ @@ -251,7 +263,7 @@ module Raw { /** * Gets the label of this break, if it exists. */ - string getLabel() { break_labels(this, result) } + Label getLabel() { break_labels(this, result) } } /** @@ -353,7 +365,7 @@ module Raw { /** * Gets the label of this continue, if it exists. */ - string getLabel() { continue_labels(this, result) } + Label getLabel() { continue_labels(this, result) } } /** @@ -542,7 +554,7 @@ module Raw { /** * Gets the label of this loop, if it exists. */ - string getLabel() { loop_labels(this, result) } + Label getLabel() { loop_labels(this, result) } } /** @@ -871,7 +883,7 @@ module Raw { /** * Gets the label of this block, if it exists. */ - string getLabel() { block_labels(this, result) } + Label getLabel() { block_labels(this, result) } } /** diff --git a/rust/ql/lib/codeql/rust/generated/Synth.qll b/rust/ql/lib/codeql/rust/generated/Synth.qll index 16a0dc283b29..5be4c04731f6 100644 --- a/rust/ql/lib/codeql/rust/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/generated/Synth.qll @@ -119,6 +119,10 @@ module Synth { * INTERNAL: Do not use. */ TItemStmt(Raw::ItemStmt id) { constructItemStmt(id) } or + /** + * INTERNAL: Do not use. + */ + TLabel(Raw::Label id) { constructLabel(id) } or /** * INTERNAL: Do not use. */ @@ -259,7 +263,7 @@ module Synth { /** * INTERNAL: Do not use. */ - class TAstNode = TDeclaration or TExpr or TMatchArm or TPat or TStmt or TTypeRef; + class TAstNode = TDeclaration or TExpr or TLabel or TMatchArm or TPat or TStmt or TTypeRef; /** * INTERNAL: Do not use. @@ -490,6 +494,13 @@ module Synth { cached TItemStmt convertItemStmtFromRaw(Raw::Element e) { result = TItemStmt(e) } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TLabel`, if possible. + */ + cached + TLabel convertLabelFromRaw(Raw::Element e) { result = TLabel(e) } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TLet`, if possible. @@ -738,6 +749,8 @@ module Synth { or result = convertExprFromRaw(e) or + result = convertLabelFromRaw(e) + or result = convertMatchArmFromRaw(e) or result = convertPatFromRaw(e) @@ -1116,6 +1129,13 @@ module Synth { cached Raw::Element convertItemStmtToRaw(TItemStmt e) { e = TItemStmt(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TLabel` to a raw DB element, if possible. + */ + cached + Raw::Element convertLabelToRaw(TLabel e) { e = TLabel(result) } + /** * INTERNAL: Do not use. * Converts a synthesized `TLet` to a raw DB element, if possible. @@ -1364,6 +1384,8 @@ module Synth { or result = convertExprToRaw(e) or + result = convertLabelToRaw(e) + or result = convertMatchArmToRaw(e) or result = convertPatToRaw(e) diff --git a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll index 74681f51e745..fc138db745ec 100644 --- a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll @@ -29,6 +29,7 @@ import codeql.rust.elements.IfLetConstructor import codeql.rust.elements.IndexConstructor import codeql.rust.elements.InlineAsmConstructor import codeql.rust.elements.ItemStmtConstructor +import codeql.rust.elements.LabelConstructor import codeql.rust.elements.LetConstructor import codeql.rust.elements.LitPatConstructor import codeql.rust.elements.LiteralConstructor diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index b4723b01dab5..5389f41697a7 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -54,6 +54,7 @@ locations( @ast_node = @declaration | @expr +| @label | @match_arm | @pat | @stmt @@ -109,6 +110,11 @@ db_locations( | @yield ; +labels( + unique int id: @label, + string name: string ref +); + match_arms( unique int id: @match_arm, int pat: @pat ref, @@ -227,7 +233,7 @@ break_exprs( #keyset[id] break_labels( int id: @break ref, - string label: string ref + int label: @label ref ); calls( @@ -299,7 +305,7 @@ continues( #keyset[id] continue_labels( int id: @continue ref, - string label: string ref + int label: @label ref ); expr_stmts( @@ -401,7 +407,7 @@ loops( #keyset[id] loop_labels( int id: @loop ref, - string label: string ref + int label: @label ref ); matches( @@ -644,7 +650,7 @@ blocks( #keyset[id] block_labels( int id: @block ref, - string label: string ref + int label: @label ref ); unsafe_blocks( diff --git a/rust/schema.py b/rust/schema.py index 2a385926e996..3a71dc94267b 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -81,6 +81,11 @@ class Pat(AstNode): pass +@qltest.skip +class Label(AstNode): + name: string + + @qltest.collapse_hierarchy class Stmt(AstNode): pass @@ -144,7 +149,7 @@ class BlockBase(Expr): class Block(BlockBase): - label: optional[string] + label: optional[Label] # Async { # id: Option, @@ -181,7 +186,7 @@ class UnsafeBlock(BlockBase): class Loop(Expr): body: Expr - label: optional[string] + label: optional[Label] # Call { # callee: ExprId, @@ -238,7 +243,7 @@ class Match(Expr): class Continue(Expr): - label: optional[string] + label: optional[Label] # Break { # expr: Option, @@ -248,7 +253,7 @@ class Continue(Expr): class Break(Expr): expr: optional[Expr] - label: optional[string] + label: optional[Label] # Return { From bc6da117d260bd2287c7ce2e0be44730ab593520 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 17:59:24 +0200 Subject: [PATCH 07/13] Fix type of Closure::arg_types --- rust/.generated.list | 4 ++-- rust/extractor/src/generated/top.rs | 6 ++++-- rust/ql/lib/codeql/rust/generated/Closure.qll | 10 +++++----- rust/ql/lib/codeql/rust/generated/Raw.qll | 2 +- rust/schema.py | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/rust/.generated.list b/rust/.generated.list index 4c22daff2671..391b9e514483 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -136,7 +136,7 @@ ql/lib/codeql/rust/generated/BoxPat.qll b69ba2bc341a1bf4c613279e45fb97a530619d41 ql/lib/codeql/rust/generated/Break.qll 36f28582b12840a529514fcf0aac84ceaa452eca4442b347dd7b199659833ec7 ff03dc895c3c2baca41b17d358863cf9bd9209dc306d95c22f03db0716f664c7 ql/lib/codeql/rust/generated/Call.qll b2dc0c89cc8ca855cf38b82b5bcbbf0fb5cce2b5dafbb3eb253accea89818908 13441bcc3f0f68595cea49c4af14165335e67ceb83d2546ab4c45a5d054c2923 ql/lib/codeql/rust/generated/Cast.qll bfd3e61c0a7458adbed7d63bd5351ebdfcb11d42769fc2d34bafa6523f6e94ba e46d9a648e23a5e15e5c02d5d9666d827ef4732b7ac6b2edfc00d56cc239c845 -ql/lib/codeql/rust/generated/Closure.qll e6f93c79fe2a9a5f842b30d443d4abb64a72bf400102d2e2287e0a1885bfd0df 4659dfc3b325c44c82013c5e198144ad93dba9c1ee43a0efaa4b83262b7db7f4 +ql/lib/codeql/rust/generated/Closure.qll 903b34f075623f952ebdafc105dc2efefd1816feed8df3b735919be8a7a7a5c7 bbb9ffddcc01e28223d1630a5052661ff00dda25f9f226cf8991773cf1862f84 ql/lib/codeql/rust/generated/Const.qll a1c6725f1b7b2482dfd996d44ec695c63230c1c28ee00d9bf694dd3f01831323 a1c6725f1b7b2482dfd996d44ec695c63230c1c28ee00d9bf694dd3f01831323 ql/lib/codeql/rust/generated/ConstBlockPat.qll d0818fe4cee066f1e6d3439c82122942ae62941e69da686b7d5c399e820c395c 2fae5a2f0457bb7106d52ac7457afb597d7ac9658b8dcff8e76294f5fe34019a ql/lib/codeql/rust/generated/Continue.qll 2aa6a5c99a66a852ee15322f931eeaeb2020732267a33e44adbc5218a77aa994 faf0c36fb1773233dd3c8f43bfb84037a36ef96d0f5b97b01865faf4ff79891e @@ -176,7 +176,7 @@ ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 907592ecfe4cce2814f3e24b81de9885fd01e8147d9857fb23614677bcf32808 08271096b8af2d9e55265a2a66acc0fafff4e013c9661ef27b3ac322c75a01e9 +ql/lib/codeql/rust/generated/Raw.qll a8ccb9c9a9e2ffcf4f4cf09e54111036f9e5e705dd002f68afcc4de519be56f7 0080046e0a8c1506cf91616de28b8093e9b13f35c0fa11d48fb4913c035c2f85 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index ac66cdadbe6d..842d9010e45a 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -334,7 +334,7 @@ pub struct Closure { pub id: TrapId, pub location: Option, pub args: Vec, - pub arg_types: Vec, + pub arg_types: Vec>, pub ret_type: Option, pub body: trap::Label, pub is_move: bool, @@ -354,7 +354,9 @@ impl TrapEntry for Closure { out.add_tuple("closure_args", vec![trap::Arg::Label(id), i.into(), v.into()]); } for (i, &v) in self.arg_types.iter().enumerate() { - out.add_tuple("closure_arg_types", vec![trap::Arg::Label(id), i.into(), v.into()]); + if let Some(vv) = v { + out.add_tuple("closure_arg_types", vec![trap::Arg::Label(id), i.into(), v.into()]); + } } if let Some(v) = self.ret_type { out.add_tuple("closure_ret_types", vec![trap::Arg::Label(id), v.into()]); diff --git a/rust/ql/lib/codeql/rust/generated/Closure.qll b/rust/ql/lib/codeql/rust/generated/Closure.qll index 9c0876a91212..c24d13783be9 100644 --- a/rust/ql/lib/codeql/rust/generated/Closure.qll +++ b/rust/ql/lib/codeql/rust/generated/Closure.qll @@ -41,7 +41,7 @@ module Generated { final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) } /** - * Gets the `index`th argument type of this closure (0-based). + * Gets the `index`th argument type of this closure (0-based), if it exists. */ TypeRef getArgType(int index) { result = @@ -51,14 +51,14 @@ module Generated { } /** - * Gets any of the argument types of this closure. + * Holds if `getArgType(index)` exists. */ - final TypeRef getAnArgType() { result = this.getArgType(_) } + final predicate hasArgType(int index) { exists(this.getArgType(index)) } /** - * Gets the number of argument types of this closure. + * Gets any of the argument types of this closure. */ - final int getNumberOfArgTypes() { result = count(int i | exists(this.getArgType(i))) } + final TypeRef getAnArgType() { result = this.getArgType(_) } /** * Gets the ret type of this closure, if it exists. diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index d7663e5889e4..1bf59e2d0445 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -317,7 +317,7 @@ module Raw { Pat getArg(int index) { closure_args(this, index, result) } /** - * Gets the `index`th argument type of this closure (0-based). + * Gets the `index`th argument type of this closure (0-based), if it exists. */ TypeRef getArgType(int index) { closure_arg_types(this, index, result) } diff --git a/rust/schema.py b/rust/schema.py index 3a71dc94267b..0156318e28b1 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -402,7 +402,7 @@ class Index(Expr): class Closure(Expr): args: list[Pat] - arg_types: list[TypeRef] + arg_types: list[optional[TypeRef]] ret_type: optional[TypeRef] body: Expr # TODO From 75113367c995519ae3718466c7cb1bf6a3cc7492 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 18:14:14 +0200 Subject: [PATCH 08/13] Add InlineAsm::expr --- rust/.generated.list | 6 +++--- rust/extractor/src/generated/top.rs | 3 ++- rust/ql/lib/codeql/rust/generated/InlineAsm.qll | 8 ++++++++ rust/ql/lib/codeql/rust/generated/Raw.qll | 5 +++++ rust/ql/lib/rust.dbscheme | 3 ++- rust/schema.py | 2 +- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/rust/.generated.list b/rust/.generated.list index 391b9e514483..ae57e2469c9d 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -152,7 +152,7 @@ ql/lib/codeql/rust/generated/Function.qll 8d5607035adebdb5f1a80ac2688b57ca751bfc ql/lib/codeql/rust/generated/If.qll b8040f4bdc6ca2db2cf0435edd9aca432d1ba5f36170f5588a7746f0e4174c51 6033f72ff2d0d3b640b0ef8399d8ef39bc1eec33242a1567cd7dc5ccd2463797 ql/lib/codeql/rust/generated/IfLet.qll 0f51d1f708282a622d075e635698b2020b7d21e77abad6ea12516af13edb5d06 1b9f9c058c888f77a225025b984145a886928caaad26f20e869d9f8a0f5843b4 ql/lib/codeql/rust/generated/Index.qll f1b78db475006a0779a079f9600987932e638bcfaf35ce4e9b2b872798e35d50 7fa2b22497c3bd80161f7e3ef5477c82a0d4f961dce557ed3fd1a62d9f9328f7 -ql/lib/codeql/rust/generated/InlineAsm.qll f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 f21e507aca81649070c44141e6af121f1a8337850966011158accf8f2b26e6a2 +ql/lib/codeql/rust/generated/InlineAsm.qll 18d8e206d226779d45c27c83e59fdf21ea4fe55969a9d4edf2e91e58877b5d35 723a4d0293a1df9be124b6aae340cb2814e4be0dc01dec95d001e6f986e0e84c ql/lib/codeql/rust/generated/ItemStmt.qll b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa ql/lib/codeql/rust/generated/Label.qll 7de504ea71f2847e305ab5ea3b30403cb0aafbaa0eb4cff3956a2931da6c024b 61e3c6a74b573aadcccefe0d4abe5d8e2542b1e5116c95f4e595b36efa3a86dc ql/lib/codeql/rust/generated/Let.qll 2cdec11bcb64d8c5c9db9ff3c8fff41fc4e5e705c0ff4327ae053ff10579fb6d c7e1742274635ded0088acdfe8cbc9e9d967f27e833ac8a1a37e3a06d207f004 @@ -169,14 +169,14 @@ ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a2568 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 017401ffacb07315aba6c365fa5750f641d48bef13f3b14c64d29a32f53157e6 b9395225775cb390d959f617e61a42b39a1a2a201656bdc26315e27f743e8736 +ql/lib/codeql/rust/generated/ParentChild.qll 0a110516379dd64cb1275fb639a47e0268b95cad795a76dfb3eb4a6b5bfc7bcc b9395225775cb390d959f617e61a42b39a1a2a201656bdc26315e27f743e8736 ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll a8ccb9c9a9e2ffcf4f4cf09e54111036f9e5e705dd002f68afcc4de519be56f7 0080046e0a8c1506cf91616de28b8093e9b13f35c0fa11d48fb4913c035c2f85 +ql/lib/codeql/rust/generated/Raw.qll d1b5db6d3325700e2d5071e5295d1a5b239f0ab157320009ecd9add1313de26e e70f9125f2712932797848acb1073ea454ccbd66626ce22303773c569f103673 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 842d9010e45a..d1819f0c1e43 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -581,6 +581,7 @@ impl TrapEntry for Index { pub struct InlineAsm { pub id: TrapId, pub location: Option, + pub expr: trap::Label, } impl TrapEntry for InlineAsm { @@ -589,7 +590,7 @@ impl TrapEntry for InlineAsm { } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("inline_asms", vec![trap::Arg::Label(id)]); + out.add_tuple("inline_asms", vec![trap::Arg::Label(id), self.expr.into()]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } diff --git a/rust/ql/lib/codeql/rust/generated/InlineAsm.qll b/rust/ql/lib/codeql/rust/generated/InlineAsm.qll index b9189c6a7e58..6a21b17d0d00 100644 --- a/rust/ql/lib/codeql/rust/generated/InlineAsm.qll +++ b/rust/ql/lib/codeql/rust/generated/InlineAsm.qll @@ -19,5 +19,13 @@ module Generated { */ class InlineAsm extends Synth::TInlineAsm, Expr { override string getAPrimaryQlClass() { result = "InlineAsm" } + + /** + * Gets the expression of this inline asm. + */ + Expr getExpr() { + result = + Synth::convertExprFromRaw(Synth::convertInlineAsmToRaw(this).(Raw::InlineAsm).getExpr()) + } } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 1bf59e2d0445..7dd436f1c157 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -495,6 +495,11 @@ module Raw { */ class InlineAsm extends @inline_asm, Expr { override string toString() { result = "InlineAsm" } + + /** + * Gets the expression of this inline asm. + */ + Expr getExpr() { inline_asms(this, result) } } /** diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 5389f41697a7..27b862976065 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -377,7 +377,8 @@ index_is_assignee_expr( ); inline_asms( - unique int id: @inline_asm + unique int id: @inline_asm, + int expr: @expr ref ); item_stmts( diff --git a/rust/schema.py b/rust/schema.py index 0156318e28b1..9d781223ee68 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -442,7 +442,7 @@ class OffsetOf(Expr): class InlineAsm(Expr): - pass + expr: Expr # Let { From 69b05e835c722203c768262626353bdac9a82f31 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 18:17:15 +0200 Subject: [PATCH 09/13] Add fields for OffsetOf --- rust/.generated.list | 6 ++-- rust/extractor/src/generated/top.rs | 7 ++++- .../ql/lib/codeql/rust/generated/OffsetOf.qll | 28 +++++++++++++++++++ rust/ql/lib/codeql/rust/generated/Raw.qll | 10 +++++++ rust/ql/lib/rust.dbscheme | 10 ++++++- rust/schema.py | 4 ++- 6 files changed, 59 insertions(+), 6 deletions(-) diff --git a/rust/.generated.list b/rust/.generated.list index ae57e2469c9d..8dd2218845a8 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -167,16 +167,16 @@ ql/lib/codeql/rust/generated/MethodCall.qll 1d7afd5e8795b89f3cd20569fe7e0b7fd339 ql/lib/codeql/rust/generated/MissingExpr.qll 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 -ql/lib/codeql/rust/generated/OffsetOf.qll 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 8b3778c32d2e7c85491e7a85c9c6337de822e946655b9af69a4281838787f291 +ql/lib/codeql/rust/generated/OffsetOf.qll c5c7218a0dfa6636a4b3e4218969638cc267db94a966b19fbced0ba6f85dbd0e 6c8fac4cd343073ee0ed48498deb7faa65a876776d9ca0a98e51350fead5c8ac ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 0a110516379dd64cb1275fb639a47e0268b95cad795a76dfb3eb4a6b5bfc7bcc b9395225775cb390d959f617e61a42b39a1a2a201656bdc26315e27f743e8736 +ql/lib/codeql/rust/generated/ParentChild.qll 345b5b9fa164fce5886cd06e0739881b28da64870e3b544f8b59556aed85e63d b9395225775cb390d959f617e61a42b39a1a2a201656bdc26315e27f743e8736 ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll d1b5db6d3325700e2d5071e5295d1a5b239f0ab157320009ecd9add1313de26e e70f9125f2712932797848acb1073ea454ccbd66626ce22303773c569f103673 +ql/lib/codeql/rust/generated/Raw.qll 2836b68a614049752714f4929eb5e978383c5dc8bbe9d2fa67c7f0fbfca95eda 0237eedfa08d195d411e1e98f4bfa0fd9bebcf7765c49ca50c47a4d3fad1271f ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index d1819f0c1e43..352b198c122d 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -814,6 +814,8 @@ impl TrapEntry for Module { pub struct OffsetOf { pub id: TrapId, pub location: Option, + pub container: trap::Label, + pub fields: Vec, } impl TrapEntry for OffsetOf { @@ -822,10 +824,13 @@ impl TrapEntry for OffsetOf { } fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("offset_ofs", vec![trap::Arg::Label(id)]); + out.add_tuple("offset_ofs", vec![trap::Arg::Label(id), self.container.into()]); if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } + for (i, &v) in self.fields.iter().enumerate() { + out.add_tuple("offset_of_fields", vec![trap::Arg::Label(id), i.into(), v.into()]); + } } } diff --git a/rust/ql/lib/codeql/rust/generated/OffsetOf.qll b/rust/ql/lib/codeql/rust/generated/OffsetOf.qll index 1a64546225c3..8ce9581b015d 100644 --- a/rust/ql/lib/codeql/rust/generated/OffsetOf.qll +++ b/rust/ql/lib/codeql/rust/generated/OffsetOf.qll @@ -7,6 +7,7 @@ private import codeql.rust.generated.Synth private import codeql.rust.generated.Raw import codeql.rust.elements.Expr +import codeql.rust.elements.TypeRef /** * INTERNAL: This module contains the fully generated definition of `OffsetOf` and should not @@ -19,5 +20,32 @@ module Generated { */ class OffsetOf extends Synth::TOffsetOf, Expr { override string getAPrimaryQlClass() { result = "OffsetOf" } + + /** + * Gets the container of this offset of. + */ + TypeRef getContainer() { + result = + Synth::convertTypeRefFromRaw(Synth::convertOffsetOfToRaw(this) + .(Raw::OffsetOf) + .getContainer()) + } + + /** + * Gets the `index`th field of this offset of (0-based). + */ + string getField(int index) { + result = Synth::convertOffsetOfToRaw(this).(Raw::OffsetOf).getField(index) + } + + /** + * Gets any of the fields of this offset of. + */ + final string getAField() { result = this.getField(_) } + + /** + * Gets the number of fields of this offset of. + */ + final int getNumberOfFields() { result = count(int i | exists(this.getField(i))) } } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 7dd436f1c157..6cb53bb133f7 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -632,6 +632,16 @@ module Raw { */ class OffsetOf extends @offset_of, Expr { override string toString() { result = "OffsetOf" } + + /** + * Gets the container of this offset of. + */ + TypeRef getContainer() { offset_ofs(this, result) } + + /** + * Gets the `index`th field of this offset of (0-based). + */ + string getField(int index) { offset_of_fields(this, index, result) } } /** diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 27b862976065..de4cb37ed96f 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -456,7 +456,15 @@ module_declarations( ); offset_ofs( - unique int id: @offset_of + unique int id: @offset_of, + int container: @type_ref ref +); + +#keyset[id, index] +offset_of_fields( + int id: @offset_of ref, + int index: int ref, + string field: string ref ); or_pats( diff --git a/rust/schema.py b/rust/schema.py index 9d781223ee68..8b9066717058 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -437,7 +437,9 @@ class Underscore(Expr): class OffsetOf(Expr): - pass + container: TypeRef + fields: list[string] + # InlineAsm(InlineAsm), From e8277015ab5481996566475d596bc907f033dacc Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 18:23:01 +0200 Subject: [PATCH 10/13] Add subclasses for Array --- rust/.generated.list | 19 +++-- rust/.gitattributes | 7 +- rust/extractor/src/generated/top.rs | 67 ++++++++++----- rust/ql/lib/codeql/rust/elements.qll | 2 + .../lib/codeql/rust/elements/ElementList.qll | 8 ++ .../rust/elements/ElementListConstructor.qll | 14 ++++ rust/ql/lib/codeql/rust/elements/Repeat.qll | 8 ++ ...yConstructor.qll => RepeatConstructor.qll} | 6 +- rust/ql/lib/codeql/rust/generated/Array.qll | 4 +- .../lib/codeql/rust/generated/ElementList.qll | 51 ++++++++++++ .../lib/codeql/rust/generated/ParentChild.qll | 34 +++++++- rust/ql/lib/codeql/rust/generated/Raw.qll | 38 ++++++++- rust/ql/lib/codeql/rust/generated/Repeat.qll | 39 +++++++++ rust/ql/lib/codeql/rust/generated/Synth.qll | 81 ++++++++++++++----- .../rust/generated/SynthConstructors.qll | 3 +- rust/ql/lib/rust.dbscheme | 29 ++++++- rust/schema.py | 14 ++++ 17 files changed, 364 insertions(+), 60 deletions(-) create mode 100644 rust/ql/lib/codeql/rust/elements/ElementList.qll create mode 100644 rust/ql/lib/codeql/rust/elements/ElementListConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/Repeat.qll rename rust/ql/lib/codeql/rust/elements/{ArrayConstructor.qll => RepeatConstructor.qll} (63%) create mode 100644 rust/ql/lib/codeql/rust/generated/ElementList.qll create mode 100644 rust/ql/lib/codeql/rust/generated/Repeat.qll diff --git a/rust/.generated.list b/rust/.generated.list index 8dd2218845a8..6c863a05d737 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -1,5 +1,4 @@ ql/lib/codeql/rust/elements/Array.qll c33de8fd2c0acbf221441dd67b061d3ab169f0bf548c0c957884455a215fce5c c54c716551746afd895da187e3d03acbe481bdf1ca4461065555641480801c2d -ql/lib/codeql/rust/elements/ArrayConstructor.qll aba72e72a26013fe0c665870bbdc20903ff287d890cbcabc0dc62be32ace8422 6c539b9008c27646c5708f92e8691f41d752676045953516117eb3bb23e3f88c ql/lib/codeql/rust/elements/AstNode.qll 2069047c779514867c12d845dcdf889db6f27fa6a9e484966a3c28a77973b7d4 e214616c81418b0018c0d36896ac2ec7273634e3213bc8257d8b172f396c00ee ql/lib/codeql/rust/elements/AsyncBlock.qll ac5899827719dae561540d1c460540bd3242b79ee98f0ea3f9391e98f7a6b680 a0d64b5896fcc2c8292b757645a0041c716ac0e9b85264729898347361061c8b ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll c094b929e6f3e7053973e80b26b13989e90d603da0cc073679c9e6594c3eceba 95e55c95007e392ebcc43a895bf26ff5983598f7ffb1e3fdee2858ce61b50ea0 @@ -37,6 +36,8 @@ ql/lib/codeql/rust/elements/DbFileConstructor.qll ea93dc49b23b1c6d800ab9d0b9cacf ql/lib/codeql/rust/elements/DbLocation.qll 1f694594e8e4ab65a8781cd443ad4f864447ca88e2cb65504aee5a779393c84d 003ec72275406eb8f5ddd6ccc2b258fb7c906d4bb2c0ef1ba235f291624321ca ql/lib/codeql/rust/elements/DbLocationConstructor.qll 8848abace985818a5d3a6eddfc4cb200795970146d282b037b4f22ae6230b894 44dba880e17bb1072fa12451ccaae4830fd04dcc61f7403d35510309fde6906e ql/lib/codeql/rust/elements/Declaration.qll d4ec5c83728f1837243caf2f27d06fd05ecdd2ca440112accff99bfd37b45e5f c1cd9b297be8b69207e75d24b29949b9f71c78406ee0ffd38d0b0810288d6140 +ql/lib/codeql/rust/elements/ElementList.qll e969e89e4375363dc17a779e3b963d63528d72d38ef70810088a2d53c4999cc6 b10f5dda8aa1af683e58c3c86c4d2117f60582a3de2a2f0903b905d333798b47 +ql/lib/codeql/rust/elements/ElementListConstructor.qll b21ada740a8a53b3abc63b7b338b55054f03d72e7a3581f9ac11e1c9b99e569e 40cda192387dfe882557b224ee28647330d8471d596b76debc549ebe2d4cf6a2 ql/lib/codeql/rust/elements/Expr.qll a0c2cb3ff9628e5dd1a7900d2413390faa433dcef114bdc85279a3a2bf2fc4d8 a0e8e5693ead91b62da5531e070e11a2105ee49046cb69e63b8747eeafc27651 ql/lib/codeql/rust/elements/ExprStmt.qll afe41d6d05ed9d94b3c8529dad743bdf3e2a0e68bed84a80da4dd6df0257451d c1f0c7c1a3c62baffb7d3bb69cc4bc828e6fbbbabe8f87342ec67d8744fcbe7e ql/lib/codeql/rust/elements/ExprStmtConstructor.qll 28e37020abdfce5a8666b0c9a3147c339c7a90d9de527f97fc7d36df2bb921ba 5333db932a2edb791ec3c8f2c215f4c74e825a362f45ee901949d81e328bc7fd @@ -96,6 +97,8 @@ ql/lib/codeql/rust/elements/Ref.qll ce21e04980cd53e453dbe79931418c8527102aab2e2b ql/lib/codeql/rust/elements/RefConstructor.qll bf669bb7392c120a8125913ee7ef3fe14436a753bff5e8697d4c336cfac0b491 0124097f1831f27b440293dd0fdb70b9d54a61f669b43bdd68e9e2937737dd02 ql/lib/codeql/rust/elements/RefPat.qll 00b2c32e09a02b336d516b7812aa7ffe6202bd1dcdf4ec2060a74ee7a4b1c5c3 90a4b3da60aec10b5d56f6364d0a022c1d7db5fe8cbb65a78f55651d23f9abe7 ql/lib/codeql/rust/elements/RefPatConstructor.qll 98497e0ef76bec0390a23aede2fc6f80050ad2d00bb60f1d473362111a53d4dd e4fde4e3e88c33daee90ab6d90ef2e38b36faedcfe1b6d6304f4eed92980b5b1 +ql/lib/codeql/rust/elements/Repeat.qll 9210ab6a659b0e21cefc12903ae4d7f3a3d663d80807c1634a00fbb66803454a a0c0b2187c0b32530d13f047a686a70c09c8efd372fd1afddff1d296e41a2888 +ql/lib/codeql/rust/elements/RepeatConstructor.qll 1066aaeb7340979cb35571ec58a80fc79984da5a90541a05e8342715facbdbd6 363c0f4371a1a6c8dd3f29b38e421b4b5062bf53b6ddbc5fc1faa534d25a8359 ql/lib/codeql/rust/elements/Return.qll 60237f2c90a93c0df852eba89a635f0014ce072ec2acb80137a1da07a12e4b16 cc914eecc5d0522e81a41a1901bdf6f4c7535888bc104d9ac30bde243d12210e ql/lib/codeql/rust/elements/ReturnConstructor.qll cdbbe70dab2be11453f1e98251ee7100d1a043f2d38b141615d3cdd53e3b62cf 8f3227e0eba7b06a9a19195b548807d87ce901a2d09fcaf23c89e53edf9f21a1 ql/lib/codeql/rust/elements/SlicePat.qll 3e88657bd488dcb1ce2fa6f4bf72a9f76c7bfbf64b695070efa0ad89a6af407b ad60e3d0eee368c21c46acb439b599d8867c82193c7279777fea10f3205bd272 @@ -121,8 +124,8 @@ ql/lib/codeql/rust/elements/Yeet.qll 07f967352be486b7e2b787c292c16195a7084699cbd ql/lib/codeql/rust/elements/YeetConstructor.qll 835afa5ff4b4102335525c41d67380e59f272f95b4b7b0196e0475eae4b9f738 6c51946d661aea16d91010e0639b4ea8f3d161bd56a029e955dc7f7bca025c00 ql/lib/codeql/rust/elements/Yield.qll 9a484b5b5c2c32ef61395213c376ce4b1ef7f699f08330d08faf071ea8919af1 e45fe09b794a2a05a1c125d112dfb36d9c7d538ff1953440d6c580cd8c987f8a ql/lib/codeql/rust/elements/YieldConstructor.qll 16f393593cf9cf126f048c6f36eba7ca45e78c44577c7bda51c9a66bac95487e f49c9c3d4d17f64f44111bea2bb197cf8b11a0aa88b53b9a527c6aab4733c4b5 -ql/lib/codeql/rust/elements.qll 4631074c9b001a91ed3c3bd300d56aa57f518112925a58fbf6333705f500b642 4631074c9b001a91ed3c3bd300d56aa57f518112925a58fbf6333705f500b642 -ql/lib/codeql/rust/generated/Array.qll 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 0858d0b9fa1c5c9fbc21069809d78cef7f39c909eee4f5dc395fd0f8bf4ac622 +ql/lib/codeql/rust/elements.qll 031c02392e2e40c7a336c9a09a6b77d29b4ecf2fa81f692b36b6efd8ee576e48 031c02392e2e40c7a336c9a09a6b77d29b4ecf2fa81f692b36b6efd8ee576e48 +ql/lib/codeql/rust/generated/Array.qll f9b0821628e9a72487322425ab6b9d232db5f9b24cd76d04e02124da96150667 253ad10a94f3783986ff436d6123d346074f79f0c9046e024abaa626106bc7e3 ql/lib/codeql/rust/generated/AstNode.qll 0598fac7859906f4103124270dfb2fbdb838387b1c45000bf50a4b62c797ec41 f47c84878c7c9676109e358073bddab92a1dbeb4d977d236ecc1eae44d81c894 ql/lib/codeql/rust/generated/AsyncBlock.qll 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c 8ba28deb0ad9d6a887df2033eca4e4a4789a24c09e5ca720d38474226c6dbb0c ql/lib/codeql/rust/generated/Await.qll f5d65ee72d03205b95b9f507a4da5706f5c66d0da8b4a8a5d67bfae5643a4766 382ad8a5e1098ec697370cdf5453404128abd9d56a1e578e0255aa29d33fcf74 @@ -144,6 +147,7 @@ ql/lib/codeql/rust/generated/DbFile.qll 4dbf1931124291e0d6a958ae882f8aeef006642f ql/lib/codeql/rust/generated/DbLocation.qll 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 ql/lib/codeql/rust/generated/Declaration.qll bbf5ba3792797a829b0032c41fa99d22c26e4277d655099912cdbafb80f0c8cd c4666a71099b21ad5cd83ef6f991ba18f9bef03b3ffbcedfa10aec081d6501d5 ql/lib/codeql/rust/generated/Element.qll 21567fa7348dccdf69dd34e73cb6de7cc9c7e0f3f7bb419a1abd787f7dc851a1 21567fa7348dccdf69dd34e73cb6de7cc9c7e0f3f7bb419a1abd787f7dc851a1 +ql/lib/codeql/rust/generated/ElementList.qll 483c8592ac946216cc2eb5562668d3120629c34dd039c3fab10224d0fd62ddbd df3154df35e89df76a1a77740118d5a41769364bf82b1f00377cd4a3968ff634 ql/lib/codeql/rust/generated/Expr.qll 32cdd43d17e8b2fb7c73ec723eba89704d1e853e29d304db5eea3979fcdd2e0b 0b8382b0659afa1bd1d13d0cd492d7fbdc0fd7a5162fa658ca2973bc15ee6534 ql/lib/codeql/rust/generated/ExprStmt.qll 1aba8c482a307f27612317b4d895ac59389e23ff905b6061931fced12ff7c3d1 c4e42a8863cfe4e83eddcd82236da2dbb1fc7bbdf12cab63d39fd1df4b1cb013 ql/lib/codeql/rust/generated/Field.qll c3249b8dd1aed1978077875fbd6090327d431af8cf8888b432cacfa33b76f976 0977ff2fd039f4d6a82ce209d7a7d60a0747a1a3a29be69cf3f136f76429c917 @@ -169,23 +173,24 @@ ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a2568 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 ql/lib/codeql/rust/generated/OffsetOf.qll c5c7218a0dfa6636a4b3e4218969638cc267db94a966b19fbced0ba6f85dbd0e 6c8fac4cd343073ee0ed48498deb7faa65a876776d9ca0a98e51350fead5c8ac ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 345b5b9fa164fce5886cd06e0739881b28da64870e3b544f8b59556aed85e63d b9395225775cb390d959f617e61a42b39a1a2a201656bdc26315e27f743e8736 +ql/lib/codeql/rust/generated/ParentChild.qll 1e2638cdf3cec4dd0a40e1fc61b9e739381f710429252acb80428ca21d270211 5bcc7154e175e4c96b61b47a681b569950612ec168b7ca3ec7368642c3ad3c9d ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 2836b68a614049752714f4929eb5e978383c5dc8bbe9d2fa67c7f0fbfca95eda 0237eedfa08d195d411e1e98f4bfa0fd9bebcf7765c49ca50c47a4d3fad1271f +ql/lib/codeql/rust/generated/Raw.qll 0ca064561f7375659dc2b84ca8881d4f39b85880c9efb7802377787fb58e2052 ad925674e73d113b4d33c8b4fd556770bfbcf9d0ab180dbf0253c61c123bfec7 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb50a9f2bf62e49bf182d64b6d 804efbd32869f92e5515d34852fed6416288f99b0aab95b5be5cb5bdd1eea806 +ql/lib/codeql/rust/generated/Repeat.qll ba4a6b643a6d16924b138a1a585fe059d8d094592fa49329e4061ee18c31abc5 4be73736804193d127f968fa6cef1a264753d079f325d8724d258f16df1f3286 ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511 ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533 ql/lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd -ql/lib/codeql/rust/generated/Synth.qll b1bacde93009d59195d61882f1faceee5e39a628328fa9d6cdd43f3df8898d22 dc6e278bf9ee8a4ab275f6f8f0de62529547a2a646510637e9dedf71b97343b0 -ql/lib/codeql/rust/generated/SynthConstructors.qll 1fc8279b904e4388af746ca1355381509ac242530856a01d7e8fbdba482cc273 1fc8279b904e4388af746ca1355381509ac242530856a01d7e8fbdba482cc273 +ql/lib/codeql/rust/generated/Synth.qll cf37698f44ca6786d3067ab9bc2501664988903cdfe5265aa78838727caca966 1d06d446f064da7e11fb7779030be0f00e5e10a3618e4148c50c0932a090632a +ql/lib/codeql/rust/generated/SynthConstructors.qll cf79523cb4d14dfcc92c7531e024a966139c99efc170cb86f2035b595c1d5bfd cf79523cb4d14dfcc92c7531e024a966139c99efc170cb86f2035b595c1d5bfd ql/lib/codeql/rust/generated/Tuple.qll 3fde94f0c23c6af6bcb58d0245a3cd0a8bbd6ef7999fbeed805baf2615e6226d c1aa7fc201aebb34dc6cd7760e817032b86fd16b8facac450c74deda860bc821 ql/lib/codeql/rust/generated/TuplePat.qll fdb2c66fe6291106fe125de6a91c4d74b2c715d276c2fee9751d0523b618d095 330098460ccac28479a2b522048d6f1191bf01b40b3eceef4adf722c01c8360b ql/lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 diff --git a/rust/.gitattributes b/rust/.gitattributes index 452ad07743e8..185c5170047c 100644 --- a/rust/.gitattributes +++ b/rust/.gitattributes @@ -1,7 +1,6 @@ /.generated.list linguist-generated /.gitattributes linguist-generated /ql/lib/codeql/rust/elements/Array.qll linguist-generated -/ql/lib/codeql/rust/elements/ArrayConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/AstNode.qll linguist-generated /ql/lib/codeql/rust/elements/AsyncBlock.qll linguist-generated /ql/lib/codeql/rust/elements/AsyncBlockConstructor.qll linguist-generated @@ -39,6 +38,8 @@ /ql/lib/codeql/rust/elements/DbLocation.qll linguist-generated /ql/lib/codeql/rust/elements/DbLocationConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Declaration.qll linguist-generated +/ql/lib/codeql/rust/elements/ElementList.qll linguist-generated +/ql/lib/codeql/rust/elements/ElementListConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Expr.qll linguist-generated /ql/lib/codeql/rust/elements/ExprStmt.qll linguist-generated /ql/lib/codeql/rust/elements/ExprStmtConstructor.qll linguist-generated @@ -98,6 +99,8 @@ /ql/lib/codeql/rust/elements/RefConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/RefPat.qll linguist-generated /ql/lib/codeql/rust/elements/RefPatConstructor.qll linguist-generated +/ql/lib/codeql/rust/elements/Repeat.qll linguist-generated +/ql/lib/codeql/rust/elements/RepeatConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/Return.qll linguist-generated /ql/lib/codeql/rust/elements/ReturnConstructor.qll linguist-generated /ql/lib/codeql/rust/elements/SlicePat.qll linguist-generated @@ -146,6 +149,7 @@ /ql/lib/codeql/rust/generated/DbLocation.qll linguist-generated /ql/lib/codeql/rust/generated/Declaration.qll linguist-generated /ql/lib/codeql/rust/generated/Element.qll linguist-generated +/ql/lib/codeql/rust/generated/ElementList.qll linguist-generated /ql/lib/codeql/rust/generated/Expr.qll linguist-generated /ql/lib/codeql/rust/generated/ExprStmt.qll linguist-generated /ql/lib/codeql/rust/generated/Field.qll linguist-generated @@ -183,6 +187,7 @@ /ql/lib/codeql/rust/generated/RecordPat.qll linguist-generated /ql/lib/codeql/rust/generated/Ref.qll linguist-generated /ql/lib/codeql/rust/generated/RefPat.qll linguist-generated +/ql/lib/codeql/rust/generated/Repeat.qll linguist-generated /ql/lib/codeql/rust/generated/Return.qll linguist-generated /ql/lib/codeql/rust/generated/SlicePat.qll linguist-generated /ql/lib/codeql/rust/generated/Stmt.qll linguist-generated diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 352b198c122d..e7b84607c298 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -105,25 +105,6 @@ impl TrapEntry for TypeRef { } } -#[derive(Debug)] -pub struct Array { - pub id: TrapId, - pub location: Option, -} - -impl TrapEntry for Array { - fn extract_id(&mut self) -> TrapId { - std::mem::replace(&mut self.id, TrapId::Star) - } - - fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("arrays", vec![trap::Arg::Label(id)]); - if let Some(v) = self.location { - out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); - } - } -} - #[derive(Debug)] pub struct Await { pub id: TrapId, @@ -1325,6 +1306,54 @@ impl TrapEntry for Block { } } +#[derive(Debug)] +pub struct ElementList { + pub id: TrapId, + pub location: Option, + pub elements: Vec, + pub is_assignee_expr: bool, +} + +impl TrapEntry for ElementList { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("element_lists", vec![trap::Arg::Label(id)]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.elements.iter().enumerate() { + out.add_tuple("element_list_elements", vec![trap::Arg::Label(id), i.into(), v.into()]); + } + if self.is_assignee_expr { + out.add_tuple("element_list_is_assignee_expr", vec![trap::Arg::Label(id)]); + } + } +} + +#[derive(Debug)] +pub struct Repeat { + pub id: TrapId, + pub location: Option, + pub initializer: trap::Label, + pub repeat: trap::Label, +} + +impl TrapEntry for Repeat { + fn extract_id(&mut self) -> TrapId { + std::mem::replace(&mut self.id, TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("repeats", vec![trap::Arg::Label(id), self.initializer.into(), self.repeat.into()]); + if let Some(v) = self.location { + out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); + } + } +} + #[derive(Debug)] pub struct UnsafeBlock { pub id: TrapId, diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index 4e40e539d2a3..9d3611a4a281 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -25,6 +25,7 @@ import codeql.rust.elements.DbFile import codeql.rust.elements.DbLocation import codeql.rust.elements.Declaration import codeql.rust.elements.Element +import codeql.rust.elements.ElementList import codeql.rust.elements.Expr import codeql.rust.elements.ExprStmt import codeql.rust.elements.Field @@ -59,6 +60,7 @@ import codeql.rust.elements.RecordLit import codeql.rust.elements.RecordPat import codeql.rust.elements.Ref import codeql.rust.elements.RefPat +import codeql.rust.elements.Repeat import codeql.rust.elements.Return import codeql.rust.elements.SlicePat import codeql.rust.elements.Stmt diff --git a/rust/ql/lib/codeql/rust/elements/ElementList.qll b/rust/ql/lib/codeql/rust/elements/ElementList.qll new file mode 100644 index 000000000000..e49c08de07ce --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ElementList.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `ElementList`. + */ + +private import codeql.rust.generated.ElementList + +class ElementList extends Generated::ElementList { } diff --git a/rust/ql/lib/codeql/rust/elements/ElementListConstructor.qll b/rust/ql/lib/codeql/rust/elements/ElementListConstructor.qll new file mode 100644 index 000000000000..9c3bd8cd4be9 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/ElementListConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `ElementList` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.generated.Raw + +/** + * The characteristic predicate of `ElementList` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructElementList(Raw::ElementList id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/Repeat.qll b/rust/ql/lib/codeql/rust/elements/Repeat.qll new file mode 100644 index 000000000000..8a54e8e9b043 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/Repeat.qll @@ -0,0 +1,8 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module provides a hand-modifiable wrapper around the generated class `Repeat`. + */ + +private import codeql.rust.generated.Repeat + +class Repeat extends Generated::Repeat { } diff --git a/rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll b/rust/ql/lib/codeql/rust/elements/RepeatConstructor.qll similarity index 63% rename from rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll rename to rust/ql/lib/codeql/rust/elements/RepeatConstructor.qll index 9264e5d1c813..34275bf73289 100644 --- a/rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll +++ b/rust/ql/lib/codeql/rust/elements/RepeatConstructor.qll @@ -1,14 +1,14 @@ // generated by codegen, remove this comment if you wish to edit this file /** * This module defines the hook used internally to tweak the characteristic predicate of - * `Array` synthesized instances. + * `Repeat` synthesized instances. * INTERNAL: Do not use. */ private import codeql.rust.generated.Raw /** - * The characteristic predicate of `Array` synthesized instances. + * The characteristic predicate of `Repeat` synthesized instances. * INTERNAL: Do not use. */ -predicate constructArray(Raw::Array id) { any() } +predicate constructRepeat(Raw::Repeat id) { any() } diff --git a/rust/ql/lib/codeql/rust/generated/Array.qll b/rust/ql/lib/codeql/rust/generated/Array.qll index d085e276ef03..b13f939f1def 100644 --- a/rust/ql/lib/codeql/rust/generated/Array.qll +++ b/rust/ql/lib/codeql/rust/generated/Array.qll @@ -17,7 +17,5 @@ module Generated { * INTERNAL: Do not reference the `Generated::Array` class directly. * Use the subclass `Array`, where the following predicates are available. */ - class Array extends Synth::TArray, Expr { - override string getAPrimaryQlClass() { result = "Array" } - } + class Array extends Synth::TArray, Expr { } } diff --git a/rust/ql/lib/codeql/rust/generated/ElementList.qll b/rust/ql/lib/codeql/rust/generated/ElementList.qll new file mode 100644 index 000000000000..471a1aec1600 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/ElementList.qll @@ -0,0 +1,51 @@ +// generated by codegen +/** + * This module provides the generated definition of `ElementList`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Array +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `ElementList` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::ElementList` class directly. + * Use the subclass `ElementList`, where the following predicates are available. + */ + class ElementList extends Synth::TElementList, Array { + override string getAPrimaryQlClass() { result = "ElementList" } + + /** + * Gets the `index`th element of this element list (0-based). + */ + Expr getElement(int index) { + result = + Synth::convertExprFromRaw(Synth::convertElementListToRaw(this) + .(Raw::ElementList) + .getElement(index)) + } + + /** + * Gets any of the elements of this element list. + */ + final Expr getAnElement() { result = this.getElement(_) } + + /** + * Gets the number of elements of this element list. + */ + final int getNumberOfElements() { result = count(int i | exists(this.getElement(i))) } + + /** + * Holds if this element list is assignee expression. + */ + predicate isAssigneeExpr() { + Synth::convertElementListToRaw(this).(Raw::ElementList).isAssigneeExpr() + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/generated/ParentChild.qll index f8b7fff1ee4a..024159809e2a 100644 --- a/rust/ql/lib/codeql/rust/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/generated/ParentChild.qll @@ -925,6 +925,34 @@ private module Impl { ) } + private Element getImmediateChildOfElementList( + ElementList e, int index, string partialPredicateCall + ) { + exists(int b, int bArray, int n | + b = 0 and + bArray = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfArray(e, i, _)) | i) and + n = bArray and + ( + none() + or + result = getImmediateChildOfArray(e, index - b, partialPredicateCall) + ) + ) + } + + private Element getImmediateChildOfRepeat(Repeat e, int index, string partialPredicateCall) { + exists(int b, int bArray, int n | + b = 0 and + bArray = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfArray(e, i, _)) | i) and + n = bArray and + ( + none() + or + result = getImmediateChildOfArray(e, index - b, partialPredicateCall) + ) + ) + } + private Element getImmediateChildOfUnsafeBlock( UnsafeBlock e, int index, string partialPredicateCall ) { @@ -960,8 +988,6 @@ private module Impl { or result = getImmediateChildOfTypeRef(e, index, partialAccessor) or - result = getImmediateChildOfArray(e, index, partialAccessor) - or result = getImmediateChildOfAwait(e, index, partialAccessor) or result = getImmediateChildOfBecome(e, index, partialAccessor) @@ -1066,6 +1092,10 @@ private module Impl { or result = getImmediateChildOfBlock(e, index, partialAccessor) or + result = getImmediateChildOfElementList(e, index, partialAccessor) + or + result = getImmediateChildOfRepeat(e, index, partialAccessor) + or result = getImmediateChildOfUnsafeBlock(e, index, partialAccessor) } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 6cb53bb133f7..9081f063d36a 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -143,9 +143,7 @@ module Raw { /** * INTERNAL: Do not use. */ - class Array extends @array, Expr { - override string toString() { result = "Array" } - } + class Array extends @array, Expr { } /** * INTERNAL: Do not use. @@ -901,6 +899,40 @@ module Raw { Label getLabel() { block_labels(this, result) } } + /** + * INTERNAL: Do not use. + */ + class ElementList extends @element_list, Array { + override string toString() { result = "ElementList" } + + /** + * Gets the `index`th element of this element list (0-based). + */ + Expr getElement(int index) { element_list_elements(this, index, result) } + + /** + * Holds if this element list is assignee expression. + */ + predicate isAssigneeExpr() { element_list_is_assignee_expr(this) } + } + + /** + * INTERNAL: Do not use. + */ + class Repeat extends @repeat, Array { + override string toString() { result = "Repeat" } + + /** + * Gets the initializer of this repeat. + */ + Expr getInitializer() { repeats(this, result, _) } + + /** + * Gets the repeat of this repeat. + */ + Expr getRepeat() { repeats(this, _, result) } + } + /** * INTERNAL: Do not use. */ diff --git a/rust/ql/lib/codeql/rust/generated/Repeat.qll b/rust/ql/lib/codeql/rust/generated/Repeat.qll new file mode 100644 index 000000000000..bde1c6fc18c2 --- /dev/null +++ b/rust/ql/lib/codeql/rust/generated/Repeat.qll @@ -0,0 +1,39 @@ +// generated by codegen +/** + * This module provides the generated definition of `Repeat`. + * INTERNAL: Do not import directly. + */ + +private import codeql.rust.generated.Synth +private import codeql.rust.generated.Raw +import codeql.rust.elements.Array +import codeql.rust.elements.Expr + +/** + * INTERNAL: This module contains the fully generated definition of `Repeat` and should not + * be referenced directly. + */ +module Generated { + /** + * INTERNAL: Do not reference the `Generated::Repeat` class directly. + * Use the subclass `Repeat`, where the following predicates are available. + */ + class Repeat extends Synth::TRepeat, Array { + override string getAPrimaryQlClass() { result = "Repeat" } + + /** + * Gets the initializer of this repeat. + */ + Expr getInitializer() { + result = + Synth::convertExprFromRaw(Synth::convertRepeatToRaw(this).(Raw::Repeat).getInitializer()) + } + + /** + * Gets the repeat of this repeat. + */ + Expr getRepeat() { + result = Synth::convertExprFromRaw(Synth::convertRepeatToRaw(this).(Raw::Repeat).getRepeat()) + } + } +} diff --git a/rust/ql/lib/codeql/rust/generated/Synth.qll b/rust/ql/lib/codeql/rust/generated/Synth.qll index 5be4c04731f6..fa57fee327ef 100644 --- a/rust/ql/lib/codeql/rust/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/generated/Synth.qll @@ -15,10 +15,6 @@ module Synth { */ cached newtype TElement = - /** - * INTERNAL: Do not use. - */ - TArray(Raw::Array id) { constructArray(id) } or /** * INTERNAL: Do not use. */ @@ -87,6 +83,10 @@ module Synth { * INTERNAL: Do not use. */ TDbLocation(Raw::DbLocation id) { constructDbLocation(id) } or + /** + * INTERNAL: Do not use. + */ + TElementList(Raw::ElementList id) { constructElementList(id) } or /** * INTERNAL: Do not use. */ @@ -203,6 +203,10 @@ module Synth { * INTERNAL: Do not use. */ TRefPat(Raw::RefPat id) { constructRefPat(id) } or + /** + * INTERNAL: Do not use. + */ + TRepeat(Raw::Repeat id) { constructRepeat(id) } or /** * INTERNAL: Do not use. */ @@ -260,6 +264,11 @@ module Synth { */ TYield(Raw::Yield id) { constructYield(id) } + /** + * INTERNAL: Do not use. + */ + class TArray = TElementList or TRepeat; + /** * INTERNAL: Do not use. */ @@ -312,13 +321,6 @@ module Synth { */ class TStmt = TExprStmt or TIfLet or TItemStmt; - /** - * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TArray`, if possible. - */ - cached - TArray convertArrayFromRaw(Raw::Element e) { result = TArray(e) } - /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TAsyncBlock`, if possible. @@ -438,6 +440,13 @@ module Synth { cached TDbLocation convertDbLocationFromRaw(Raw::Element e) { result = TDbLocation(e) } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TElementList`, if possible. + */ + cached + TElementList convertElementListFromRaw(Raw::Element e) { result = TElementList(e) } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TExprStmt`, if possible. @@ -641,6 +650,13 @@ module Synth { cached TRefPat convertRefPatFromRaw(Raw::Element e) { result = TRefPat(e) } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TRepeat`, if possible. + */ + cached + TRepeat convertRepeatFromRaw(Raw::Element e) { result = TRepeat(e) } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TReturn`, if possible. @@ -739,6 +755,17 @@ module Synth { cached TYield convertYieldFromRaw(Raw::Element e) { result = TYield(e) } + /** + * INTERNAL: Do not use. + * Converts a raw DB element to a synthesized `TArray`, if possible. + */ + cached + TArray convertArrayFromRaw(Raw::Element e) { + result = convertElementListFromRaw(e) + or + result = convertRepeatFromRaw(e) + } + /** * INTERNAL: Do not use. * Converts a raw DB element to a synthesized `TAstNode`, if possible. @@ -947,13 +974,6 @@ module Synth { result = convertItemStmtFromRaw(e) } - /** - * INTERNAL: Do not use. - * Converts a synthesized `TArray` to a raw DB element, if possible. - */ - cached - Raw::Element convertArrayToRaw(TArray e) { e = TArray(result) } - /** * INTERNAL: Do not use. * Converts a synthesized `TAsyncBlock` to a raw DB element, if possible. @@ -1073,6 +1093,13 @@ module Synth { cached Raw::Element convertDbLocationToRaw(TDbLocation e) { e = TDbLocation(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TElementList` to a raw DB element, if possible. + */ + cached + Raw::Element convertElementListToRaw(TElementList e) { e = TElementList(result) } + /** * INTERNAL: Do not use. * Converts a synthesized `TExprStmt` to a raw DB element, if possible. @@ -1276,6 +1303,13 @@ module Synth { cached Raw::Element convertRefPatToRaw(TRefPat e) { e = TRefPat(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TRepeat` to a raw DB element, if possible. + */ + cached + Raw::Element convertRepeatToRaw(TRepeat e) { e = TRepeat(result) } + /** * INTERNAL: Do not use. * Converts a synthesized `TReturn` to a raw DB element, if possible. @@ -1374,6 +1408,17 @@ module Synth { cached Raw::Element convertYieldToRaw(TYield e) { e = TYield(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TArray` to a raw DB element, if possible. + */ + cached + Raw::Element convertArrayToRaw(TArray e) { + result = convertElementListToRaw(e) + or + result = convertRepeatToRaw(e) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TAstNode` to a raw DB element, if possible. diff --git a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll index fc138db745ec..9a8fe8464e91 100644 --- a/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/generated/SynthConstructors.qll @@ -3,7 +3,6 @@ * This module exports all modules providing `Element` subclasses. */ -import codeql.rust.elements.ArrayConstructor import codeql.rust.elements.AsyncBlockConstructor import codeql.rust.elements.AwaitConstructor import codeql.rust.elements.BecomeConstructor @@ -21,6 +20,7 @@ import codeql.rust.elements.ConstBlockPatConstructor import codeql.rust.elements.ContinueConstructor import codeql.rust.elements.DbFileConstructor import codeql.rust.elements.DbLocationConstructor +import codeql.rust.elements.ElementListConstructor import codeql.rust.elements.ExprStmtConstructor import codeql.rust.elements.FieldConstructor import codeql.rust.elements.FunctionConstructor @@ -50,6 +50,7 @@ import codeql.rust.elements.RecordLitConstructor import codeql.rust.elements.RecordPatConstructor import codeql.rust.elements.RefConstructor import codeql.rust.elements.RefPatConstructor +import codeql.rust.elements.RepeatConstructor import codeql.rust.elements.ReturnConstructor import codeql.rust.elements.SlicePatConstructor import codeql.rust.elements.TupleConstructor diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index de4cb37ed96f..4b2efeffd680 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -154,9 +154,10 @@ type_refs( unique int id: @type_ref ); -arrays( - unique int id: @array -); +@array = + @element_list +| @repeat +; awaits( unique int id: @await, @@ -662,6 +663,28 @@ block_labels( int label: @label ref ); +element_lists( + unique int id: @element_list +); + +#keyset[id, index] +element_list_elements( + int id: @element_list ref, + int index: int ref, + int element: @expr ref +); + +#keyset[id] +element_list_is_assignee_expr( + int id: @element_list ref +); + +repeats( + unique int id: @repeat, + int initializer: @expr ref, + int repeat: @expr ref +); + unsafe_blocks( unique int id: @unsafe_block ); diff --git a/rust/schema.py b/rust/schema.py index 8b9066717058..7e084e82dcfd 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -425,6 +425,20 @@ class Array(Expr): pass # Literal(Literal), +# ElementList { elements: Box<[ExprId]>, is_assignee_expr: bool }, + + +class ElementList(Array): + elements: list[Expr] + is_assignee_expr: predicate + +# Repeat { initializer: ExprId, repeat: ExprId }, + + +class Repeat(Array): + initializer: Expr + repeat: Expr + class Literal(Expr): pass From 406d03edfca6bd1ae5166bf4166c77cd99dbc523 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 18:40:03 +0200 Subject: [PATCH 11/13] Rename IfLet::else_branch to IfLet::else_ --- rust/.generated.list | 4 ++-- rust/extractor/src/generated/top.rs | 6 +++--- rust/ql/lib/codeql/rust/generated/IfLet.qll | 11 +++++------ rust/ql/lib/codeql/rust/generated/Raw.qll | 4 ++-- rust/ql/lib/rust.dbscheme | 4 ++-- rust/schema.py | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/rust/.generated.list b/rust/.generated.list index 6c863a05d737..2497fc211278 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -154,7 +154,7 @@ ql/lib/codeql/rust/generated/Field.qll c3249b8dd1aed1978077875fbd6090327d431af8c ql/lib/codeql/rust/generated/File.qll 2eff5c882d044d2e360fe6382fb55e5a45f6ccb9df323cfa1fae41eae9d2a47f 87e7a906b3a1b4de056952e288ddd7f69fa7cb1bd9dc7dd3972868a9002ac1e4 ql/lib/codeql/rust/generated/Function.qll 8d5607035adebdb5f1a80ac2688b57ca751bfc010295e4982e6a432d402fc523 337d5aebc38e4413b8a87af87ea91219a51a46d1a04dd8f124b6431dba034a67 ql/lib/codeql/rust/generated/If.qll b8040f4bdc6ca2db2cf0435edd9aca432d1ba5f36170f5588a7746f0e4174c51 6033f72ff2d0d3b640b0ef8399d8ef39bc1eec33242a1567cd7dc5ccd2463797 -ql/lib/codeql/rust/generated/IfLet.qll 0f51d1f708282a622d075e635698b2020b7d21e77abad6ea12516af13edb5d06 1b9f9c058c888f77a225025b984145a886928caaad26f20e869d9f8a0f5843b4 +ql/lib/codeql/rust/generated/IfLet.qll 8a1b4c0d60cd89093c75d97a225691fa6044fdf6828a14fbf9ead7c9d2445f54 b00937d2507e575403074712cd84298b78d0cc0a1dcf7be65e8c893b2b729724 ql/lib/codeql/rust/generated/Index.qll f1b78db475006a0779a079f9600987932e638bcfaf35ce4e9b2b872798e35d50 7fa2b22497c3bd80161f7e3ef5477c82a0d4f961dce557ed3fd1a62d9f9328f7 ql/lib/codeql/rust/generated/InlineAsm.qll 18d8e206d226779d45c27c83e59fdf21ea4fe55969a9d4edf2e91e58877b5d35 723a4d0293a1df9be124b6aae340cb2814e4be0dc01dec95d001e6f986e0e84c ql/lib/codeql/rust/generated/ItemStmt.qll b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa b4d2a06fdd00ea90eed2742bacf0a5781b8ad69e24df794ec075d7305220afaa @@ -180,7 +180,7 @@ ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 0ca064561f7375659dc2b84ca8881d4f39b85880c9efb7802377787fb58e2052 ad925674e73d113b4d33c8b4fd556770bfbcf9d0ab180dbf0253c61c123bfec7 +ql/lib/codeql/rust/generated/Raw.qll 621a8078377cf5574a9e32c162b8c33211cc3105767c013f3b9609ef9f97d24a f3cffaf0cccbcbb007e47a2a8c49882b510f99b131f44d029d990a2d11a7f5f3 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index e7b84607c298..3665e84ea346 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -508,7 +508,7 @@ pub struct IfLet { pub pat: trap::Label, pub type_ref: Option, pub initializer: Option, - pub else_branch: Option, + pub else_: Option, } impl TrapEntry for IfLet { @@ -527,8 +527,8 @@ impl TrapEntry for IfLet { if let Some(v) = self.initializer { out.add_tuple("if_let_initializers", vec![trap::Arg::Label(id), v.into()]); } - if let Some(v) = self.else_branch { - out.add_tuple("if_let_else_branches", vec![trap::Arg::Label(id), v.into()]); + if let Some(v) = self.else_ { + out.add_tuple("if_let_elses", vec![trap::Arg::Label(id), v.into()]); } } } diff --git a/rust/ql/lib/codeql/rust/generated/IfLet.qll b/rust/ql/lib/codeql/rust/generated/IfLet.qll index 31cbc5afb9c9..1e0007b9bd85 100644 --- a/rust/ql/lib/codeql/rust/generated/IfLet.qll +++ b/rust/ql/lib/codeql/rust/generated/IfLet.qll @@ -57,16 +57,15 @@ module Generated { final predicate hasInitializer() { exists(this.getInitializer()) } /** - * Gets the else branch of this if let, if it exists. + * Gets the else of this if let, if it exists. */ - Expr getElseBranch() { - result = - Synth::convertExprFromRaw(Synth::convertIfLetToRaw(this).(Raw::IfLet).getElseBranch()) + Expr getElse() { + result = Synth::convertExprFromRaw(Synth::convertIfLetToRaw(this).(Raw::IfLet).getElse()) } /** - * Holds if `getElseBranch()` exists. + * Holds if `getElse()` exists. */ - final predicate hasElseBranch() { exists(this.getElseBranch()) } + final predicate hasElse() { exists(this.getElse()) } } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index 9081f063d36a..b38ab9c79cfe 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -461,9 +461,9 @@ module Raw { Expr getInitializer() { if_let_initializers(this, result) } /** - * Gets the else branch of this if let, if it exists. + * Gets the else of this if let, if it exists. */ - Expr getElseBranch() { if_let_else_branches(this, result) } + Expr getElse() { if_let_elses(this, result) } } /** diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 4b2efeffd680..41cf29ab65ed 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -361,9 +361,9 @@ if_let_initializers( ); #keyset[id] -if_let_else_branches( +if_let_elses( int id: @if_let ref, - int else_branch: @expr ref + int else: @expr ref ); indices( diff --git a/rust/schema.py b/rust/schema.py index 7e084e82dcfd..f1faccd334fa 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -472,7 +472,7 @@ class IfLet(Stmt): pat: Pat type_ref: optional[TypeRef] initializer: optional[Expr] - else_branch: optional[Expr] + else_: optional[Expr] # Expr { # expr: ExprId, # has_semi: bool, From 1a9b2329f4f70cf7c3a4179309080a07e9602b68 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Fri, 6 Sep 2024 19:27:35 +0200 Subject: [PATCH 12/13] Add SlicePat::{slice, suffix} --- rust/.generated.list | 6 ++-- rust/extractor/src/generated/top.rs | 8 +++++ rust/ql/lib/codeql/rust/generated/Raw.qll | 10 ++++++ .../ql/lib/codeql/rust/generated/SlicePat.qll | 31 +++++++++++++++++++ rust/ql/lib/rust.dbscheme | 13 ++++++++ rust/schema.py | 2 ++ 6 files changed, 67 insertions(+), 3 deletions(-) diff --git a/rust/.generated.list b/rust/.generated.list index 2497fc211278..3d507077bf70 100644 --- a/rust/.generated.list +++ b/rust/.generated.list @@ -173,21 +173,21 @@ ql/lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a2568 ql/lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62 ql/lib/codeql/rust/generated/OffsetOf.qll c5c7218a0dfa6636a4b3e4218969638cc267db94a966b19fbced0ba6f85dbd0e 6c8fac4cd343073ee0ed48498deb7faa65a876776d9ca0a98e51350fead5c8ac ql/lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398 -ql/lib/codeql/rust/generated/ParentChild.qll 1e2638cdf3cec4dd0a40e1fc61b9e739381f710429252acb80428ca21d270211 5bcc7154e175e4c96b61b47a681b569950612ec168b7ca3ec7368642c3ad3c9d +ql/lib/codeql/rust/generated/ParentChild.qll 2edf7c0be4bbb2ffcd8133db21850fabf8e87badf7b4595d1bab258d68da3626 5bcc7154e175e4c96b61b47a681b569950612ec168b7ca3ec7368642c3ad3c9d ql/lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7 ql/lib/codeql/rust/generated/Path.qll ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ca8878cd96c31ad9238a1d52487e094863d5abba825d189e0ea6f8d674194b75 ql/lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 ql/lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 ql/lib/codeql/rust/generated/Range.qll 6278d78c7fba390f51b107892262f9c679c8a31695861a64268e9b74c9575e46 2cb49b0d5d4281c10bdd7ddf187f144cd8490cd792218e977c4108ba98883e06 ql/lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4 -ql/lib/codeql/rust/generated/Raw.qll 621a8078377cf5574a9e32c162b8c33211cc3105767c013f3b9609ef9f97d24a f3cffaf0cccbcbb007e47a2a8c49882b510f99b131f44d029d990a2d11a7f5f3 +ql/lib/codeql/rust/generated/Raw.qll b090d09ae3b69a4f52ab85d6cf8da686b307b98c9764e1d72528765cec71d4b6 76fd1384804dabcef984c4513183786b9f13806dc025b25e0dfd235944a648a3 ql/lib/codeql/rust/generated/RecordLit.qll ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ae3c644237abab89e0443dfcf584906a9714792be755ce3f9fcdae5958024243 ql/lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 ql/lib/codeql/rust/generated/Ref.qll d26cc357f65fb51a5c07863406f732debe3dc02542b415b281ec582efa08a362 9d62dd9a99e158abc7b42c4e011a5dd0db4dfbce25ab6fe5c600354c18a236bd ql/lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb50a9f2bf62e49bf182d64b6d 804efbd32869f92e5515d34852fed6416288f99b0aab95b5be5cb5bdd1eea806 ql/lib/codeql/rust/generated/Repeat.qll ba4a6b643a6d16924b138a1a585fe059d8d094592fa49329e4061ee18c31abc5 4be73736804193d127f968fa6cef1a264753d079f325d8724d258f16df1f3286 ql/lib/codeql/rust/generated/Return.qll 9664cd51675a9a6ddfe7795b79f491c3834588e0bbc3b25863c621486f46a5f7 b38067c9bbcb0c4a4d2b59d76e81afcca7bc1b72caea91c1a79a7b7526390511 -ql/lib/codeql/rust/generated/SlicePat.qll f013be99f2c287e1d97aac95e72010c1e0a95a5efef90fde10e22a828345cac5 3a9c56d4e13f3b6a8e677586912f5a9b1e090b543911c31be33947479b0e9533 +ql/lib/codeql/rust/generated/SlicePat.qll b4de6692eebf1205940e04da963adc20a07b15923c3c3a7a512a24e3bd8342c9 ee9b919983807f39d97cfe8ca66b76bdbfde76db02db5c93268ce22cbddf4213 ql/lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd ql/lib/codeql/rust/generated/Synth.qll cf37698f44ca6786d3067ab9bc2501664988903cdfe5265aa78838727caca966 1d06d446f064da7e11fb7779030be0f00e5e10a3618e4148c50c0932a090632a ql/lib/codeql/rust/generated/SynthConstructors.qll cf79523cb4d14dfcc92c7531e024a966139c99efc170cb86f2035b595c1d5bfd cf79523cb4d14dfcc92c7531e024a966139c99efc170cb86f2035b595c1d5bfd diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 3665e84ea346..5c87cfb118fe 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -1052,6 +1052,8 @@ pub struct SlicePat { pub id: TrapId, pub location: Option, pub prefix: Vec, + pub slice: Option, + pub suffix: Vec, } impl TrapEntry for SlicePat { @@ -1067,6 +1069,12 @@ impl TrapEntry for SlicePat { for (i, &v) in self.prefix.iter().enumerate() { out.add_tuple("slice_pat_prefixes", vec![trap::Arg::Label(id), i.into(), v.into()]); } + if let Some(v) = self.slice { + out.add_tuple("slice_pat_slice", vec![trap::Arg::Label(id), v.into()]); + } + for (i, &v) in self.suffix.iter().enumerate() { + out.add_tuple("slice_pat_suffixes", vec![trap::Arg::Label(id), i.into(), v.into()]); + } } } diff --git a/rust/ql/lib/codeql/rust/generated/Raw.qll b/rust/ql/lib/codeql/rust/generated/Raw.qll index b38ab9c79cfe..2e474c32c6c2 100644 --- a/rust/ql/lib/codeql/rust/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/generated/Raw.qll @@ -782,6 +782,16 @@ module Raw { * Gets the `index`th prefix of this slice pat (0-based). */ Pat getPrefix(int index) { slice_pat_prefixes(this, index, result) } + + /** + * Gets the slice of this slice pat, if it exists. + */ + Pat getSlice() { slice_pat_slice(this, result) } + + /** + * Gets the `index`th suffix of this slice pat (0-based). + */ + Pat getSuffix(int index) { slice_pat_suffixes(this, index, result) } } /** diff --git a/rust/ql/lib/codeql/rust/generated/SlicePat.qll b/rust/ql/lib/codeql/rust/generated/SlicePat.qll index a85ad23a25cf..272be5951670 100644 --- a/rust/ql/lib/codeql/rust/generated/SlicePat.qll +++ b/rust/ql/lib/codeql/rust/generated/SlicePat.qll @@ -37,5 +37,36 @@ module Generated { * Gets the number of prefixes of this slice pat. */ final int getNumberOfPrefixes() { result = count(int i | exists(this.getPrefix(i))) } + + /** + * Gets the slice of this slice pat, if it exists. + */ + Pat getSlice() { + result = + Synth::convertPatFromRaw(Synth::convertSlicePatToRaw(this).(Raw::SlicePat).getSlice()) + } + + /** + * Holds if `getSlice()` exists. + */ + final predicate hasSlice() { exists(this.getSlice()) } + + /** + * Gets the `index`th suffix of this slice pat (0-based). + */ + Pat getSuffix(int index) { + result = + Synth::convertPatFromRaw(Synth::convertSlicePatToRaw(this).(Raw::SlicePat).getSuffix(index)) + } + + /** + * Gets any of the suffixes of this slice pat. + */ + final Pat getASuffix() { result = this.getSuffix(_) } + + /** + * Gets the number of suffixes of this slice pat. + */ + final int getNumberOfSuffixes() { result = count(int i | exists(this.getSuffix(i))) } } } diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index 41cf29ab65ed..c650de784b0e 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -578,6 +578,19 @@ slice_pat_prefixes( int prefix: @pat ref ); +#keyset[id] +slice_pat_slice( + int id: @slice_pat ref, + int slice: @pat ref +); + +#keyset[id, index] +slice_pat_suffixes( + int id: @slice_pat ref, + int index: int ref, + int suffix: @pat ref +); + tuples( unique int id: @tuple ); diff --git a/rust/schema.py b/rust/schema.py index f1faccd334fa..33fb8e5d3567 100644 --- a/rust/schema.py +++ b/rust/schema.py @@ -531,6 +531,8 @@ class RangePat(Pat): class SlicePat(Pat): prefix: list[Pat] + slice: optional[Pat] + suffix: list[Pat] # Path(Box), From c8f73587ccdfe7e72db038024a650859622c232f Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Sat, 7 Sep 2024 10:32:59 +0200 Subject: [PATCH 13/13] Rust: codegen: fix generated code --- misc/codegen/templates/rust_classes.mustache | 4 +-- rust/extractor/src/generated/top.rs | 34 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/misc/codegen/templates/rust_classes.mustache b/misc/codegen/templates/rust_classes.mustache index 946fb512a378..7e9e0bf9179d 100644 --- a/misc/codegen/templates/rust_classes.mustache +++ b/misc/codegen/templates/rust_classes.mustache @@ -35,12 +35,12 @@ impl TrapEntry for {{name}} { {{/is_repeated}} {{/is_optional}} {{#is_repeated}} - for (i, &v) in self.{{field_name}}.iter().enumerate() { + for (i, v) in self.{{field_name}}.into_iter().enumerate() { {{^is_optional}} out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]); {{/is_optional}} {{#is_optional}} - if let Some(vv) = v { + if let Some(v) = v { out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]); } {{/is_optional}} diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 5c87cfb118fe..38b47da6d947 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -280,7 +280,7 @@ impl TrapEntry for Call { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.args.iter().enumerate() { + for (i, v) in self.args.into_iter().enumerate() { out.add_tuple("call_args", vec![trap::Arg::Label(id), i.into(), v.into()]); } if self.is_assignee_expr { @@ -331,11 +331,11 @@ impl TrapEntry for Closure { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.args.iter().enumerate() { + for (i, v) in self.args.into_iter().enumerate() { out.add_tuple("closure_args", vec![trap::Arg::Label(id), i.into(), v.into()]); } - for (i, &v) in self.arg_types.iter().enumerate() { - if let Some(vv) = v { + for (i, v) in self.arg_types.into_iter().enumerate() { + if let Some(v) = v { out.add_tuple("closure_arg_types", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -699,7 +699,7 @@ impl TrapEntry for Match { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.branches.iter().enumerate() { + for (i, v) in self.branches.into_iter().enumerate() { out.add_tuple("match_branches", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -724,7 +724,7 @@ impl TrapEntry for MethodCall { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.args.iter().enumerate() { + for (i, v) in self.args.into_iter().enumerate() { out.add_tuple("method_call_args", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -785,7 +785,7 @@ impl TrapEntry for Module { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.declarations.iter().enumerate() { + for (i, v) in self.declarations.into_iter().enumerate() { out.add_tuple("module_declarations", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -809,7 +809,7 @@ impl TrapEntry for OffsetOf { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.fields.iter().enumerate() { + for (i, v) in self.fields.into_iter().enumerate() { out.add_tuple("offset_of_fields", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -832,7 +832,7 @@ impl TrapEntry for OrPat { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.args.iter().enumerate() { + for (i, v) in self.args.into_iter().enumerate() { out.add_tuple("or_pat_args", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -1066,13 +1066,13 @@ impl TrapEntry for SlicePat { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.prefix.iter().enumerate() { + for (i, v) in self.prefix.into_iter().enumerate() { out.add_tuple("slice_pat_prefixes", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.slice { out.add_tuple("slice_pat_slice", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.suffix.iter().enumerate() { + for (i, v) in self.suffix.into_iter().enumerate() { out.add_tuple("slice_pat_suffixes", vec![trap::Arg::Label(id), i.into(), v.into()]); } } @@ -1096,7 +1096,7 @@ impl TrapEntry for Tuple { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.exprs.iter().enumerate() { + for (i, v) in self.exprs.into_iter().enumerate() { out.add_tuple("tuple_exprs", vec![trap::Arg::Label(id), i.into(), v.into()]); } if self.is_assignee_expr { @@ -1123,7 +1123,7 @@ impl TrapEntry for TuplePat { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.args.iter().enumerate() { + for (i, v) in self.args.into_iter().enumerate() { out.add_tuple("tuple_pat_args", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.ellipsis { @@ -1274,7 +1274,7 @@ impl TrapEntry for AsyncBlock { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.statements.iter().enumerate() { + for (i, v) in self.statements.into_iter().enumerate() { out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.tail { @@ -1302,7 +1302,7 @@ impl TrapEntry for Block { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.statements.iter().enumerate() { + for (i, v) in self.statements.into_iter().enumerate() { out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.tail { @@ -1332,7 +1332,7 @@ impl TrapEntry for ElementList { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.elements.iter().enumerate() { + for (i, v) in self.elements.into_iter().enumerate() { out.add_tuple("element_list_elements", vec![trap::Arg::Label(id), i.into(), v.into()]); } if self.is_assignee_expr { @@ -1380,7 +1380,7 @@ impl TrapEntry for UnsafeBlock { if let Some(v) = self.location { out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]); } - for (i, &v) in self.statements.iter().enumerate() { + for (i, v) in self.statements.into_iter().enumerate() { out.add_tuple("block_base_statements", vec![trap::Arg::Label(id), i.into(), v.into()]); } if let Some(v) = self.tail {