CodeQL library for Rust
codeql/rust-all 0.1.11 (changelog, source)
Search

Module rust

Top-level import for the Rust language pack

Import path

import rust

Classes

ArithmeticOperation

An arithmetic operation, such as +, *=, or -.

AssignArithmeticOperation

An arithmetic assignment operation, such as += or *=.

AssignBitwiseOperation

A bitwise assignment operation, such as |= or <<=.

AssignmentExpr

An assignment expression, for example: rust x = y;

AssignmentOperation

An assignment operation, for example: rust x = y; x += y;

AsyncBlockExpr

An async block expression. For example: rust async { let x = 42; }

BinaryArithmeticOperation

A binary arithmetic operation, such as + or *.

BinaryBitwiseOperation

A binary bitwise operation, such as & or <<.

BinaryLogicalOperation

A binary logical operation, such as && or ||.

BitwiseOperation

A bitwise operation, such as &, <<, or |=.

ComparisonOperation

A comparison operation, such as ==, <, or >=.

CompoundAssignmentExpr

A compound assignment expression, for example: rust x += y;

DerefExpr

A dereference expression, the prefix operator *.

EqualityOperation

An equality comparison operation, == or !=.

EqualsOperation

The equal comparison operation, ==.

ExtractedFile

A source file that was extracted.

File

A file.

GreaterOrEqualsOperation

The greater than or equal comparison operation, >=.

GreaterThanOperation

The greater than comparison operation, >.

LessOrEqualsOperation

The less than or equal comparison operation, <=.

LessThanOperation

The less than comparison operation, <.

LogicalAndExpr

The logical “and” operation, &&.

LogicalNotExpr

A logical “not” operation, !.

LogicalOperation

A logical operation, such as &&, || or !.

LogicalOrExpr

The logical “or” operation, ||.

NotEqualsOperation

The not equal comparison operation, !=.

PrefixArithmeticOperation

A prefix arithmetic operation, such as -.

RelationalOperation

A relational comparison operation, that is, one of <=, <, >, or >=.

SuccessfullyExtractedFile

A successfully extracted file, that is, a file that was extracted and contains no extraction errors or warnings.

UnaryLogicalOperation

A unary logical operation, such as !.

Aliases

Abi

An ABI specification for an extern function or block.

Addressable

Something that can be addressed by a path.

Adt

An ADT (Abstract Data Type) definition, such as Struct, Enum, or Union.

ArgList

A list of arguments in a function or method call.

ArrayExpr

The base class for array expressions. For example: rust [1, 2, 3]; [1; 10];

ArrayListExpr

An array expression with a list of elements. For example: rust [1, 2, 3];

ArrayRepeatExpr

An array expression with a repeat operand and a repeat length. For example: rust [1; 10];

ArrayTypeRepr

An array type representation.

AsmClobberAbi

A clobbered ABI in an inline assembly block.

AsmConst

A constant operand in an inline assembly block.

AsmDirSpec

An inline assembly direction specifier.

AsmExpr

An inline assembly expression. For example: rust unsafe { #[inline(always)] builtin # asm("cmp {0}, {1}", in(reg) a, in(reg) b); }

AsmLabel

A label in an inline assembly block.

AsmOperand
AsmOperandExpr

An operand expression in an inline assembly block.

AsmOperandNamed

A named operand in an inline assembly block.

AsmOption

An option in an inline assembly block.

AsmOptionsList

A list of options in an inline assembly block.

AsmPiece
AsmRegOperand

A register operand in an inline assembly block.

AsmRegSpec

A register specification in an inline assembly block.

AsmSym

A symbol operand in an inline assembly block.

AssocItem

An associated item in a Trait or Impl.

AssocItemList

A list of AssocItem elements, as appearing in a Trait or Impl.

AssocTypeArg

An associated type argument in a path.

AstNode
Attr

An attribute applied to an item.

AwaitExpr

An await expression. For example: rust async { let x = foo().await; x }

BecomeExpr

A become expression. For example: rust fn fact_a(n: i32, a: i32) -> i32 { if n == 0 { a } else { become fact_a(n - 1, n * a) } }

BinaryExpr

A binary operation expression. For example: rust x + y; x && y; x <= y; x = y; x += y;

BlockExpr

A block expression. For example: rust { let x = 42; } rust 'label: { let x = 42; x }

BooleanLiteralExpr

A Boolean literal. Either true or false.

BoxPat

A box pattern. For example: rust match x { box Option::Some(y) => y, box Option::None => 0, };

BreakExpr

A break expression. For example: rust loop { if not_ready() { break; } } rust let x = 'label: loop { if done() { break 'label 42; } }; rust let x = 'label: { if exit() { break 'label 42; } 0; };

CallExpr

A function call expression. For example: rust foo(42); foo::<u32, u64>(42); foo[0](42); foo(1) = 4;

CallExprBase

A function or method call expression. See CallExpr and MethodCallExpr for further details.

Callable

A callable. Either a Function or a ClosureExpr.

CastExpr

A type cast expression. For example: rust value as u64;

CharLiteralExpr

A [character literal][1]. For example:

ClosureBinder

A closure binder, specifying lifetime or type parameters for a closure.

ClosureExpr

A closure expression. For example: rust |x| x + 1; move |x: i32| -> i32 { x + 1 }; async |x: i32, y| x + y; #[coroutine] |x| yield x; #[coroutine] static |x| yield x;

Comment

A comment. For example: rust // this is a comment /// This is a doc comment

Const

A constant item declaration.

ConstArg

A constant argument in a generic argument list.

ConstBlockPat

A const block pattern. For example: rust match x { const { 1 + 2 + 3 } => "ok", _ => "fail", };

ConstParam

A constant parameter in a generic parameter list.

Container

A file or folder.

ContinueExpr

A continue expression. For example: rust loop { if not_ready() { continue; } } rust 'label: loop { if not_ready() { continue 'label; } }

Crate

A Crate. For example: rust todo!()

DynTraitTypeRepr

A dynamic trait object type.

Element
EmptyLocation

An entity representing an empty location.

Enum

An enum declaration.

Expr

The base class for expressions.

ExprStmt

An expression statement. For example: rust start(); finish(); use std::env;

ExternBlock

An extern block containing foreign function declarations.

ExternCrate

An extern crate declaration.

ExternItem

An item inside an extern block.

ExternItemList

A list of items inside an extern block.

FieldExpr

A field access expression. For example: rust x.foo

FieldList

A list of fields in a struct or enum variant.

FloatLiteralExpr

A [floating-point literal][1]. For example:

FnPtrTypeRepr

A function pointer type.

Folder

A folder.

Folder

Provides logic related to Folders.

ForExpr

A for loop expression.

ForTypeRepr

A higher-ranked trait bound.

Format

A format element in a formatting template. For example the {} in: rust println!("Hello {}", "world"); or the {value:#width$.precision$} in: rust println!("Value {value:#width$.precision$}");

FormatArgsArg

A FormatArgsArg. For example the "world" in: rust format_args!("Hello, {}!", "world")

FormatArgsExpr

A FormatArgsExpr. For example: rust format_args!("no args"); format_args!("{} foo {:?}", 1, 2); format_args!("{b} foo {a:?}", a=1, b=2); let (x, y) = (1, 42); format_args!("{x}, {y}");

FormatArgument

An argument in a format element in a formatting template. For example the width, precision, and value in: rust println!("Value {value:#width$.precision$}"); or the 0, 1 and 2 in: rust println!("Value {0:#1$.2$}", value, width, precision);

FormatTemplateVariableAccess
Function

A function declaration. For example rust fn foo(x: u32) -> u64 {(x + 1).into()} A function declaration within a trait might not have a body: rust trait Trait { fn bar(); }

GenericArg

A generic argument in a generic argument list.

GenericArgList

The base class for generic arguments. rust x.foo::<u32, u64>(42);

GenericParam

A generic parameter in a generic parameter list.

GenericParamList

A list of generic parameters. For example: rust fn f<A, B>(a: A, b: B) {} // ^^^^^^ type Foo<T1, T2> = (T1, T2); // ^^^^^^^^

IdentPat

A binding pattern. For example: rust match x { Option::Some(y) => y, Option::None => 0, }; rust match x { y@Option::Some(_) => y, Option::None => 0, };

IfExpr

An if expression. For example: rust if x == 42 { println!("that's the answer"); } rust let y = if x > 0 { 1 } else { 0 };

Impl

An `impl`` block.

ImplTraitTypeRepr

An impl Trait type.

IndexExpr

An index expression. For example: rust list[42]; list[42] = 1;

InferTypeRepr

An inferred type (_).

IntegerLiteralExpr

An [integer literal][1]. For example:

Item

An item such as a function, struct, enum, etc.

ItemList

A list of items in a module or block.

Label

A label. For example: rust 'label: loop { println!("Hello, world (once)!"); break 'label; };

LabelableExpr

The base class for expressions that can be labeled (LoopExpr, ForExpr, WhileExpr or BlockExpr).

LetElse

An else block in a let-else statement.

LetExpr

A let expression. For example: rust if let Some(x) = maybe_some { println!("{}", x); }

LetStmt

A let statement. For example: rust let x = 42; let x: i32 = 42; let x: i32; let x; let (x, y) = (1, 2); let Some(x) = std::env::var("FOO") else { return; };

Lifetime

A lifetime annotation.

LifetimeArg

A lifetime argument in a generic argument list.

LifetimeParam

A lifetime parameter in a generic parameter list.

LiteralExpr

A literal expression. For example: rust 42; 42.0; "Hello, world!"; b"Hello, world!"; 'x'; b'x'; r"Hello, world!"; true;

LiteralPat

A literal pattern. For example: rust match x { 42 => "ok", _ => "fail", }

Locatable
Location

A location as given by a file, a start line, a start column, an end line, and an end column.

LoopExpr

A loop expression. For example: rust loop { println!("Hello, world (again)!"); }; rust 'label: loop { println!("Hello, world (once)!"); break 'label; }; rust let mut x = 0; loop { if x < 10 { x += 1; } else { break; } };

LoopingExpr

The base class for expressions that loop (LoopExpr, ForExpr or WhileExpr).

MacroBlockExpr

A sequence of statements generated by a MacroCall. For example: rust fn main() { println!("Hello, world!"); // This macro expands into a list of statements }

MacroCall

A macro invocation.

MacroDef

A Rust 2.0 style declarative macro definition.

MacroExpr

A macro expression, representing the invocation of a macro that produces an expression.

MacroItems

A sequence of items generated by a macro. For example:

MacroPat

A macro pattern, representing the invocation of a macro that produces a pattern.

MacroRules

A macro definition using the macro_rules! syntax. rust macro_rules! my_macro { () => { println!("This is a macro!"); }; }

MacroTypeRepr

A type produced by a macro.

MatchArm

A match arm. For example: rust match x { Option::Some(y) => y, Option::None => 0, }; rust match x { Some(y) if y != 0 => 1 / y, _ => 0, };

MatchArmList

A list of arms in a match expression.

MatchExpr

A match expression. For example: rust match x { Option::Some(y) => y, Option::None => 0, } rust match x { Some(y) if y != 0 => 1 / y, _ => 0, }

MatchGuard

A guard condition in a match arm.

Meta

A meta item in an attribute.

MethodCallExpr

A method call expression. For example: rust x.foo(42); x.foo::<u32, u64>(42);

Missing

The base class marking errors during parsing or resolution.

Module

A module declaration. For example: rust mod foo; rust mod bar { pub fn baz() {} }

Name

An identifier name.

NameRef

A reference to a name.

NamedCrate

INTERNAL: Do not use.

NamedFormatArgument

A named FormatArgument. For example name in rust let name = "Alice"; println!("{name} in wonderland");

NeverTypeRepr

The never type !.

NumberLiteralExpr

A number literal.

OffsetOfExpr

An offset_of expression. For example: rust builtin # offset_of(Struct, field);

Operation

An operation, for example &&, +=, ! or *.

OrPat

An or pattern. For example: rust match x { Option::Some(y) | Option::None => 0, }

Param

A parameter in a function or method. For example x in: rust fn new(x: T) -> Foo<T> { // ... }

ParamBase

A normal parameter, Param, or a self parameter SelfParam.

ParamList

A list of parameters in a function, method, or closure declaration.

ParenExpr

A parenthesized expression.

ParenPat

A parenthesized pattern.

ParenTypeRepr

A parenthesized type.

ParenthesizedArgList

A parenthesized argument list as used in function traits.

Pat

The base class for patterns.

Path

A path. For example: rust use some_crate::some_module::some_item; foo::bar;

PathAstNode

An AST element wrapping a path (PathExpr, RecordExpr, PathPat, RecordPat, TupleStructPat).

PathExpr

A path expression. For example: rust let x = variable; let x = foo::bar; let y = <T>::foo; let z = <TypeRepr as Trait>::foo;

PathExprBase

A path expression or a variable access in a formatting template. See PathExpr and FormatTemplateVariableAccess for further details.

PathPat

A path pattern. For example: rust match x { Foo::Bar => "ok", _ => "fail", }

PathSegment

A path segment, which is one part of a whole path. For example: - HashMap - HashMap<K, V> - Fn(i32) -> i32 - widgets(..) - <T as Iterator>

PathTypeRepr

A path referring to a type. For example: rust type X = std::collections::HashMap<i32, i32>; type Y = X::Item;

PositionalFormatArgument

A positional FormatArgument. For example 0 in rust let name = "Alice"; println!("{0} in wonderland", name);

PrefixExpr

A unary operation expression. For example: rust let x = -42; let y = !true; let z = *ptr;

PtrTypeRepr

A pointer type.

RangeExpr

A range expression. For example: rust let x = 1..=10; let x = 1..10; let x = 10..; let x = ..10; let x = ..=10; let x = ..;

RangePat

A range pattern. For example: rust match x { ..15 => "too cold", 16..=25 => "just right", 26.. => "too hot", }

RefExpr

A reference expression. For example: rust let ref_const = &foo; let ref_mut = &mut foo; let raw_const: &mut i32 = &raw const foo; let raw_mut: &mut i32 = &raw mut foo;

RefPat

A reference pattern. For example: rust match x { &mut Option::Some(y) => y, &Option::None => 0, };

RefTypeRepr

A reference type.

Rename

A rename in a use declaration.

Resolvable

One of PathExpr, RecordExpr, PathPat, RecordPat, TupleStructPat or MethodCallExpr.

RestPat

A rest pattern (..) in a tuple, slice, or struct pattern.

RetTypeRepr

A return type in a function signature.

ReturnExpr

A return expression. For example: rust fn some_value() -> i32 { return 42; } rust fn no_value() -> () { return; }

ReturnTypeSyntax

A return type notation (..) to reference or bound the type returned by a trait method

SelfParam

A self parameter. For example self in: rust struct X; impl X { fn one(&self) {} fn two(&mut self) {} fn three(self) {} fn four(mut self) {} fn five<'a>(&'a self) {} }

SlicePat

A slice pattern. For example: rust match x { [1, 2, 3, 4, 5] => "ok", [1, 2, ..] => "fail", [x, y, .., z, 7] => "fail", }

SliceTypeRepr

A slice type.

SourceFile

A source file.

Static

A static item declaration.

Stmt

The base class for statements.

StmtList

A list of statements in a block.

StringLiteralExpr

A [string literal][1]. For example:

Struct

A Struct. For example: rust struct Point { x: i32, y: i32, }

StructExpr

A struct expression. For example: rust let first = Foo { a: 1, b: 2 }; let second = Foo { a: 2, ..first }; Foo { a: 1, b: 2 }[2] = 10; Foo { .. } = second;

StructExprField

A field in a struct expression. For example a: 1 in: rust Foo { a: 1, b: 2 };

StructExprFieldList

A list of fields in a struct expression.

StructField

A field in a struct declaration.

StructFieldList

A list of fields in a struct declaration.

StructPat

A struct pattern. For example: rust match x { Foo { a: 1, b: 2 } => "ok", Foo { .. } => "fail", }

StructPatField

A field in a struct pattern. For example a: 1 in: rust let Foo { a: 1, b: 2 } = foo;

StructPatFieldList

A list of fields in a struct pattern.

Token

The base class for all tokens.

TokenTree

A token tree in a macro definition or invocation.

Trait

A Trait. For example:

TraitAlias

A trait alias.

TryExpr

A try expression using the ? operator.

TupleExpr

A tuple expression. For example: rust (1, "one"); (2, "two")[0] = 3;

TupleField

A field in a tuple struct or tuple enum variant.

TupleFieldList

A list of fields in a tuple struct or tuple enum variant.

TuplePat

A tuple pattern. For example: rust let (x, y) = (1, 2); let (a, b, .., z) = (1, 2, 3, 4, 5);

TupleStructPat

A tuple struct pattern. For example: rust match x { Tuple("a", 1, 2, 3) => "great", Tuple(.., 3) => "fine", Tuple(..) => "fail", };

TupleTypeRepr

A tuple type.

TypeAlias

A type alias. For example:

TypeArg

A type argument in a generic argument list.

TypeBound

A type bound in a trait or generic parameter.

TypeBoundList

A list of type bounds.

TypeParam

A type parameter in a generic parameter list.

TypeRepr

The base class for type references. rust let x: i32; let y: Vec<i32>; let z: Option<i32>;

UnderscoreExpr

An underscore expression. For example: rust _ = 42;

Unextracted

The base class marking everything that was not properly extracted for some reason, such as: * syntax errors * insufficient context information * yet unimplemented parts of the extractor

Unimplemented

The base class for unimplemented nodes. This is used to mark nodes that are not yet extracted.

Union

A union declaration.

Use

A use statement. For example: rust use std::collections::HashMap;

UseBoundGenericArg
UseBoundGenericArgs

A use<..> bound to control which generic parameters are captured by an impl Trait return type.

UseTree

A use tree, that is, the part after the use keyword in a use statement. For example: rust use std::collections::HashMap; use std::collections::*; use std::collections::HashMap as MyHashMap; use std::collections::{self, HashMap, HashSet};

UseTreeList

A list of use trees in a use declaration.

Variable

A variable.

VariableAccess

A variable access.

VariableReadAccess

A variable read.

VariableWriteAccess

A variable write.

Variant

A variant in an enum declaration.

VariantList

A list of variants in an enum declaration.

Visibility

A visibility modifier.

WhereClause

A where clause in a generic declaration.

WherePred

A predicate in a where clause.

WhileExpr

A while loop expression.

WildcardPat

A wildcard pattern. For example: rust let _ = 42;

YeetExpr

A yeet expression. For example: rust if x < size { do yeet "index out of bounds"; }

YieldExpr

A yield expression. For example: rust let one = #[coroutine] || { yield 1; };