Rust: fix QL compilation errors

This commit is contained in:
Paolo Tranquilli
2024-11-29 15:55:51 +01:00
parent 9cf2420c3b
commit c46f44da5f
45 changed files with 855 additions and 843 deletions

View File

@@ -1,2 +1,2 @@
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
top.rs 8db75515b09f6c96beb8c2895e7495350e76557d01399de5faf6c314a45ce594 8db75515b09f6c96beb8c2895e7495350e76557d01399de5faf6c314a45ce594
top.rs 4b7dc25409974b210c908c4a15d5b69d242c07305e6e78c9dfe0fa434c22e2bd 4b7dc25409974b210c908c4a15d5b69d242c07305e6e78c9dfe0fa434c22e2bd

View File

@@ -6055,6 +6055,51 @@ impl From<trap::Label<ParenType>> for trap::Label<TypeRef> {
}
}
#[derive(Debug)]
pub struct PathAstNode {
_unused: ()
}
impl trap::TrapClass for PathAstNode {
fn class_name() -> &'static str { "PathAstNode" }
}
impl From<trap::Label<PathAstNode>> for trap::Label<AstNode> {
fn from(value: trap::Label<PathAstNode>) -> Self {
// SAFETY: this is safe because in the dbscheme PathAstNode is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathAstNode>> for trap::Label<Element> {
fn from(value: trap::Label<PathAstNode>) -> Self {
// SAFETY: this is safe because in the dbscheme PathAstNode is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathAstNode>> for trap::Label<Locatable> {
fn from(value: trap::Label<PathAstNode>) -> Self {
// SAFETY: this is safe because in the dbscheme PathAstNode is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathAstNode>> for trap::Label<Resolvable> {
fn from(value: trap::Label<PathAstNode>) -> Self {
// SAFETY: this is safe because in the dbscheme PathAstNode is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct PathExprBase {
_unused: ()
@@ -6100,83 +6145,6 @@ impl From<trap::Label<PathExprBase>> for trap::Label<Locatable> {
}
}
impl From<trap::Label<PathExprBase>> for trap::Label<Resolvable> {
fn from(value: trap::Label<PathExprBase>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct PathPat {
pub id: trap::TrapId<PathPat>,
pub path: Option<trap::Label<Path>>,
}
impl trap::TrapEntry for PathPat {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("path_pats", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("path_pat_paths", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for PathPat {
fn class_name() -> &'static str { "PathPat" }
}
impl From<trap::Label<PathPat>> for trap::Label<AstNode> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Element> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Locatable> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Pat> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Pat
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Resolvable> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct PathType {
pub id: trap::TrapId<PathType>,
@@ -6508,78 +6476,6 @@ impl From<trap::Label<RangePat>> for trap::Label<Pat> {
}
}
#[derive(Debug)]
pub struct RecordExpr {
pub id: trap::TrapId<RecordExpr>,
pub path: Option<trap::Label<Path>>,
pub record_expr_field_list: Option<trap::Label<RecordExprFieldList>>,
}
impl trap::TrapEntry for RecordExpr {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("record_exprs", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("record_expr_paths", vec![id.into(), v.into()]);
}
if let Some(v) = self.record_expr_field_list {
out.add_tuple("record_expr_record_expr_field_lists", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for RecordExpr {
fn class_name() -> &'static str { "RecordExpr" }
}
impl From<trap::Label<RecordExpr>> for trap::Label<AstNode> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Element> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Expr> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Expr
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Locatable> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Resolvable> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct RecordFieldList {
pub id: trap::TrapId<RecordFieldList>,
@@ -6639,78 +6535,6 @@ impl From<trap::Label<RecordFieldList>> for trap::Label<Locatable> {
}
}
#[derive(Debug)]
pub struct RecordPat {
pub id: trap::TrapId<RecordPat>,
pub path: Option<trap::Label<Path>>,
pub record_pat_field_list: Option<trap::Label<RecordPatFieldList>>,
}
impl trap::TrapEntry for RecordPat {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("record_pats", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("record_pat_paths", vec![id.into(), v.into()]);
}
if let Some(v) = self.record_pat_field_list {
out.add_tuple("record_pat_record_pat_field_lists", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for RecordPat {
fn class_name() -> &'static str { "RecordPat" }
}
impl From<trap::Label<RecordPat>> for trap::Label<AstNode> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Element> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Locatable> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Pat> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Pat
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Resolvable> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct RefExpr {
pub id: trap::TrapId<RefExpr>,
@@ -7475,78 +7299,6 @@ impl From<trap::Label<TuplePat>> for trap::Label<Pat> {
}
}
#[derive(Debug)]
pub struct TupleStructPat {
pub id: trap::TrapId<TupleStructPat>,
pub fields: Vec<trap::Label<Pat>>,
pub path: Option<trap::Label<Path>>,
}
impl trap::TrapEntry for TupleStructPat {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("tuple_struct_pats", vec![id.into()]);
for (i, v) in self.fields.into_iter().enumerate() {
out.add_tuple("tuple_struct_pat_fields", vec![id.into(), i.into(), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("tuple_struct_pat_paths", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for TupleStructPat {
fn class_name() -> &'static str { "TupleStructPat" }
}
impl From<trap::Label<TupleStructPat>> for trap::Label<AstNode> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Element> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Locatable> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Pat> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Pat
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Resolvable> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct TupleType {
pub id: trap::TrapId<TupleType>,
@@ -9411,8 +9163,8 @@ impl From<trap::Label<Module>> for trap::Label<Stmt> {
#[derive(Debug)]
pub struct PathExpr {
pub id: trap::TrapId<PathExpr>,
pub attrs: Vec<trap::Label<Attr>>,
pub path: Option<trap::Label<Path>>,
pub attrs: Vec<trap::Label<Attr>>,
}
impl trap::TrapEntry for PathExpr {
@@ -9422,12 +9174,12 @@ impl trap::TrapEntry for PathExpr {
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("path_exprs", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("path_ast_node_paths", vec![id.into(), v.into()]);
}
for (i, v) in self.attrs.into_iter().enumerate() {
out.add_tuple("path_expr_attrs", vec![id.into(), i.into(), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("path_expr_paths", vec![id.into(), v.into()]);
}
}
}
@@ -9471,6 +9223,15 @@ impl From<trap::Label<PathExpr>> for trap::Label<Locatable> {
}
}
impl From<trap::Label<PathExpr>> for trap::Label<PathAstNode> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of PathAstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathExpr>> for trap::Label<PathExprBase> {
fn from(value: trap::Label<PathExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of PathExprBase
@@ -9489,6 +9250,245 @@ impl From<trap::Label<PathExpr>> for trap::Label<Resolvable> {
}
}
#[derive(Debug)]
pub struct PathPat {
pub id: trap::TrapId<PathPat>,
pub path: Option<trap::Label<Path>>,
}
impl trap::TrapEntry for PathPat {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("path_pats", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("path_ast_node_paths", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for PathPat {
fn class_name() -> &'static str { "PathPat" }
}
impl From<trap::Label<PathPat>> for trap::Label<AstNode> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Element> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Locatable> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Pat> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Pat
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<PathAstNode> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of PathAstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<PathPat>> for trap::Label<Resolvable> {
fn from(value: trap::Label<PathPat>) -> Self {
// SAFETY: this is safe because in the dbscheme PathPat is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct RecordExpr {
pub id: trap::TrapId<RecordExpr>,
pub path: Option<trap::Label<Path>>,
pub record_expr_field_list: Option<trap::Label<RecordExprFieldList>>,
}
impl trap::TrapEntry for RecordExpr {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("record_exprs", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("path_ast_node_paths", vec![id.into(), v.into()]);
}
if let Some(v) = self.record_expr_field_list {
out.add_tuple("record_expr_record_expr_field_lists", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for RecordExpr {
fn class_name() -> &'static str { "RecordExpr" }
}
impl From<trap::Label<RecordExpr>> for trap::Label<AstNode> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Element> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Expr> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Expr
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Locatable> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<PathAstNode> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of PathAstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordExpr>> for trap::Label<Resolvable> {
fn from(value: trap::Label<RecordExpr>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordExpr is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct RecordPat {
pub id: trap::TrapId<RecordPat>,
pub path: Option<trap::Label<Path>>,
pub record_pat_field_list: Option<trap::Label<RecordPatFieldList>>,
}
impl trap::TrapEntry for RecordPat {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("record_pats", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("path_ast_node_paths", vec![id.into(), v.into()]);
}
if let Some(v) = self.record_pat_field_list {
out.add_tuple("record_pat_record_pat_field_lists", vec![id.into(), v.into()]);
}
}
}
impl trap::TrapClass for RecordPat {
fn class_name() -> &'static str { "RecordPat" }
}
impl From<trap::Label<RecordPat>> for trap::Label<AstNode> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Element> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Locatable> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Pat> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Pat
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<PathAstNode> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of PathAstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<RecordPat>> for trap::Label<Resolvable> {
fn from(value: trap::Label<RecordPat>) -> Self {
// SAFETY: this is safe because in the dbscheme RecordPat is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct Static {
pub id: trap::TrapId<Static>,
@@ -9902,6 +9902,87 @@ impl From<trap::Label<TraitAlias>> for trap::Label<Stmt> {
}
}
#[derive(Debug)]
pub struct TupleStructPat {
pub id: trap::TrapId<TupleStructPat>,
pub path: Option<trap::Label<Path>>,
pub fields: Vec<trap::Label<Pat>>,
}
impl trap::TrapEntry for TupleStructPat {
fn extract_id(&mut self) -> trap::TrapId<Self> {
std::mem::replace(&mut self.id, trap::TrapId::Star)
}
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
out.add_tuple("tuple_struct_pats", vec![id.into()]);
if let Some(v) = self.path {
out.add_tuple("path_ast_node_paths", vec![id.into(), v.into()]);
}
for (i, v) in self.fields.into_iter().enumerate() {
out.add_tuple("tuple_struct_pat_fields", vec![id.into(), i.into(), v.into()]);
}
}
}
impl trap::TrapClass for TupleStructPat {
fn class_name() -> &'static str { "TupleStructPat" }
}
impl From<trap::Label<TupleStructPat>> for trap::Label<AstNode> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of AstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Element> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Element
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Locatable> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Locatable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Pat> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Pat
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<PathAstNode> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of PathAstNode
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
impl From<trap::Label<TupleStructPat>> for trap::Label<Resolvable> {
fn from(value: trap::Label<TupleStructPat>) -> Self {
// SAFETY: this is safe because in the dbscheme TupleStructPat is a subclass of Resolvable
unsafe {
Self::from_untyped(value.as_untyped())
}
}
}
#[derive(Debug)]
pub struct TypeAlias {
pub id: trap::TrapId<TypeAlias>,

View File

@@ -1,4 +1,4 @@
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll a8e083c7d8c4dea6459c5e128e2123f5cf8fd14c076f2256ebda508c13d553cd 16fcc0d34097b0b37a0041281515ca028d2702eec6d9c1d03c39a1158883bdef
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll 7411cdfc2c93ad1e70afd41edb6ba098e2bc9db77213850936a48d07b9f716c4 f2dd71fd4fd8a98681f1d931d04b28a01d6eb3987ab56aa4425e2c57316c81f6
lib/codeql/rust/elements/Abi.qll 4c973d28b6d628f5959d1f1cc793704572fd0acaae9a97dfce82ff9d73f73476 250f68350180af080f904cd34cb2af481c5c688dc93edf7365fd0ae99855e893
lib/codeql/rust/elements/Addressable.qll 13011bfd2e1556694c3d440cc34af8527da4df49ad92b62f2939d3699ff2cea5 ddb25935f7553a1a384b1abe2e4b4fa90ab50b952dadec32fd867afcb054f4be
lib/codeql/rust/elements/ArgList.qll 661f5100f5d3ef8351452d9058b663a2a5c720eea8cf11bedd628969741486a2 28e424aac01a90fb58cd6f9f83c7e4cf379eea39e636bc0ba07efc818be71c71
@@ -102,28 +102,29 @@ lib/codeql/rust/elements/ParenPat.qll 40d033de6c85ad042223e0da80479adebab3549439
lib/codeql/rust/elements/ParenType.qll e1f5695b143c97b98ccdb460a5cf872461cfc13b83a4f005f26c288dc0afae10 1164f8efae7f255925411bddb33939fab0bf1c07955a16fef173b3f4675d09ae
lib/codeql/rust/elements/Pat.qll 56211c5cb4709e7c12a2bfd2da5e413a451672d99e23a8386c08ad0b999fd45c b1b1893a13a75c4f0390f7e2a14ee98a46f067cfdc991a8d43adc82497d20aff
lib/codeql/rust/elements/Path.qll 16264a9c978a3027f623530e386a9ad16541305b252fed5e1bedcfbe1d6475d5 8c21063c7f344ce686342e7c12542fec05004e364681f7a31b65f5ee9263a46d
lib/codeql/rust/elements/PathExpr.qll 906df1d80c662b79f1b0b0428c39754b7f8dbcb2234919dd45dd8206a099dd36 1d6015afab6378c926c5838c9a5772cfcfeedf474e2eeca3e46085300ff8d4e1
lib/codeql/rust/elements/PathExprBase.qll db8702a2e2cec7c1daaad38649c27b657759103ca451dfa9d34b9be873fdc0af d770e983fb55e06f3fcee6b7511cf5d4ed4c4f6a18d8b1d1f14553cdbe8666df
lib/codeql/rust/elements/PathPat.qll 9d0b29b964bfe3a90af4c9930868a3d2046d2210a1575f9b9af84f6fd3fccbab 21748a5bd01d5531c846e6b7c1cc9fddf4adc0c959843e668df200a2490a5f94
lib/codeql/rust/elements/PathAstNode.qll c5c8627caaf863089d4d6004e206b2e62bc466db2ed5da9f3f443bf3dc29faf9 01107b1ce17cbee08a764962fb13d3f02edbd10675fa5bd89e089f03075ba443
lib/codeql/rust/elements/PathExpr.qll 803309419841293a640e0b2f0bf5b5bcdf00dd46d275797d4bc51c2fe651c944 083cd7768a03ac11a9d892ca190334d465d183f66509613c2e87c52b36c6df7c
lib/codeql/rust/elements/PathExprBase.qll bb41092ec690ae926e3233c215dcaf1fd8e161b8a6955151949f492e02dba13a b2257072f8062d31c29c63ee1311b07e0d2eb37075f582cfc76bb542ef773198
lib/codeql/rust/elements/PathPat.qll a7069d1dd77ba66814d6c84e135ed2975d7fcf379624079e6a76dc44b5de832e 2294d524b65ab0d038094b2a00f73feb8ab70c8f49fb4d91e9d390073205631d
lib/codeql/rust/elements/PathSegment.qll 9560551cf8b65e84705e7f302e12b48330e048613129e87c0f65a7eb297a6cc3 3aa75a5fd81f8ea32bd2b4bf0c51c386de57cbe9ab035fe3ec68ad7fcf51b375
lib/codeql/rust/elements/PathType.qll 257ede178bb74ebdb8e266ebaa95082e7fb7cc8d921ef476f4df268ee8a1366c c48f6e04a8945a11f965e71819f68c00abc53a055042882b61716feda3ca63ae
lib/codeql/rust/elements/PrefixExpr.qll 107e7bd111b637fd6d76026062d54c2780760b965f172ef119c50dd0714a377d 46954a9404e561c51682395729daac3bda5442113f29839d043e9605d63f7f6d
lib/codeql/rust/elements/PtrType.qll b137f47a53e41b3b30c7d80dbdd6724bf15f99530ca40cc264a04af5f07aa878 b2ffdf739bfb7564d942fe54409834a59511c0b305b6d5b2219a8ee0ef594332
lib/codeql/rust/elements/RangeExpr.qll 43785bea08a6a537010db1138e68ae92eed7e481744188dfb3bad119425ff740 5e81cfbdf4617372a73d662a248a0b380c1f40988a5daefb7f00057cae10d3d4
lib/codeql/rust/elements/RangePat.qll b5c0cfc84b8a767d58593fa7102dcf4be3ff8b02ba2f5360c384fa8af4aac830 cc28399dd99630bfa50c54e641a3833abe6643137d010a0a25749d1d70e8c911
lib/codeql/rust/elements/RecordExpr.qll d368aaf18319c0560c04d0438caf64b3b7aad3aa0cf4bbb643bfbb58d6d71091 44323e15b5a6fab187e846abe9cb530c6472ed673993c5e3679279b1286792da
lib/codeql/rust/elements/RecordExpr.qll b8541a33ef408f2070103c1db8b6ec845bc6b1d8c810f5d8d208e5eeb9f86b30 a6d9602a64c9acf48f033f06fe7e1d86382512fd378ee3044f1126726847f696
lib/codeql/rust/elements/RecordExprField.qll edac04146849e2aeca27e7bbb896c21aa2e2b15736b1e8a06ac51ab01433b3ac 7c062bd6d5dd5b1d972450fb0b3272cd9b45f94ccd668c3bd4347e2dce3279ed
lib/codeql/rust/elements/RecordExprFieldList.qll 672c3854cb84090c8a2e9311c43448016dc2614ecbf86dbe404156304674e38f 01ae0ffca0bf640c61120e36fcf2c560555f4aabbd49ddce6f5c1a3561dbfc31
lib/codeql/rust/elements/RecordField.qll 9c462033cc889756876cb3d2a07e4f0d9a67064cf188cdd68e08ab21e5edc459 437254bbf6537f1a575ae344c2e23ffad7138776db8f7ebf90026c13886a2638
lib/codeql/rust/elements/RecordFieldList.qll cebab3fba41221e61cda801070a7f414b62b4fbcf2206e35462c0da35ad75c3f db092d47eea871d61541b9711d7139a99394e0ed83901a8ae60f03dfa8ed722f
lib/codeql/rust/elements/RecordPat.qll bb21f25373afd03232f8e2977134b6a10ac525f0bd654bbf95713b964b99ba0f 28313e566c86d09ae3b60df538a3c7561f73c02b8ac93eaa5ff9914b2c9b241c
lib/codeql/rust/elements/RecordPat.qll 3e31af707f72e9af42142e54b7251da8cbc88a9d5f448a4e6b3ca578f92f5680 0b459d751c26a062608ef0b6f3859e9ed1342e129b004ec218694d011955cfbd
lib/codeql/rust/elements/RecordPatField.qll 7487461887e82bcf224b02628dfc64457121ab17e731e2dc7aa7e731ab16c02f f2018e55722245eb4273fb067242aaa503c43f91671a55b3a4bb51fe7bc0a03c
lib/codeql/rust/elements/RecordPatFieldList.qll c3198c997f389ce95db377ca40ac69a1448f120093f37ab1c92a5a3f1f6aa0d4 9db36d274f1ec77c442ae7e38f940a65c9a92f1541f66140188b226965851535
lib/codeql/rust/elements/RefExpr.qll 91a0d3a86002289dc01ffbe8daca13e34e92e522fbb508241a9d51faf1d4a9d2 b6e63d8e6f8956d2501706d129a6f5f24b410ea6539839757c76ba950c410582
lib/codeql/rust/elements/RefPat.qll fe076bdccb454111b38f360837d180274ba8a003b4cffe910b5197cd74188089 2604c8bb2b0b47091d5fc4aa276de46fe3561e346bd98f291c3783cef402ba06
lib/codeql/rust/elements/RefType.qll 5dc6012188d5baf36cd7bf0ebc127e28e98862a3f91ea4df2f9b9c962f3a395d ddb06ebe7fb92ad7bbe86cf182270e8494b74edf91b8c841aaf7ba932e5092ac
lib/codeql/rust/elements/Rename.qll 55fa06145f2160304caac0a5ce4cf6a496e41adfd66f44b3c0a1d23229ed8ce0 80262f0abf61749cdf0d5701637db359960f5404ad1dbfdd90f5048d2e7c315d
lib/codeql/rust/elements/Resolvable.qll 550d516d55b2c10e6e2afd0b9df7434448405ac8a84c4ded8b56fa1173612d32 0b59f31f411a14dd4eb0fe9df5483e4a00501a480bde6db9e6a499b9c0a57184
lib/codeql/rust/elements/Resolvable.qll efeec2b4b14d85334ec745b9a0c5aa6f7b9f86fe3caa45b005dccaee4f5265c4 7efe0063340ba61dd31125bc770773ca23a7067893c0d1e06d149da6e9a9ee92
lib/codeql/rust/elements/RestPat.qll a898a2c396f974a52424efbc8168174416ac6ed30f90d57c81646d2c08455794 db635ead3fa236e45bbd9955c714ff0abb1e57e1ce80d99dc5bb13438475adbf
lib/codeql/rust/elements/RetType.qll 36ea39240a56c504d94d5487ea9679563eef3dfe0e23bf42d992d1ab2b883518 2fe5b6f62a634c6aa30a1ecd620f3446c167669cf1285c8ef8dd5e5a6ef5fc71
lib/codeql/rust/elements/ReturnExpr.qll b87187cff55bc33c8c18558c9b88617179183d1341b322c1cab35ba07167bbdb 892f3a9df2187e745c869e67f33c228ee42754bc9e4f8f4c1718472eb8f8c80f
@@ -145,7 +146,7 @@ lib/codeql/rust/elements/TupleExpr.qll 561486554f0c397bc37c87894c56507771174bfb2
lib/codeql/rust/elements/TupleField.qll e58d024fc41519b559eef36cf6081d03a786b05357e4322e7046092131ea508f cad861b23fb4cdf2fbe90595de0e4776f1db9b69c3f3825221e475bc92895351
lib/codeql/rust/elements/TupleFieldList.qll 73397eef1cf8c18286b8f5bb12fbdc9bb75eee3b7bd64d149892952b79e498a3 13ac90f466ab22e5750af9e44aff9605b9e16f8350b4eaecff6a99e83d154e25
lib/codeql/rust/elements/TuplePat.qll 028cdea43868b0fdd2fc4c31ff25b6bbb40813e8aaccf72186051a280db7632e 38c56187971671e6a9dd0c6ccccb2ee4470aa82852110c6b89884496eb4abc64
lib/codeql/rust/elements/TupleStructPat.qll 743022ff471131aa58cd8ff131eef1568400da0ddefa5dbab1609a7ce00797d7 c6ddf777c3ee3a0f4d55c42f3af6a01e190a1e8892237c6e85c9ae65c84e39f3
lib/codeql/rust/elements/TupleStructPat.qll da398a23eb616bf7dd586b2a87f4ab00f28623418f081cd7b1cc3de497ef1819 6573bf3f8501c30af3aeb23d96db9f5bea7ab73e2b7ef3473095c03e96c20a5c
lib/codeql/rust/elements/TupleType.qll b5c798f7c9b08c8a6cc0a57fc5c36d714e70d5e955a9e87b6b309c18365d7596 ebea533ab126392344d080da1bc9efabcabb5397e93c9d213ffc71a61bb8d47c
lib/codeql/rust/elements/TypeAlias.qll 64780697f5869266345d040fdaee05c62b8670b9b5c6369692f9a9dc646986fc afcc7617d0e2e16d92d2a53c3e6661fd184bf5cf21b154f121dbf4d3b7ab30e6
lib/codeql/rust/elements/TypeArg.qll 39aea9a9f0b74e8b90e957dbc3ce593cbdb1d2e0d9320428ce2e9cbfcb772e53 f1f2612633de9f534faf76c368b6154a8dc20feb9297262fcb10a8f192aa2e02
@@ -301,6 +302,7 @@ lib/codeql/rust/elements/internal/ParenExprConstructor.qll 104b67dc3fd53ab52e2a4
lib/codeql/rust/elements/internal/ParenPatConstructor.qll 9aea3c3b677755177d85c63e20234c234f530a16db20ab699de05ca3f1b59787 29f24aed0d880629a53b30550467ade09a0a778dbf88891769c1e11b0b239f98
lib/codeql/rust/elements/internal/ParenTypeConstructor.qll d62e656a4a3c8ffd4eb87d49585a7a3bfb5dbe3826fbcbd11cb87b46f34c19ae febf6535965afa0f6eac4d2b08730f5a07bbb36a7434abe0a7663d7264961a3f
lib/codeql/rust/elements/internal/PatImpl.qll 37c9b1da7aa625117644e2cd74ec0b174f69a38cf66926add01786a05d5ad2ad 143685a0b4873fa0b73b204285dca956e59b32d527bfac6cc336326d244994b7
lib/codeql/rust/elements/internal/PathAstNodeImpl.qll 5a38c42a9127fc2071a9e8f0914996d8c3763e2708805de922e42771de50f649 ebe319cce565497071118cd4c291668bbcdf5fc8942c07efc5a10181b4ce5880
lib/codeql/rust/elements/internal/PathConstructor.qll 5c6354c28faf9f28f3efee8e19bdb82773adcf4b0c1a38788b06af25bcb6bc4a 3e2aeef7b6b9cda7f7f45a6c8119c98803aa644cf6a492cf0fce318eba40fe8f
lib/codeql/rust/elements/internal/PathExprBaseImpl.qll e8b09447ee41b4123f7d94c6b366b2602d8022c9644f1088c670c7794307ab2e 96b9b328771aaf19ba18d0591e85fcc915c0f930b2479b433de3bfdd2ea25249
lib/codeql/rust/elements/internal/PathExprConstructor.qll cf6e0a338a8ed2d1042bdee4c2c49be5827e8c572d8c56e828db265d39e59ae3 36a3d1b7c5cc2cf527616be787b32071b9e2a6613a4f6b3f82e2a3b0e02a516f
@@ -511,12 +513,13 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b
lib/codeql/rust/elements/internal/generated/ParenExpr.qll bc0731505bfe88516205ec360582a4222d2681d11342c93e15258590ddee82f2 d4bd6e0c80cf1d63746c88d4bcb3a01d4c75732e5da09e3ebd9437ced227fb60
lib/codeql/rust/elements/internal/generated/ParenPat.qll ce24b8f8ecbf0f204af200317405724063887257460c80cf250c39b2fdf37185 e7c87d37e1a0ca7ea03840017e1aa9ddb7f927f1f3b6396c0305b46aeee33db6
lib/codeql/rust/elements/internal/generated/ParenType.qll 9cc954d73f8330dcac7b475f97748b63af5c8766dee9d2f2872c0a7e4c903537 c07534c8a9c683c4a9b11d490095647e420de0a0bfc23273eaf6f31b00244273
lib/codeql/rust/elements/internal/generated/ParentChild.qll 03c1d8e0c0d0f7e34164f6ede37bdc744790fa25b252b5b34b006c48735daef6 7675198b227e5cb357cabe6a7622f461103e3829c0135560b37013c2a914edb2
lib/codeql/rust/elements/internal/generated/ParentChild.qll db8cf5d75d53414409fbe1c85865238a026164ea8225736f62de30f334079e1c d0d5bab0287122d754dcb50e6473d178405ba3e4d8e78a82764cbecf5cc6593c
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
lib/codeql/rust/elements/internal/generated/Path.qll bf6a86e7fcb7164624cc070dcce86d2bda50a2516b95115b87d0ebb5596e50a1 fd7a9ad4034cdebe8dfe495619c46f464630d38195313072e0bd904061b0fb00
lib/codeql/rust/elements/internal/generated/PathExpr.qll 2096e3c1db22ee488a761690adabfc9cfdea501c99f7c5d96c0019cb113fc506 54245ce0449c4e263173213df01e079d5168a758503a5dbd61b25ad35a311140
lib/codeql/rust/elements/internal/generated/PathExprBase.qll 696f580d56804c000983cd839671f0d0d573a9d3dbb151f500e4fe3bf900320b ebae99d1541e0d4e519599b2c5e4d734c20b7ed7ba1dbe1772f59ad7bb2c9f0f
lib/codeql/rust/elements/internal/generated/PathPat.qll 551864a9ba7d60b5662044578f0e12e6995c71710d75d8955eec2d7ab52e4d44 fedd7249e7f00229aa8632154fce2c6f1a37e017f9d4d53a5d309ba40e0c22a5
lib/codeql/rust/elements/internal/generated/PathAstNode.qll e6d4d5bffd3c623baaaee46bc183eb31ce88795535f164f6a9b9b4d98bbd6101 168db515404933479ba6b150c72e012d28592cbc32366aefcb1bf9599dbcd183
lib/codeql/rust/elements/internal/generated/PathExpr.qll 3c807f3b01ed24032d7d0e7a3a014452652945f86feeec963a31615084ad5721 3e5e2ea10cadb48c97aaf0fab756563c19039dcc7ec072e886ee5c7b5b06655d
lib/codeql/rust/elements/internal/generated/PathExprBase.qll d8218e201b8557fa6d9ca2c30b764e5ad9a04a2e4fb695cc7219bbd7636a6ac2 4ef178426d7095a156f4f8c459b4d16f63abc64336cb50a6cf883a5f7ee09113
lib/codeql/rust/elements/internal/generated/PathPat.qll 003d10a4d18681da67c7b20fcb16b15047cf9cc4b1723e7674ef74e40589cc5a 955e66f6d317ca5562ad1b5b13e1cd230c29e2538b8e86f072795b0fdd8a1c66
lib/codeql/rust/elements/internal/generated/PathSegment.qll 0fa07886deb0fc4d909d7edf691238a344f2739900aafb168cbac171eb1729a8 8f4bb418d8bea5e40128a87977c57d0a9183d06d111601ad93130c8615c11465
lib/codeql/rust/elements/internal/generated/PathType.qll df6fd322ba0d99d6cb315edce8dbf099b661b84fdfcc3ad629fdd1fd066c1986 e11c8615cd7b02034b47b58f30a7b6fcbc6d33ec53303288dfd34d9a25f5a186
lib/codeql/rust/elements/internal/generated/PrefixExpr.qll c9ede5f2deb7b41bc8240969e8554f645057018fe96e7e9ad9c2924c8b14722b 5ae2e3c3dc8fa73e7026ef6534185afa6b0b5051804435d8b741dd3640c864e1
@@ -524,20 +527,20 @@ lib/codeql/rust/elements/internal/generated/PtrType.qll 40099c5a4041314b66932dfd
lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll ea294a3ba33fd1bc632046c4fedbcb84dcb961a8e4599969d65893b19d90e590 ea294a3ba33fd1bc632046c4fedbcb84dcb961a8e4599969d65893b19d90e590
lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9
lib/codeql/rust/elements/internal/generated/RangePat.qll efd93730de217cf50dcba5875595263a5eadf9f7e4e1272401342a094d158614 229b251b3d118932e31e78ac4dfb75f48b766f240f20d436062785606d44467b
lib/codeql/rust/elements/internal/generated/Raw.qll b6bfb4c58f879143b78546b9a1f657876a245facdd01f7dd944825ca9dcf3464 867f32b72030b2b234f818e07b55abc3a3b516c91162dda736b8bc761c16afd6
lib/codeql/rust/elements/internal/generated/RecordExpr.qll 57a25e78a1e501fa6e2876b8412056fb9a50fed79645542e420789333049335e 5f3692fe36d3590ddbb4b6228adf17528a0ab91057940bd9faac000ae735bec1
lib/codeql/rust/elements/internal/generated/Raw.qll aa46ac03eea469d7f8ea52c1b9d1f266870c3a1bcd034a9efcf3becef984d8f7 36bcd61f69be5a713d151f3583cca20ea92e3e8e09343c7ddebb618f6de8649f
lib/codeql/rust/elements/internal/generated/RecordExpr.qll 2131b2cb336caa76170082e69776011bf02576bbfdd34ba68ca84af24209250a 39a2e3ec32352b594c43cc1295e0e8b3f9808173322d3d73cb7d48ef969d5565
lib/codeql/rust/elements/internal/generated/RecordExprField.qll 7e9f8663d3b74ebbc9603b10c9912f082febba6bd73d344b100bbd3edf837802 fbe6b578e7fd5d5a6f21bbb8c388957ab7210a6a249ec71510a50fb35b319ea1
lib/codeql/rust/elements/internal/generated/RecordExprFieldList.qll 179a97211fe7aa6265085d4d54115cdbc0e1cd7c9b2135591e8f36d6432f13d3 dd44bbbc1e83a1ed3a587afb729d7debf7aeb7b63245de181726af13090e50c0
lib/codeql/rust/elements/internal/generated/RecordField.qll 9f7840e1a2a194d5ed1d5201ab483eb01129849d49392581e0328bbc0934305c 0e019b5b8fe91bc96c7c07933c766d8a09c066d48ed96f24ae3dad303c00585e
lib/codeql/rust/elements/internal/generated/RecordFieldList.qll d7bb2677338cf420b0d6371aeec781aacc2272c73413ea96b7418177ad149fb9 5ef52074b9f4ec31e7422b70efdb2e650d673b2625efdfec18a4e48c30e35cf6
lib/codeql/rust/elements/internal/generated/RecordPat.qll 0431a89f30da9dff98b850998d58fcf4d7b475f503e9a9eddf3576965514d22a eb06e4b716f6bc4aed962d609a08679a336cfd375fbd34b2c9fce3f4642ed385
lib/codeql/rust/elements/internal/generated/RecordPat.qll 32a495778fc479d597cb722742a3b8821c4af45944773a055e6be0660d93daca 539b1af822c3f20ce093a03152b18047e9cbad1a55014d6e5e4d8bf27d260196
lib/codeql/rust/elements/internal/generated/RecordPatField.qll f17b1aa265091fd8309fd90d5c3822d170870e304f160225327de5a844a9aed4 0458e39dbe88060b4b664692cf0b41ebf4364de268d9417658c14c883c9c1b33
lib/codeql/rust/elements/internal/generated/RecordPatFieldList.qll 08d4740bbb519f15ab20b694b3c45e396a2a59cce0f68fa4b9698348784cae43 99919809607ae61c707f591ee609c50bcfb90d5b4f9c263f6b8e78658d21b605
lib/codeql/rust/elements/internal/generated/RefExpr.qll 7d995884e3dc1c25fc719f5d7253179344d63650e217e9ff6530285fe7a57f64 f2c3c12551deea4964b66553fb9b6423ee16fec53bd63db4796191aa60dc6c66
lib/codeql/rust/elements/internal/generated/RefPat.qll 5c4d908f851d89f42cf765007c46ac4199200f9b997f368d5b0e2a435efa82cd 42fd637bc98b5a9275386f1c5fb3ae8c4681987289a89b060991416a25131306
lib/codeql/rust/elements/internal/generated/RefType.qll 3603a3e000acc25c5e675bd4bc4a5551b8f63851591e1e9247709e48d1769dc5 91bea4a1d5ef0779d575567253cd007157d3982524e63a7c49c5cae85cb42e5f
lib/codeql/rust/elements/internal/generated/Rename.qll d23f999dab4863f9412e142756f956d79867a3579bd077c56993bdde0a5ac2f1 9256c487d3614bf3d22faa294314f490cf312ab526b8de0882e3a4a371434931
lib/codeql/rust/elements/internal/generated/Resolvable.qll 5579fbd90b106c36828b713b6344c5547d3e449078702efa43b21400f69a1aa8 6ad7f9a0285eb4c69c62de7f23ac1da517f3d468407547685d6607d90fd30641
lib/codeql/rust/elements/internal/generated/Resolvable.qll 586eefb01794220679c3b5d69c059d50c2238cf78ab33efe7185bbd07dea8dbd 1b7c7297d541b9de9e881d18fed4ae40dd327396366a3a6f52a24b85685fa9c1
lib/codeql/rust/elements/internal/generated/RestPat.qll b3a4206e68cf67a0310a466721e7c4b3ab855e65490d589d3d856ad333b3d5e8 30b471bec377784f61d73ef93e74fc0dcec7f512ac4b8791d1ca65f2bcea14b8
lib/codeql/rust/elements/internal/generated/RetType.qll a26860cd526b339b9527c089d126c5486e678dd080e88c60ea2fe641e7d661fd a83c1ce32fd043945ad455b892a60c2a9b6a62d7a5aadf121c4b4056d1dfb094
lib/codeql/rust/elements/internal/generated/ReturnExpr.qll c9c05400d326cd8e0da11c3bfa524daa08b2579ecaee80e468076e5dd7911d56 e7694926727220f46a7617b6ca336767450e359c6fa3782e82b1e21d85d37268
@@ -550,7 +553,7 @@ lib/codeql/rust/elements/internal/generated/Static.qll 5fbd6879858cf356d4bdaa6da
lib/codeql/rust/elements/internal/generated/Stmt.qll 8473ff532dd5cc9d7decaddcd174b94d610f6ca0aec8e473cc051dad9f3db917 6ef7d2b5237c2dbdcacbf7d8b39109d4dc100229f2b28b5c9e3e4fbf673ba72b
lib/codeql/rust/elements/internal/generated/StmtList.qll a667193e32341e17400867c6e359878c4e645ef9f5f4d97676afc0283a33a026 a320ed678ee359302e2fc1b70a9476705cd616fcfa44a499d32f0c7715627f73
lib/codeql/rust/elements/internal/generated/Struct.qll 4d57f0db12dc7ad3e31e750a24172ef1505406b4dab16386af0674bd18bf8f4b 1a73c83df926b996f629316f74c61ea775be04532ab61b56af904223354f033e
lib/codeql/rust/elements/internal/generated/Synth.qll 1aeee823f44fe6ee94ca8dcace6b6cae952be9fe3f50b4c500a392d01139f322 2cdd764b8c508e8a8288368fc8ac729c4469f08304711960de6ef9ec72434942
lib/codeql/rust/elements/internal/generated/Synth.qll b635676938a62e67c8c0db6eb21c6d2cbce0d9d3d429f91f8f85bd79c0c4d7c0 444e2bb62325bd1dc1d3a3e9c2b8ae161f0eb70659cf809ce069eb6886417bc4
lib/codeql/rust/elements/internal/generated/SynthConstructors.qll e929c49ea60810a2bbc19ad38110b8bbaf21db54dae90393b21a3459a54abf6f e929c49ea60810a2bbc19ad38110b8bbaf21db54dae90393b21a3459a54abf6f
lib/codeql/rust/elements/internal/generated/Token.qll 77a91a25ca5669703cf3a4353b591cef4d72caa6b0b9db07bb9e005d69c848d1 2fdffc4882ed3a6ca9ac6d1fb5f1ac5a471ca703e2ffdc642885fa558d6e373b
lib/codeql/rust/elements/internal/generated/TokenTree.qll 8577c2b097c1be2f0f7daa5acfcf146f78674a424d99563e08a84dd3e6d91b46 d2f30764e84dbfc0a6a5d3d8a5f935cd432413688cb32da9c94e420fbc10665c
@@ -561,7 +564,7 @@ lib/codeql/rust/elements/internal/generated/TupleExpr.qll 75186da7c077287b9a86fc
lib/codeql/rust/elements/internal/generated/TupleField.qll d2580e046a576a1a7669463956c929912e383de304854a86eea5e45807a0a882 b41cbc48fcbb56543705e6bf708b72156307c71735d2ed42b97d8bf3c1099dd1
lib/codeql/rust/elements/internal/generated/TupleFieldList.qll 9d4981d04c2ee005e41035b9699f03bff270c4e0515af5482d02e614a0b1a875 4e60b857fbcb668fa1a001e0eff03f1aa3a7465d32ce68e23544b705fa54fc5d
lib/codeql/rust/elements/internal/generated/TuplePat.qll d61163a380f3f2c1709080e2df69a90764509af060e607e27e832862e4dae18c 108b7db493a21fe1fa0db99fceee952aabb0a128eac41e050877ab9136407403
lib/codeql/rust/elements/internal/generated/TupleStructPat.qll 987745c3c58df38a41f14fce1b59ee82859de7706680f23e52010937fc4646ee 91446a75fd63af87566ff347a7c25c3f6c9cbd75c0d72bdc99590a1af27e8ef4
lib/codeql/rust/elements/internal/generated/TupleStructPat.qll 3864e3b88a23558397a885cd8caca25aa5e8a9e9e372b688d357bb8fe38ee3b8 1889e0ea07cfb9ad7347510906b5abf14374d1306dece1606ebc228b19bf0ad2
lib/codeql/rust/elements/internal/generated/TupleType.qll 7fae8e881157a24c4ce4f960269ba8010e227a81d3055b571f861f7196f868e2 18085a19a102df8e2cded938b49709225e89f0ce68b4a003310647bb259a6bd3
lib/codeql/rust/elements/internal/generated/TypeAlias.qll af02bb172b6f2d7f5eab8645a5a219eee8a4bbc445838f5739f18ba217c7e608 6d871471d673adae99c8b146f6f7ab204f24d52b5013b4582037a42b279c9f05
lib/codeql/rust/elements/internal/generated/TypeArg.qll fe4441b3faa44e542c43a85353347df23d3f74da0c4b17cb0fdc60f5aca9dee7 1473d044e979e7cb6628525ffd454549cd8a37560488c695f534243946cf83bc
@@ -585,7 +588,7 @@ lib/codeql/rust/elements/internal/generated/WhileExpr.qll 7edf1f23fbf953a2baabcd
lib/codeql/rust/elements/internal/generated/WildcardPat.qll d74b70b57a0a66bfae017a329352a5b27a6b9e73dd5521d627f680e810c6c59e 4b913b548ba27ff3c82fcd32cf996ff329cb57d176d3bebd0fcef394486ea499
lib/codeql/rust/elements/internal/generated/YeetExpr.qll cac328200872a35337b4bcb15c851afb4743f82c080f9738d295571eb01d7392 94af734eea08129b587fed849b643e7572800e8330c0b57d727d41abda47930b
lib/codeql/rust/elements/internal/generated/YieldExpr.qll 37e5f0c1e373a22bbc53d8b7f2c0e1f476e5be5080b8437c5e964f4e83fad79a 4a9a68643401637bf48e5c2b2f74a6bf0ddcb4ff76f6bffb61d436b685621e85
lib/codeql/rust/elements.qll ced76fbeebc6e2e972ecaed65ef97851f90a215cf330f28a0f31a253f1c03442 ced76fbeebc6e2e972ecaed65ef97851f90a215cf330f28a0f31a253f1c03442
lib/codeql/rust/elements.qll ba73bcb718837cc3d9d6f283609a869dc48b7848109e07496d5f52723dc2e62c ba73bcb718837cc3d9d6f283609a869dc48b7848109e07496d5f52723dc2e62c
test/extractor-tests/generated/Abi/Abi.ql 7f6e7dc4af86eca3ebdc79b10373988cd0871bd78b51997d3cffd969105e5fdd 2f936b6ca005c6157c755121584410c03e4a3949c23bee302fbe05ee10ce118f
test/extractor-tests/generated/Abi/Abi_getAbiString.ql a496762fcec5a0887b87023bbf93e9b650f02e20113e25c44d6e4281ae8f5335 14109c7ce11ba25e3cd6e7f1b3fcb4cb00622f2a4eac91bfe43145c5f366bc52
test/extractor-tests/generated/ArgList/ArgList.ql e412927756e72165d0e7c5c9bd3fca89d08197bbf760db8fb7683c64bb2229bc 043dba8506946fbb87753e22c387987d7eded6ddb963aa067f9e60ef9024d684
@@ -725,9 +728,7 @@ test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getFormat.ql 02d3fa
test/extractor-tests/generated/FormatArgsExpr/FormatArgsExpr_getTemplate.ql c912ac37275cbe7b3b29607bed1a3190c80779436422c14a475113e1bfd91a54 ef90f67a9b952a38ce557b1afbf0b5ce8551e83ddfaad8309a0c9523e40b5ea7
test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql 7a7ee3a3322b4af8cb3b525cfed8cc9719d136ea80aa6b3fb30c7e16394dd93f 5aa8a77d7741b02f8ceb9e5991efa4c2c43c6f1624989218990e985108dae535
test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql 7bd4ec3dde2ef0463585794101e6cc426c368b0e4ab95fbb1f24f8f0a76cf471 e7b01e8b21df5b22c51643e2c909c6fc4ca96fda41b3290c907ba228abe8669b
test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql f1b727be65d0563c8dffab61248a1b9a59b221fdaae28d3a3fbde3fb17592f5b dbf2395213d261bcf01c3258ab51f073e7934d58af5e2044b64292ed8f71f9a4
test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess_getResolvedCrateOrigin.ql f7288c9be7b31a6c78da9e2f4e774522013c2db8ff457dfb5edced009b65ebdd 58ea795ccf649f733c995c49da4680f68599d58f466cb63415a12f4cc9d0ab11
test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess_getResolvedPath.ql 56a0347a705b5719a97f520b2c0777c97e73bc2d977dc5d00910679950eae5ca 1ef63883dd83a22f56f226348e8fb9bf72817df19ff2708a4559a5f7b8a2855a
test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql 2793ba1ff52182dab992d82d3767a000928f6b2fbfdb621349cafc183f0d2480 c3777d03214f7feb9020de3ce45af6556129e39e9b30d083de605b70ab9a0a12
test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql 26d592398a17795427b5b6b51ff4a013ee15c31443e732a000baca5f2e65acca 7940a864b84b89e84d7fb186599cb8b6bcbead7141c592b8ab0c59fcd380d5fb
test/extractor-tests/generated/Function/Function.ql c1c2a9b68c35f839ccd2b5e62e87d1acd94dcc2a3dc4c307c269b84b2a0806e6 1c446f19d2f81dd139aa5a1578d1b165e13bddbaeab8cfee8f0430bced3a99ab
test/extractor-tests/generated/Function/Function_getAbi.ql e5c9c97de036ddd51cae5d99d41847c35c6b2eabbbd145f4467cb501edc606d8 0b81511528bd0ef9e63b19edfc3cb638d8af43eb87d018fad69d6ef8f8221454
@@ -897,7 +898,7 @@ test/extractor-tests/generated/ParenPat/ParenPat_getPat.ql 96f3db0ec4e71fd870619
test/extractor-tests/generated/ParenType/ParenType.ql 81c8ad667397ce36157941abd9b879e9305a440018853af4528eb737ae4d2935 3ef3b86203b0143be2d7f7f4833f55fd6c226cb9205e3c1940b6c2a1371622f3
test/extractor-tests/generated/ParenType/ParenType_getTy.ql 41dd6605e7b348618156712b559e2f1b6aac02d6c727e8cbf8653530794ec969 30ac6611c730e76cfb75f98efcf817783a50cec0cf3b3197459d7642f74dde85
test/extractor-tests/generated/Path/Path.ql 2bdcd99b3b5ffc83ac47d8cc27a4561d616bcf06844f0c452c699cd10ee640ca 5a7d7ffb8b0c04d6a8cbb2a953761df8561b796c4372bef1bd55c359b2f19911
test/extractor-tests/generated/Path/PathExpr.ql 7716664d4f2254456df9d0f44836e761df60c96133d484cbda39e6cbb3152610 4ee3dd2b9fb1f223de0151db71cb623e93dea9afec125222f91e2bc02173173d
test/extractor-tests/generated/Path/PathExpr.ql 5039fe730998a561f51813a0716e18c7c1d36b6da89936e4cfbdb4ef0e895560 cd3ddf8ab93cd573381807f59cded7fb3206f1dbdff582490be6f23bed2d6f29
test/extractor-tests/generated/Path/PathExpr_getAttr.ql 2ccac48cd91d86670c1d2742de20344135d424e6f0e3dafcc059555046f92d92 9b7b5f5f9e3674fad9b3a5bcd3cabc0dff32a95640da0fce6f4d0eb931f1757d
test/extractor-tests/generated/Path/PathExpr_getPath.ql e7894071313a74166bdd31d7cd974037fcd5a7f0e92d5eec42833266196eb858 46a06e8a1207e7a0fa175cd4b61068e5fd6c43b5575b88986409f0ac2be64c51
test/extractor-tests/generated/Path/PathExpr_getResolvedCrateOrigin.ql a68a1f0d865d10c955f7ab1fd7614b517e660553b65fabb9daa8f302adbc2602 c47480d6440ae63be27d8158a35536a8d9051817dec1521cdcab297ddb52e1ae
@@ -1053,7 +1054,7 @@ test/extractor-tests/generated/TupleFieldList/TupleFieldList.ql 7dc88440222ff036
test/extractor-tests/generated/TupleFieldList/TupleFieldList_getField.ql ad552a9c0b9964d1770f14cabbb436db60ebedc3c569006542a8eae9ddb30f6d 3a8c49d629376a9b8326138836b05ee2366b1021ffd19f5be74ab023e70aa50d
test/extractor-tests/generated/TuplePat/TuplePat.ql 24ee56bc848537da65eb8ecef71e84cc351a2aedcc31d6fb53a5b7865f15f7c2 81db1076e2e4921ceb50933b96cd7b574caab1818de257c1e9038f3f97447d59
test/extractor-tests/generated/TuplePat/TuplePat_getField.ql f000bed41af031bc56d0705ce312abe7ab3dc6745b2936798c9938781e51475e f464a84dbc36aa371d60d6db68d6251f6b275dc4ecebdc56f195637be390b067
test/extractor-tests/generated/TupleStructPat/TupleStructPat.ql 194b2fbfc83a84caf76032f3c63a1f7e618f71e5ea5be449e9d2691b0fce9829 0ff24488ba5729591ce86a702fdfb6f4e0498f96d89bf5c4bd05bd90523f9435
test/extractor-tests/generated/TupleStructPat/TupleStructPat.ql 967409c7bddd7fc8d0b9fdfab2f5e6c82e8b4ff57020822aa0cda177244dfbc5 eaf0b7e56c38db60fafb39f8de75b67ee1099ac540fa92b5dfe84b601d31781a
test/extractor-tests/generated/TupleStructPat/TupleStructPat_getField.ql f3f2e23cc2a32aa5abc1e0fda1300dab1693230632b9eaa75bb3b1e82ee9ea1a 24b87a39ec639a26ff8c1d04dc3429b72266b2a3b1650a06a7cd4387b6f0e615
test/extractor-tests/generated/TupleStructPat/TupleStructPat_getPath.ql 13a06696bbf1fa8d5b73107e28cdba40e93da04b27f9c54381b78a52368d2ad1 5558c35ea9bb371ad90a5b374d7530dd1936f83e6ba656ebfbfd5bd63598e088
test/extractor-tests/generated/TupleStructPat/TupleStructPat_getResolvedCrateOrigin.ql e409667233331a038e482de4b2669d9fac9d7eb0e3bd5580ea19828f0c4ed7ad 588e4628471f1004575900d7365490efcf9168b555ff26becfc3f27b9e657de3

5
rust/ql/.gitattributes generated vendored
View File

@@ -104,6 +104,7 @@
/lib/codeql/rust/elements/ParenType.qll linguist-generated
/lib/codeql/rust/elements/Pat.qll linguist-generated
/lib/codeql/rust/elements/Path.qll linguist-generated
/lib/codeql/rust/elements/PathAstNode.qll linguist-generated
/lib/codeql/rust/elements/PathExpr.qll linguist-generated
/lib/codeql/rust/elements/PathExprBase.qll linguist-generated
/lib/codeql/rust/elements/PathPat.qll linguist-generated
@@ -303,6 +304,7 @@
/lib/codeql/rust/elements/internal/ParenPatConstructor.qll linguist-generated
/lib/codeql/rust/elements/internal/ParenTypeConstructor.qll linguist-generated
/lib/codeql/rust/elements/internal/PatImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PathAstNodeImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PathConstructor.qll linguist-generated
/lib/codeql/rust/elements/internal/PathExprBaseImpl.qll linguist-generated
/lib/codeql/rust/elements/internal/PathExprConstructor.qll linguist-generated
@@ -516,6 +518,7 @@
/lib/codeql/rust/elements/internal/generated/ParentChild.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/Pat.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/Path.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathAstNode.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathExpr.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathExprBase.qll linguist-generated
/lib/codeql/rust/elements/internal/generated/PathPat.qll linguist-generated
@@ -728,8 +731,6 @@
/test/extractor-tests/generated/FormatArgsExpr/FormatArgument.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/FormatArgument_getVariable.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess_getResolvedCrateOrigin.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/FormatTemplateVariableAccess_getResolvedPath.ql linguist-generated
/test/extractor-tests/generated/FormatArgsExpr/Format_getArgument.ql linguist-generated
/test/extractor-tests/generated/Function/Function.ql linguist-generated
/test/extractor-tests/generated/Function/Function_getAbi.ql linguist-generated

View File

@@ -2060,16 +2060,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
* Gets the number of attrs of this path expression.
*/
int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
/**
* Gets the path of this path expression, if it exists.
*/
Path getPath() { result = node.getPath() }
/**
* Holds if `getPath()` exists.
*/
predicate hasPath() { exists(this.getPath()) }
}
final private class ParentPathExprBase extends ParentAstNode, PathExprBase {
@@ -2108,16 +2098,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
/** Gets the underlying `PathPat`. */
PathPat getPathPat() { result = node }
/**
* Gets the path of this path pat, if it exists.
*/
Path getPath() { result = node.getPath() }
/**
* Holds if `getPath()` exists.
*/
predicate hasPath() { exists(this.getPath()) }
}
final private class ParentPrefixExpr extends ParentAstNode, PrefixExpr {
@@ -2345,16 +2325,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
/** Gets the underlying `RecordExpr`. */
RecordExpr getRecordExpr() { result = node }
/**
* Gets the path of this record expression, if it exists.
*/
Path getPath() { result = node.getPath() }
/**
* Holds if `getPath()` exists.
*/
predicate hasPath() { exists(this.getPath()) }
/**
* Gets the record expression field list of this record expression, if it exists.
*/
@@ -2387,16 +2357,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
/** Gets the underlying `RecordPat`. */
RecordPat getRecordPat() { result = node }
/**
* Gets the path of this record pat, if it exists.
*/
Path getPath() { result = node.getPath() }
/**
* Holds if `getPath()` exists.
*/
predicate hasPath() { exists(this.getPath()) }
/**
* Gets the record pat field list of this record pat, if it exists.
*/
@@ -2889,16 +2849,6 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
* Gets the number of fields of this tuple struct pat.
*/
int getNumberOfFields() { result = count(int i | exists(this.getField(i))) }
/**
* Gets the path of this tuple struct pat, if it exists.
*/
Path getPath() { result = node.getPath() }
/**
* Holds if `getPath()` exists.
*/
predicate hasPath() { exists(this.getPath()) }
}
final private class ParentUnderscoreExpr extends ParentAstNode, UnderscoreExpr {

View File

@@ -598,31 +598,33 @@ module RustDataFlow implements InputSig<Location> {
predicate jumpStep(Node node1, Node node2) { none() }
/** Holds if path `p` resolves to variant `v`. */
private predicate pathResolveToVariantCanonicalPath(Path p, VariantCanonicalPath v) {
exists(CrateOriginOption crate, string path |
resolveExtendedCanonicalPath(p.getQualifier(), crate, path) and
v = MkVariantCanonicalPath(crate, path, p.getPart().getNameRef().getText())
private predicate pathResolveToVariantCanonicalPath(PathAstNode p, VariantCanonicalPath v) {
exists(CrateOriginOption crate, string path, string name |
// TODO: this is bad, but will be solved by moving to semantic paths away from strings
resolveExtendedCanonicalPath(p, crate, path + "::" + name) and
v = MkVariantCanonicalPath(crate, path, name)
)
or
// TODO: Remove once library types are extracted
not p.hasQualifier() and
v = MkVariantCanonicalPath(_, "crate::std::option::Option", p.getPart().getNameRef().getText())
or
// TODO: Remove once library types are extracted
not p.hasQualifier() and
v = MkVariantCanonicalPath(_, "crate::std::result::Result", p.getPart().getNameRef().getText())
exists(Path path |
path = p.getPath() and
not path.hasQualifier() and
v =
MkVariantCanonicalPath(_, ["crate::std::option::Option", "crate::std::result::Result"],
path.getPart().getNameRef().getText())
)
}
/** Holds if `p` destructs an enum variant `v`. */
pragma[nomagic]
private predicate tupleVariantDestruction(TupleStructPat p, VariantCanonicalPath v) {
pathResolveToVariantCanonicalPath(p.getPath(), v)
pathResolveToVariantCanonicalPath(p, v)
}
/** Holds if `p` destructs an enum variant `v`. */
pragma[nomagic]
private predicate recordVariantDestruction(RecordPat p, VariantCanonicalPath v) {
pathResolveToVariantCanonicalPath(p.getPath(), v)
pathResolveToVariantCanonicalPath(p, v)
}
/**
@@ -651,13 +653,13 @@ module RustDataFlow implements InputSig<Location> {
/** Holds if `ce` constructs an enum value of type `v`. */
pragma[nomagic]
private predicate tupleVariantConstruction(CallExpr ce, VariantCanonicalPath v) {
pathResolveToVariantCanonicalPath(ce.getFunction().(PathExpr).getPath(), v)
pathResolveToVariantCanonicalPath(ce.getFunction().(PathExpr), v)
}
/** Holds if `re` constructs an enum value of type `v`. */
pragma[nomagic]
private predicate recordVariantConstruction(RecordExpr re, VariantCanonicalPath v) {
pathResolveToVariantCanonicalPath(re.getPath(), v)
pathResolveToVariantCanonicalPath(re, v)
}
/**

View File

@@ -106,6 +106,7 @@ import codeql.rust.elements.ParenPat
import codeql.rust.elements.ParenType
import codeql.rust.elements.Pat
import codeql.rust.elements.Path
import codeql.rust.elements.PathAstNode
import codeql.rust.elements.PathExpr
import codeql.rust.elements.PathExprBase
import codeql.rust.elements.PathPat

View File

@@ -0,0 +1,13 @@
// generated by codegen, do not edit
/**
* This module provides the public class `PathAstNode`.
*/
private import internal.PathAstNodeImpl
import codeql.rust.elements.Path
import codeql.rust.elements.Resolvable
/**
* An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
*/
final class PathAstNode = Impl::PathAstNode;

View File

@@ -5,7 +5,7 @@
private import internal.PathExprImpl
import codeql.rust.elements.Attr
import codeql.rust.elements.Path
import codeql.rust.elements.PathAstNode
import codeql.rust.elements.PathExprBase
/**

View File

@@ -5,7 +5,6 @@
private import internal.PathExprBaseImpl
import codeql.rust.elements.Expr
import codeql.rust.elements.Resolvable
/**
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.

View File

@@ -5,8 +5,7 @@
private import internal.PathPatImpl
import codeql.rust.elements.Pat
import codeql.rust.elements.Path
import codeql.rust.elements.Resolvable
import codeql.rust.elements.PathAstNode
/**
* A path pattern. For example:

View File

@@ -5,9 +5,8 @@
private import internal.RecordExprImpl
import codeql.rust.elements.Expr
import codeql.rust.elements.Path
import codeql.rust.elements.PathAstNode
import codeql.rust.elements.RecordExprFieldList
import codeql.rust.elements.Resolvable
/**
* A record expression. For example:

View File

@@ -5,9 +5,8 @@
private import internal.RecordPatImpl
import codeql.rust.elements.Pat
import codeql.rust.elements.Path
import codeql.rust.elements.PathAstNode
import codeql.rust.elements.RecordPatFieldList
import codeql.rust.elements.Resolvable
/**
* A record pattern. For example:

View File

@@ -7,6 +7,6 @@ private import internal.ResolvableImpl
import codeql.rust.elements.AstNode
/**
* Either a `PathExpr`, a `PathPat`, or a `MethodCallExpr`.
* One of `PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat` or `MethodCallExpr`.
*/
final class Resolvable = Impl::Resolvable;

View File

@@ -5,8 +5,7 @@
private import internal.TupleStructPatImpl
import codeql.rust.elements.Pat
import codeql.rust.elements.Path
import codeql.rust.elements.Resolvable
import codeql.rust.elements.PathAstNode
/**
* A tuple struct pattern. For example:

View File

@@ -0,0 +1,19 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `PathAstNode`.
*
* INTERNAL: Do not use.
*/
private import codeql.rust.elements.internal.generated.PathAstNode
/**
* INTERNAL: This module contains the customizable definition of `PathAstNode` and should not
* be referenced directly.
*/
module Impl {
/**
* An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
*/
class PathAstNode extends Generated::PathAstNode { }
}

View File

@@ -15,7 +15,7 @@ module Impl {
// the following QLdoc is generated: if you need to edit it, do it in the schema file
/**
* Either a `PathExpr`, a `PathPat`, or a `MethodCallExpr`.
* One of `PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat` or `MethodCallExpr`.
*/
class Resolvable extends Generated::Resolvable {
/**

View File

@@ -2185,45 +2185,40 @@ private module Impl {
)
}
private Element getImmediateChildOfPathExprBase(
PathExprBase e, int index, string partialPredicateCall
private Element getImmediateChildOfPathAstNode(
PathAstNode e, int index, string partialPredicateCall
) {
exists(int b, int bExpr, int bResolvable, int n |
exists(int b, int bResolvable, int n, int nPath |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
bResolvable =
bExpr + 1 + max(int i | i = -1 or exists(getImmediateChildOfResolvable(e, i, _)) | i) and
n = bResolvable and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfResolvable(e, index - bExpr, partialPredicateCall)
)
)
}
private Element getImmediateChildOfPathPat(PathPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int bResolvable, int n, int nPath |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
bResolvable =
bPat + 1 + max(int i | i = -1 or exists(getImmediateChildOfResolvable(e, i, _)) | i) and
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfResolvable(e, i, _)) | i) and
n = bResolvable and
nPath = n + 1 and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfResolvable(e, index - bPat, partialPredicateCall)
result = getImmediateChildOfResolvable(e, index - b, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
)
)
}
private Element getImmediateChildOfPathExprBase(
PathExprBase 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 getImmediateChildOfPathType(PathType e, int index, string partialPredicateCall) {
exists(int b, int bTypeRef, int n, int nPath |
b = 0 and
@@ -2318,31 +2313,6 @@ private module Impl {
)
}
private Element getImmediateChildOfRecordExpr(RecordExpr e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int bResolvable, int n, int nPath, int nRecordExprFieldList |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
bResolvable =
bExpr + 1 + max(int i | i = -1 or exists(getImmediateChildOfResolvable(e, i, _)) | i) and
n = bResolvable and
nPath = n + 1 and
nRecordExprFieldList = nPath + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfResolvable(e, index - bExpr, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
or
index = nPath and
result = e.getRecordExprFieldList() and
partialPredicateCall = "RecordExprFieldList()"
)
)
}
private Element getImmediateChildOfRecordFieldList(
RecordFieldList e, int index, string partialPredicateCall
) {
@@ -2362,31 +2332,6 @@ private module Impl {
)
}
private Element getImmediateChildOfRecordPat(RecordPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int bResolvable, int n, int nPath, int nRecordPatFieldList |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
bResolvable =
bPat + 1 + max(int i | i = -1 or exists(getImmediateChildOfResolvable(e, i, _)) | i) and
n = bResolvable and
nPath = n + 1 and
nRecordPatFieldList = nPath + 1 and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfResolvable(e, index - bPat, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
or
index = nPath and
result = e.getRecordPatFieldList() and
partialPredicateCall = "RecordPatFieldList()"
)
)
}
private Element getImmediateChildOfRefExpr(RefExpr e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int n, int nAttr, int nExpr |
b = 0 and
@@ -2608,32 +2553,6 @@ private module Impl {
)
}
private Element getImmediateChildOfTupleStructPat(
TupleStructPat e, int index, string partialPredicateCall
) {
exists(int b, int bPat, int bResolvable, int n, int nField, int nPath |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
bResolvable =
bPat + 1 + max(int i | i = -1 or exists(getImmediateChildOfResolvable(e, i, _)) | i) and
n = bResolvable and
nField = n + 1 + max(int i | i = -1 or exists(e.getField(i)) | i) and
nPath = nField + 1 and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfResolvable(e, index - bPat, partialPredicateCall)
or
result = e.getField(index - n) and
partialPredicateCall = "Field(" + (index - n).toString() + ")"
or
index = nField and result = e.getPath() and partialPredicateCall = "Path()"
)
)
}
private Element getImmediateChildOfTupleType(TupleType e, int index, string partialPredicateCall) {
exists(int b, int bTypeRef, int n, int nField |
b = 0 and
@@ -3253,22 +3172,85 @@ private module Impl {
}
private Element getImmediateChildOfPathExpr(PathExpr e, int index, string partialPredicateCall) {
exists(int b, int bPathExprBase, int n, int nAttr, int nPath |
exists(int b, int bPathExprBase, int bPathAstNode, int n, int nAttr |
b = 0 and
bPathExprBase =
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathExprBase(e, i, _)) | i) and
n = bPathExprBase and
bPathAstNode =
bPathExprBase + 1 +
max(int i | i = -1 or exists(getImmediateChildOfPathAstNode(e, i, _)) | i) and
n = bPathAstNode and
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
nPath = nAttr + 1 and
(
none()
or
result = getImmediateChildOfPathExprBase(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfPathAstNode(e, index - bPathExprBase, partialPredicateCall)
or
result = e.getAttr(index - n) and
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
)
)
}
private Element getImmediateChildOfPathPat(PathPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int bPathAstNode, int n |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
bPathAstNode =
bPat + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathAstNode(e, i, _)) | i) and
n = bPathAstNode and
(
none()
or
index = nAttr and result = e.getPath() and partialPredicateCall = "Path()"
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfPathAstNode(e, index - bPat, partialPredicateCall)
)
)
}
private Element getImmediateChildOfRecordExpr(RecordExpr e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int bPathAstNode, int n, int nRecordExprFieldList |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
bPathAstNode =
bExpr + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathAstNode(e, i, _)) | i) and
n = bPathAstNode and
nRecordExprFieldList = n + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfPathAstNode(e, index - bExpr, partialPredicateCall)
or
index = n and
result = e.getRecordExprFieldList() and
partialPredicateCall = "RecordExprFieldList()"
)
)
}
private Element getImmediateChildOfRecordPat(RecordPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int bPathAstNode, int n, int nRecordPatFieldList |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
bPathAstNode =
bPat + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathAstNode(e, i, _)) | i) and
n = bPathAstNode and
nRecordPatFieldList = n + 1 and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfPathAstNode(e, index - bPat, partialPredicateCall)
or
index = n and
result = e.getRecordPatFieldList() and
partialPredicateCall = "RecordPatFieldList()"
)
)
}
@@ -3433,6 +3415,29 @@ private module Impl {
)
}
private Element getImmediateChildOfTupleStructPat(
TupleStructPat e, int index, string partialPredicateCall
) {
exists(int b, int bPat, int bPathAstNode, int n, int nField |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
bPathAstNode =
bPat + 1 + max(int i | i = -1 or exists(getImmediateChildOfPathAstNode(e, i, _)) | i) and
n = bPathAstNode and
nField = n + 1 + max(int i | i = -1 or exists(e.getField(i)) | i) and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
result = getImmediateChildOfPathAstNode(e, index - bPat, partialPredicateCall)
or
result = e.getField(index - n) and
partialPredicateCall = "Field(" + (index - n).toString() + ")"
)
)
}
private Element getImmediateChildOfTypeAlias(TypeAlias e, int index, string partialPredicateCall) {
exists(
int b, int bAssocItem, int bExternItem, int bItem, int n, int nAttr, int nGenericParamList,
@@ -3803,8 +3808,6 @@ private module Impl {
or
result = getImmediateChildOfParenType(e, index, partialAccessor)
or
result = getImmediateChildOfPathPat(e, index, partialAccessor)
or
result = getImmediateChildOfPathType(e, index, partialAccessor)
or
result = getImmediateChildOfPrefixExpr(e, index, partialAccessor)
@@ -3815,12 +3818,8 @@ private module Impl {
or
result = getImmediateChildOfRangePat(e, index, partialAccessor)
or
result = getImmediateChildOfRecordExpr(e, index, partialAccessor)
or
result = getImmediateChildOfRecordFieldList(e, index, partialAccessor)
or
result = getImmediateChildOfRecordPat(e, index, partialAccessor)
or
result = getImmediateChildOfRefExpr(e, index, partialAccessor)
or
result = getImmediateChildOfRefPat(e, index, partialAccessor)
@@ -3845,8 +3844,6 @@ private module Impl {
or
result = getImmediateChildOfTuplePat(e, index, partialAccessor)
or
result = getImmediateChildOfTupleStructPat(e, index, partialAccessor)
or
result = getImmediateChildOfTupleType(e, index, partialAccessor)
or
result = getImmediateChildOfTypeArg(e, index, partialAccessor)
@@ -3893,6 +3890,12 @@ private module Impl {
or
result = getImmediateChildOfPathExpr(e, index, partialAccessor)
or
result = getImmediateChildOfPathPat(e, index, partialAccessor)
or
result = getImmediateChildOfRecordExpr(e, index, partialAccessor)
or
result = getImmediateChildOfRecordPat(e, index, partialAccessor)
or
result = getImmediateChildOfStatic(e, index, partialAccessor)
or
result = getImmediateChildOfStruct(e, index, partialAccessor)
@@ -3901,6 +3904,8 @@ private module Impl {
or
result = getImmediateChildOfTraitAlias(e, index, partialAccessor)
or
result = getImmediateChildOfTupleStructPat(e, index, partialAccessor)
or
result = getImmediateChildOfTypeAlias(e, index, partialAccessor)
or
result = getImmediateChildOfUnion(e, index, partialAccessor)

View File

@@ -0,0 +1,36 @@
// generated by codegen, do not edit
/**
* This module provides the generated definition of `PathAstNode`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.Path
import codeql.rust.elements.internal.ResolvableImpl::Impl as ResolvableImpl
/**
* INTERNAL: This module contains the fully generated definition of `PathAstNode` and should not
* be referenced directly.
*/
module Generated {
/**
* An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
* INTERNAL: Do not reference the `Generated::PathAstNode` class directly.
* Use the subclass `PathAstNode`, where the following predicates are available.
*/
class PathAstNode extends Synth::TPathAstNode, ResolvableImpl::Resolvable {
/**
* Gets the path of this path ast node, if it exists.
*/
Path getPath() {
result =
Synth::convertPathFromRaw(Synth::convertPathAstNodeToRaw(this).(Raw::PathAstNode).getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
}
}

View File

@@ -7,7 +7,7 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.Attr
import codeql.rust.elements.Path
import codeql.rust.elements.internal.PathAstNodeImpl::Impl as PathAstNodeImpl
import codeql.rust.elements.internal.PathExprBaseImpl::Impl as PathExprBaseImpl
/**
@@ -26,7 +26,9 @@ module Generated {
* INTERNAL: Do not reference the `Generated::PathExpr` class directly.
* Use the subclass `PathExpr`, where the following predicates are available.
*/
class PathExpr extends Synth::TPathExpr, PathExprBaseImpl::PathExprBase {
class PathExpr extends Synth::TPathExpr, PathExprBaseImpl::PathExprBase,
PathAstNodeImpl::PathAstNode
{
override string getAPrimaryQlClass() { result = "PathExpr" }
/**
@@ -46,18 +48,5 @@ module Generated {
* Gets the number of attrs of this path expression.
*/
final int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
/**
* Gets the path of this path expression, if it exists.
*/
Path getPath() {
result =
Synth::convertPathFromRaw(Synth::convertPathExprToRaw(this).(Raw::PathExpr).getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
}
}

View File

@@ -7,7 +7,6 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl
import codeql.rust.elements.internal.ResolvableImpl::Impl as ResolvableImpl
/**
* INTERNAL: This module contains the fully generated definition of `PathExprBase` and should not
@@ -19,5 +18,5 @@ module Generated {
* INTERNAL: Do not reference the `Generated::PathExprBase` class directly.
* Use the subclass `PathExprBase`, where the following predicates are available.
*/
class PathExprBase extends Synth::TPathExprBase, ExprImpl::Expr, ResolvableImpl::Resolvable { }
class PathExprBase extends Synth::TPathExprBase, ExprImpl::Expr { }
}

View File

@@ -7,8 +7,7 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.internal.PatImpl::Impl as PatImpl
import codeql.rust.elements.Path
import codeql.rust.elements.internal.ResolvableImpl::Impl as ResolvableImpl
import codeql.rust.elements.internal.PathAstNodeImpl::Impl as PathAstNodeImpl
/**
* INTERNAL: This module contains the fully generated definition of `PathPat` and should not
@@ -26,19 +25,7 @@ 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, PatImpl::Pat, ResolvableImpl::Resolvable {
class PathPat extends Synth::TPathPat, PatImpl::Pat, PathAstNodeImpl::PathAstNode {
override string getAPrimaryQlClass() { result = "PathPat" }
/**
* Gets the path of this path pat, if it exists.
*/
Path getPath() {
result = Synth::convertPathFromRaw(Synth::convertPathPatToRaw(this).(Raw::PathPat).getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
}
}

View File

@@ -803,7 +803,7 @@ module Raw {
/**
* INTERNAL: Do not use.
* Either a `PathExpr`, a `PathPat`, or a `MethodCallExpr`.
* One of `PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat` or `MethodCallExpr`.
*/
class Resolvable extends @resolvable, AstNode {
/**
@@ -2302,28 +2302,20 @@ module Raw {
/**
* INTERNAL: Do not use.
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
* An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
*/
class PathExprBase extends @path_expr_base, Expr, Resolvable { }
class PathAstNode extends @path_ast_node, Resolvable {
/**
* Gets the path of this path ast node, if it exists.
*/
Path getPath() { path_ast_node_paths(this, result) }
}
/**
* INTERNAL: Do not use.
* A path pattern. For example:
* ```rust
* match x {
* Foo::Bar => "ok",
* _ => "fail",
* }
* ```
* A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
*/
class PathPat extends @path_pat, Pat, Resolvable {
override string toString() { result = "PathPat" }
/**
* Gets the path of this path pat, if it exists.
*/
Path getPath() { path_pat_paths(this, result) }
}
class PathExprBase extends @path_expr_base, Expr { }
/**
* INTERNAL: Do not use.
@@ -2462,32 +2454,6 @@ module Raw {
Pat getStart() { range_pat_starts(this, result) }
}
/**
* INTERNAL: Do not use.
* A record 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;
* ```
*/
class RecordExpr extends @record_expr, Expr, Resolvable {
override string toString() { result = "RecordExpr" }
/**
* Gets the path of this record expression, if it exists.
*/
Path getPath() { record_expr_paths(this, result) }
/**
* Gets the record expression field list of this record expression, if it exists.
*/
RecordExprFieldList getRecordExprFieldList() {
record_expr_record_expr_field_lists(this, result)
}
}
/**
* INTERNAL: Do not use.
* A RecordFieldList. For example:
@@ -2504,30 +2470,6 @@ module Raw {
RecordField getField(int index) { record_field_list_fields(this, index, result) }
}
/**
* INTERNAL: Do not use.
* A record pattern. For example:
* ```rust
* match x {
* Foo { a: 1, b: 2 } => "ok",
* Foo { .. } => "fail",
* }
* ```
*/
class RecordPat extends @record_pat, Pat, Resolvable {
override string toString() { result = "RecordPat" }
/**
* Gets the path of this record pat, if it exists.
*/
Path getPath() { record_pat_paths(this, result) }
/**
* Gets the record pat field list of this record pat, if it exists.
*/
RecordPatFieldList getRecordPatFieldList() { record_pat_record_pat_field_lists(this, result) }
}
/**
* INTERNAL: Do not use.
* A reference expression. For example:
@@ -2801,31 +2743,6 @@ module Raw {
Pat getField(int index) { tuple_pat_fields(this, index, result) }
}
/**
* INTERNAL: Do not use.
* A tuple struct pattern. For example:
* ```rust
* match x {
* Tuple("a", 1, 2, 3) => "great",
* Tuple(.., 3) => "fine",
* Tuple(..) => "fail",
* };
* ```
*/
class TupleStructPat extends @tuple_struct_pat, Pat, Resolvable {
override string toString() { result = "TupleStructPat" }
/**
* Gets the `index`th field of this tuple struct pat (0-based).
*/
Pat getField(int index) { tuple_struct_pat_fields(this, index, result) }
/**
* Gets the path of this tuple struct pat, if it exists.
*/
Path getPath() { tuple_struct_pat_paths(this, result) }
}
/**
* INTERNAL: Do not use.
* A TupleType. For example:
@@ -3546,18 +3463,67 @@ module Raw {
* let z = <TypeRef as Trait>::foo;
* ```
*/
class PathExpr extends @path_expr, PathExprBase {
class PathExpr extends @path_expr, PathExprBase, PathAstNode {
override string toString() { result = "PathExpr" }
/**
* Gets the `index`th attr of this path expression (0-based).
*/
Attr getAttr(int index) { path_expr_attrs(this, index, result) }
}
/**
* INTERNAL: Do not use.
* A path pattern. For example:
* ```rust
* match x {
* Foo::Bar => "ok",
* _ => "fail",
* }
* ```
*/
class PathPat extends @path_pat, Pat, PathAstNode {
override string toString() { result = "PathPat" }
}
/**
* INTERNAL: Do not use.
* A record 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;
* ```
*/
class RecordExpr extends @record_expr, Expr, PathAstNode {
override string toString() { result = "RecordExpr" }
/**
* Gets the path of this path expression, if it exists.
* Gets the record expression field list of this record expression, if it exists.
*/
Path getPath() { path_expr_paths(this, result) }
RecordExprFieldList getRecordExprFieldList() {
record_expr_record_expr_field_lists(this, result)
}
}
/**
* INTERNAL: Do not use.
* A record pattern. For example:
* ```rust
* match x {
* Foo { a: 1, b: 2 } => "ok",
* Foo { .. } => "fail",
* }
* ```
*/
class RecordPat extends @record_pat, Pat, PathAstNode {
override string toString() { result = "RecordPat" }
/**
* Gets the record pat field list of this record pat, if it exists.
*/
RecordPatFieldList getRecordPatFieldList() { record_pat_record_pat_field_lists(this, result) }
}
/**
@@ -3750,6 +3716,26 @@ module Raw {
WhereClause getWhereClause() { trait_alias_where_clauses(this, result) }
}
/**
* INTERNAL: Do not use.
* A tuple struct pattern. For example:
* ```rust
* match x {
* Tuple("a", 1, 2, 3) => "great",
* Tuple(.., 3) => "fine",
* Tuple(..) => "fail",
* };
* ```
*/
class TupleStructPat extends @tuple_struct_pat, Pat, PathAstNode {
override string toString() { result = "TupleStructPat" }
/**
* Gets the `index`th field of this tuple struct pat (0-based).
*/
Pat getField(int index) { tuple_struct_pat_fields(this, index, result) }
}
/**
* INTERNAL: Do not use.
* A TypeAlias. For example:

View File

@@ -7,9 +7,8 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl
import codeql.rust.elements.Path
import codeql.rust.elements.internal.PathAstNodeImpl::Impl as PathAstNodeImpl
import codeql.rust.elements.RecordExprFieldList
import codeql.rust.elements.internal.ResolvableImpl::Impl as ResolvableImpl
/**
* INTERNAL: This module contains the fully generated definition of `RecordExpr` and should not
@@ -27,22 +26,9 @@ module Generated {
* INTERNAL: Do not reference the `Generated::RecordExpr` class directly.
* Use the subclass `RecordExpr`, where the following predicates are available.
*/
class RecordExpr extends Synth::TRecordExpr, ExprImpl::Expr, ResolvableImpl::Resolvable {
class RecordExpr extends Synth::TRecordExpr, ExprImpl::Expr, PathAstNodeImpl::PathAstNode {
override string getAPrimaryQlClass() { result = "RecordExpr" }
/**
* Gets the path of this record expression, if it exists.
*/
Path getPath() {
result =
Synth::convertPathFromRaw(Synth::convertRecordExprToRaw(this).(Raw::RecordExpr).getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
/**
* Gets the record expression field list of this record expression, if it exists.
*/

View File

@@ -7,9 +7,8 @@
private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.internal.PatImpl::Impl as PatImpl
import codeql.rust.elements.Path
import codeql.rust.elements.internal.PathAstNodeImpl::Impl as PathAstNodeImpl
import codeql.rust.elements.RecordPatFieldList
import codeql.rust.elements.internal.ResolvableImpl::Impl as ResolvableImpl
/**
* INTERNAL: This module contains the fully generated definition of `RecordPat` and should not
@@ -27,22 +26,9 @@ 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, PatImpl::Pat, ResolvableImpl::Resolvable {
class RecordPat extends Synth::TRecordPat, PatImpl::Pat, PathAstNodeImpl::PathAstNode {
override string getAPrimaryQlClass() { result = "RecordPat" }
/**
* Gets the path of this record pat, if it exists.
*/
Path getPath() {
result =
Synth::convertPathFromRaw(Synth::convertRecordPatToRaw(this).(Raw::RecordPat).getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
/**
* Gets the record pat field list of this record pat, if it exists.
*/

View File

@@ -14,7 +14,7 @@ import codeql.rust.elements.internal.AstNodeImpl::Impl as AstNodeImpl
*/
module Generated {
/**
* Either a `PathExpr`, a `PathPat`, or a `MethodCallExpr`.
* One of `PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat` or `MethodCallExpr`.
* INTERNAL: Do not reference the `Generated::Resolvable` class directly.
* Use the subclass `Resolvable`, where the following predicates are available.
*/

View File

@@ -713,6 +713,11 @@ module Synth {
TPathPat or TRangePat or TRecordPat or TRefPat or TRestPat or TSlicePat or TTuplePat or
TTupleStructPat or TWildcardPat;
/**
* INTERNAL: Do not use.
*/
class TPathAstNode = TPathExpr or TPathPat or TRecordExpr or TRecordPat or TTupleStructPat;
/**
* INTERNAL: Do not use.
*/
@@ -721,8 +726,7 @@ module Synth {
/**
* INTERNAL: Do not use.
*/
class TResolvable =
TMethodCallExpr or TPathExprBase or TPathPat or TRecordExpr or TRecordPat or TTupleStructPat;
class TResolvable = TMethodCallExpr or TPathAstNode;
/**
* INTERNAL: Do not use.
@@ -2053,6 +2057,22 @@ module Synth {
result = convertWildcardPatFromRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `TPathAstNode`, if possible.
*/
TPathAstNode convertPathAstNodeFromRaw(Raw::Element e) {
result = convertPathExprFromRaw(e)
or
result = convertPathPatFromRaw(e)
or
result = convertRecordExprFromRaw(e)
or
result = convertRecordPatFromRaw(e)
or
result = convertTupleStructPatFromRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a raw DB element to a synthesized `TPathExprBase`, if possible.
@@ -2070,15 +2090,7 @@ module Synth {
TResolvable convertResolvableFromRaw(Raw::Element e) {
result = convertMethodCallExprFromRaw(e)
or
result = convertPathExprBaseFromRaw(e)
or
result = convertPathPatFromRaw(e)
or
result = convertRecordExprFromRaw(e)
or
result = convertRecordPatFromRaw(e)
or
result = convertTupleStructPatFromRaw(e)
result = convertPathAstNodeFromRaw(e)
}
/**
@@ -3447,6 +3459,22 @@ module Synth {
result = convertWildcardPatToRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TPathAstNode` to a raw DB element, if possible.
*/
Raw::Element convertPathAstNodeToRaw(TPathAstNode e) {
result = convertPathExprToRaw(e)
or
result = convertPathPatToRaw(e)
or
result = convertRecordExprToRaw(e)
or
result = convertRecordPatToRaw(e)
or
result = convertTupleStructPatToRaw(e)
}
/**
* INTERNAL: Do not use.
* Converts a synthesized `TPathExprBase` to a raw DB element, if possible.
@@ -3464,15 +3492,7 @@ module Synth {
Raw::Element convertResolvableToRaw(TResolvable e) {
result = convertMethodCallExprToRaw(e)
or
result = convertPathExprBaseToRaw(e)
or
result = convertPathPatToRaw(e)
or
result = convertRecordExprToRaw(e)
or
result = convertRecordPatToRaw(e)
or
result = convertTupleStructPatToRaw(e)
result = convertPathAstNodeToRaw(e)
}
/**

View File

@@ -8,8 +8,7 @@ private import codeql.rust.elements.internal.generated.Synth
private import codeql.rust.elements.internal.generated.Raw
import codeql.rust.elements.Pat
import codeql.rust.elements.internal.PatImpl::Impl as PatImpl
import codeql.rust.elements.Path
import codeql.rust.elements.internal.ResolvableImpl::Impl as ResolvableImpl
import codeql.rust.elements.internal.PathAstNodeImpl::Impl as PathAstNodeImpl
/**
* INTERNAL: This module contains the fully generated definition of `TupleStructPat` and should not
@@ -28,7 +27,7 @@ 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, PatImpl::Pat, ResolvableImpl::Resolvable {
class TupleStructPat extends Synth::TTupleStructPat, PatImpl::Pat, PathAstNodeImpl::PathAstNode {
override string getAPrimaryQlClass() { result = "TupleStructPat" }
/**
@@ -50,20 +49,5 @@ module Generated {
* Gets the number of fields of this tuple struct pat.
*/
final int getNumberOfFields() { result = count(int i | exists(this.getField(i))) }
/**
* Gets the path of this tuple struct pat, if it exists.
*/
Path getPath() {
result =
Synth::convertPathFromRaw(Synth::convertTupleStructPatToRaw(this)
.(Raw::TupleStructPat)
.getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
}
}

View File

@@ -12,9 +12,8 @@ private class ReqwestGet extends RemoteSource::Range {
ReqwestGet() {
exists(CallExpr ce |
this.asExpr().getExpr() = ce and
ce.getFunction().(PathExpr).getPath().getResolvedCrateOrigin().matches("%reqwest") and
ce.getFunction().(PathExpr).getPath().getResolvedPath() =
["crate::get", "crate::blocking::get"]
ce.getFunction().(PathExpr).getResolvedCrateOrigin().matches("%reqwest") and
ce.getFunction().(PathExpr).getResolvedPath() = ["crate::get", "crate::blocking::get"]
)
}
}

View File

@@ -10,7 +10,7 @@ private import codeql.rust.Concepts
*/
private class StdEnvArgs extends CommandLineArgsSource::Range {
StdEnvArgs() {
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getPath().getResolvedPath() =
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getResolvedPath() =
["crate::env::args", "crate::env::args_os"]
}
}
@@ -20,7 +20,7 @@ private class StdEnvArgs extends CommandLineArgsSource::Range {
*/
private class StdEnvDir extends CommandLineArgsSource::Range {
StdEnvDir() {
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getPath().getResolvedPath() =
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getResolvedPath() =
["crate::env::current_dir", "crate::env::current_exe", "crate::env::home_dir"]
}
}
@@ -30,7 +30,7 @@ private class StdEnvDir extends CommandLineArgsSource::Range {
*/
private class StdEnvVar extends EnvironmentSource::Range {
StdEnvVar() {
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getPath().getResolvedPath() =
this.asExpr().getExpr().(CallExpr).getFunction().(PathExpr).getResolvedPath() =
["crate::env::var", "crate::env::var_os", "crate::env::vars", "crate::env::vars_os"]
}
}

View File

@@ -843,11 +843,7 @@ rename_names(
@resolvable =
@method_call_expr
| @path_expr_base
| @path_pat
| @record_expr
| @record_pat
| @tuple_struct_pat
| @path_ast_node
;
#keyset[id]
@@ -1984,20 +1980,24 @@ paren_type_ties(
int ty: @type_ref ref
);
@path_ast_node =
@path_expr
| @path_pat
| @record_expr
| @record_pat
| @tuple_struct_pat
;
#keyset[id]
path_ast_node_paths(
int id: @path_ast_node ref,
int path: @path ref
);
@path_expr_base =
@path_expr
;
path_pats(
unique int id: @path_pat
);
#keyset[id]
path_pat_paths(
int id: @path_pat ref,
int path: @path ref
);
path_types(
unique int id: @path_type
);
@@ -2102,22 +2102,6 @@ range_pat_starts(
int start: @pat ref
);
record_exprs(
unique int id: @record_expr
);
#keyset[id]
record_expr_paths(
int id: @record_expr ref,
int path: @path ref
);
#keyset[id]
record_expr_record_expr_field_lists(
int id: @record_expr ref,
int record_expr_field_list: @record_expr_field_list ref
);
record_field_lists(
unique int id: @record_field_list
);
@@ -2129,22 +2113,6 @@ record_field_list_fields(
int field: @record_field ref
);
record_pats(
unique int id: @record_pat
);
#keyset[id]
record_pat_paths(
int id: @record_pat ref,
int path: @path ref
);
#keyset[id]
record_pat_record_pat_field_lists(
int id: @record_pat ref,
int record_pat_field_list: @record_pat_field_list ref
);
ref_exprs(
unique int id: @ref_expr
);
@@ -2340,23 +2308,6 @@ tuple_pat_fields(
int field: @pat ref
);
tuple_struct_pats(
unique int id: @tuple_struct_pat
);
#keyset[id, index]
tuple_struct_pat_fields(
int id: @tuple_struct_pat ref,
int index: int ref,
int field: @pat ref
);
#keyset[id]
tuple_struct_pat_paths(
int id: @tuple_struct_pat ref,
int path: @path ref
);
tuple_types(
unique int id: @tuple_type
);
@@ -2991,10 +2942,28 @@ path_expr_attrs(
int attr: @attr ref
);
path_pats(
unique int id: @path_pat
);
record_exprs(
unique int id: @record_expr
);
#keyset[id]
path_expr_paths(
int id: @path_expr ref,
int path: @path ref
record_expr_record_expr_field_lists(
int id: @record_expr ref,
int record_expr_field_list: @record_expr_field_list ref
);
record_pats(
unique int id: @record_pat
);
#keyset[id]
record_pat_record_pat_field_lists(
int id: @record_pat ref,
int record_pat_field_list: @record_pat_field_list ref
);
statics(
@@ -3181,6 +3150,17 @@ trait_alias_where_clauses(
int where_clause: @where_clause ref
);
tuple_struct_pats(
unique int id: @tuple_struct_pat
);
#keyset[id, index]
tuple_struct_pat_fields(
int id: @tuple_struct_pat ref,
int index: int ref,
int field: @pat ref
);
type_aliases(
unique int id: @type_alias
);

View File

@@ -32,7 +32,7 @@ class CtorAttr extends Attr {
*/
class StdCall extends Expr {
StdCall() {
this.(CallExpr).getFunction().(PathExpr).getPath().getResolvedCrateOrigin() = "lang:std" or
this.(CallExpr).getFunction().(PathExpr).getResolvedCrateOrigin() = "lang:std" or
this.(MethodCallExpr).getResolvedCrateOrigin() = "lang:std"
}
}

View File

@@ -1,5 +1,5 @@
| gen_format_args_expr.rs:9:20:9:20 | x | hasResolvedPath: | no | hasResolvedCrateOrigin: | no |
| gen_format_args_expr.rs:9:25:9:25 | y | hasResolvedPath: | no | hasResolvedCrateOrigin: | no |
| gen_format_argument.rs:5:22:5:26 | value | hasResolvedPath: | no | hasResolvedCrateOrigin: | no |
| gen_format_argument.rs:5:29:5:33 | width | hasResolvedPath: | no | hasResolvedCrateOrigin: | no |
| gen_format_argument.rs:5:36:5:44 | precision | hasResolvedPath: | no | hasResolvedCrateOrigin: | no |
| gen_format_args_expr.rs:9:20:9:20 | x |
| gen_format_args_expr.rs:9:25:9:25 | y |
| gen_format_argument.rs:5:22:5:26 | value |
| gen_format_argument.rs:5:29:5:33 | width |
| gen_format_argument.rs:5:36:5:44 | precision |

View File

@@ -2,12 +2,6 @@
import codeql.rust.elements
import TestUtils
from FormatTemplateVariableAccess x, string hasResolvedPath, string hasResolvedCrateOrigin
where
toBeTested(x) and
not x.isUnknown() and
(if x.hasResolvedPath() then hasResolvedPath = "yes" else hasResolvedPath = "no") and
if x.hasResolvedCrateOrigin()
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin
from FormatTemplateVariableAccess x
where toBeTested(x) and not x.isUnknown()
select x

View File

@@ -1,7 +0,0 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from FormatTemplateVariableAccess x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedCrateOrigin()

View File

@@ -1,7 +0,0 @@
// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from FormatTemplateVariableAccess x
where toBeTested(x) and not x.isUnknown()
select x, x.getResolvedPath()

View File

@@ -1,6 +1,6 @@
| gen_path.rs:6:5:6:12 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:5:13:5:20 | variable | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:6:13:6:20 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:7:13:7:20 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_expr.rs:8:13:8:35 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path_pat.rs:5:11:5:11 | x | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfAttrs: | 0 | hasPath: | yes |
| gen_path.rs:6:5:6:12 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:5:13:5:20 | variable | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:6:13:6:20 | ...::bar | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:7:13:7:20 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_expr.rs:8:13:8:35 | ...::foo | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |
| gen_path_pat.rs:5:11:5:11 | x | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfAttrs: | 0 |

View File

@@ -3,8 +3,8 @@ import codeql.rust.elements
import TestUtils
from
PathExpr x, string hasResolvedPath, string hasResolvedCrateOrigin, int getNumberOfAttrs,
string hasPath
PathExpr x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath,
int getNumberOfAttrs
where
toBeTested(x) and
not x.isUnknown() and
@@ -14,7 +14,7 @@ where
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
getNumberOfAttrs = x.getNumberOfAttrs() and
if x.hasPath() then hasPath = "yes" else hasPath = "no"
(if x.hasPath() then hasPath = "yes" else hasPath = "no") and
getNumberOfAttrs = x.getNumberOfAttrs()
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"getNumberOfAttrs:", getNumberOfAttrs, "hasPath:", hasPath
"hasPath:", hasPath, "getNumberOfAttrs:", getNumberOfAttrs

View File

@@ -1,3 +1,3 @@
| gen_tuple_struct_pat.rs:6:9:6:27 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfFields: | 4 | hasPath: | yes |
| gen_tuple_struct_pat.rs:7:9:7:20 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfFields: | 2 | hasPath: | yes |
| gen_tuple_struct_pat.rs:8:9:8:17 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | getNumberOfFields: | 1 | hasPath: | yes |
| gen_tuple_struct_pat.rs:6:9:6:27 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfFields: | 4 |
| gen_tuple_struct_pat.rs:7:9:7:20 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfFields: | 2 |
| gen_tuple_struct_pat.rs:8:9:8:17 | Tuple(...) | hasResolvedPath: | no | hasResolvedCrateOrigin: | no | hasPath: | yes | getNumberOfFields: | 1 |

View File

@@ -3,8 +3,8 @@ import codeql.rust.elements
import TestUtils
from
TupleStructPat x, string hasResolvedPath, string hasResolvedCrateOrigin, int getNumberOfFields,
string hasPath
TupleStructPat x, string hasResolvedPath, string hasResolvedCrateOrigin, string hasPath,
int getNumberOfFields
where
toBeTested(x) and
not x.isUnknown() and
@@ -14,7 +14,7 @@ where
then hasResolvedCrateOrigin = "yes"
else hasResolvedCrateOrigin = "no"
) and
getNumberOfFields = x.getNumberOfFields() and
if x.hasPath() then hasPath = "yes" else hasPath = "no"
(if x.hasPath() then hasPath = "yes" else hasPath = "no") and
getNumberOfFields = x.getNumberOfFields()
select x, "hasResolvedPath:", hasResolvedPath, "hasResolvedCrateOrigin:", hasResolvedCrateOrigin,
"getNumberOfFields:", getNumberOfFields, "hasPath:", hasPath
"hasPath:", hasPath, "getNumberOfFields:", getNumberOfFields

View File

@@ -10,9 +10,9 @@ module MyFlowConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelSource }
predicate isSink(DataFlow::Node sink) {
any(CallExpr call |
call.getFunction().(PathExpr).getPath().getResolvedPath() = "crate::test::sink"
).getArgList().getAnArg() = sink.asExpr().getExpr()
any(CallExpr call | call.getFunction().(PathExpr).getResolvedPath() = "crate::test::sink")
.getArgList()
.getAnArg() = sink.asExpr().getExpr()
}
}

View File

@@ -114,13 +114,13 @@ class _:
"""
class PathExprBase(Expr, Resolvable):
class PathExprBase(Expr):
"""
A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
"""
@annotate(PathExpr, replace_bases={Expr: PathExprBase}, cfg = True)
@annotate(PathExpr, replace_bases={Expr: PathExprBase}, add_bases=(PathAstNode,), cfg = True)
@qltest.test_with(Path)
class _:
"""
@@ -132,6 +132,7 @@ class _:
let z = <TypeRef as Trait>::foo;
```
"""
path: drop
@annotate(IfExpr, cfg = True)
@@ -412,7 +413,7 @@ class _:
"""
@annotate(RecordExpr, add_bases=(Resolvable,), cfg = True)
@annotate(RecordExpr, add_bases=(PathAstNode,), cfg = True)
class _:
"""
A record expression. For example:
@@ -423,6 +424,7 @@ class _:
Foo { .. } = second;
```
"""
path: drop
@annotate(FieldExpr, cfg = True)
@@ -682,7 +684,7 @@ class _:
"""
@annotate(RecordPat, add_bases=(Resolvable,), cfg = True)
@annotate(RecordPat, add_bases=(PathAstNode,), cfg = True)
class _:
"""
A record pattern. For example:
@@ -693,6 +695,7 @@ class _:
}
```
"""
path: drop
@annotate(RangePat, cfg = True)
@@ -723,7 +726,7 @@ class _:
"""
@annotate(PathPat, add_bases=(Resolvable,), cfg = True)
@annotate(PathPat, add_bases=(PathAstNode,), cfg = True)
@qltest.test_with(Path)
class _:
"""
@@ -735,6 +738,7 @@ class _:
}
```
"""
path: drop
@annotate(LiteralPat, cfg = True)
@@ -769,7 +773,7 @@ class _:
"""
@annotate(TupleStructPat, add_bases=(Resolvable,), cfg = True)
@annotate(TupleStructPat, add_bases=(PathAstNode,), cfg = True)
class _:
"""
A tuple struct pattern. For example:
@@ -781,6 +785,7 @@ class _:
};
```
"""
path: drop
@annotate(RefPat, cfg = True)

View File

@@ -89,7 +89,14 @@ class Addressable(AstNode):
class Resolvable(AstNode):
"""
Either a `PathExpr`, a `PathPat`, or a `MethodCallExpr`.
One of `PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat` or `MethodCallExpr`.
"""
resolved_path: optional[string] | rust.detach | ql.internal
resolved_crate_origin: optional[string] | rust.detach | ql.internal
class PathAstNode(Resolvable):
"""
An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
"""
path: optional["Path"] | child