mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: introduce typed labels
This commit is contained in:
@@ -20,7 +20,7 @@ def _get_type(t: str) -> str:
|
|||||||
case "int":
|
case "int":
|
||||||
return "usize"
|
return "usize"
|
||||||
case _ if t[0].isupper():
|
case _ if t[0].isupper():
|
||||||
return "trap::Label"
|
return f"{t}TrapLabel"
|
||||||
case "boolean":
|
case "boolean":
|
||||||
assert False, "boolean unsupported"
|
assert False, "boolean unsupported"
|
||||||
case _:
|
case _:
|
||||||
@@ -57,6 +57,15 @@ def _get_properties(
|
|||||||
yield cls, p
|
yield cls, p
|
||||||
|
|
||||||
|
|
||||||
|
def _get_ancestors(
|
||||||
|
cls: schema.Class, lookup: dict[str, schema.Class]
|
||||||
|
) -> typing.Iterable[schema.Class]:
|
||||||
|
for b in cls.bases:
|
||||||
|
base = lookup[b]
|
||||||
|
yield base
|
||||||
|
yield from _get_ancestors(base, lookup)
|
||||||
|
|
||||||
|
|
||||||
class Processor:
|
class Processor:
|
||||||
def __init__(self, data: schema.Schema):
|
def __init__(self, data: schema.Schema):
|
||||||
self._classmap = data.classes
|
self._classmap = data.classes
|
||||||
@@ -69,14 +78,15 @@ class Processor:
|
|||||||
_get_field(c, p)
|
_get_field(c, p)
|
||||||
for c, p in _get_properties(cls, self._classmap)
|
for c, p in _get_properties(cls, self._classmap)
|
||||||
if "rust_skip" not in p.pragmas and not p.synth
|
if "rust_skip" not in p.pragmas and not p.synth
|
||||||
],
|
] if not cls.derived else [],
|
||||||
|
ancestors=sorted(set(a.name for a in _get_ancestors(cls, self._classmap))),
|
||||||
table_name=inflection.tableize(cls.name),
|
table_name=inflection.tableize(cls.name),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_classes(self):
|
def get_classes(self):
|
||||||
ret = {"": []}
|
ret = {"": []}
|
||||||
for k, cls in self._classmap.items():
|
for k, cls in self._classmap.items():
|
||||||
if not cls.synth and not cls.derived:
|
if not cls.synth:
|
||||||
ret.setdefault(cls.group, []).append(self._get_class(cls.name))
|
ret.setdefault(cls.group, []).append(self._get_class(cls.name))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|||||||
@@ -110,8 +110,9 @@ class Field:
|
|||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
class Class:
|
class Class:
|
||||||
name: str
|
name: str
|
||||||
table_name: str
|
table_name: str | None = None
|
||||||
fields: list[Field] = dataclasses.field(default_factory=list)
|
fields: list[Field] = dataclasses.field(default_factory=list)
|
||||||
|
ancestors: list[str] = dataclasses.field(default_factory=list)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def single_field_entries(self):
|
def single_field_entries(self):
|
||||||
|
|||||||
@@ -2,48 +2,77 @@
|
|||||||
|
|
||||||
#![cfg_attr(any(), rustfmt::skip)]
|
#![cfg_attr(any(), rustfmt::skip)]
|
||||||
|
|
||||||
use crate::trap::{TrapId, TrapEntry};
|
use crate::trap;
|
||||||
use codeql_extractor::trap;
|
|
||||||
{{#classes}}
|
{{#classes}}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||||
|
pub struct {{name}}TrapLabel(trap::UntypedLabel);
|
||||||
|
|
||||||
|
impl From<trap::UntypedLabel> for {{name}}TrapLabel {
|
||||||
|
fn from(value: trap::UntypedLabel) -> Self {
|
||||||
|
Self(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<{{name}}TrapLabel> for trap::TrapId<{{name}}> {
|
||||||
|
fn from(value: {{name}}TrapLabel) -> Self {
|
||||||
|
Self::Label(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl trap::Label for {{name}}TrapLabel {
|
||||||
|
fn as_untyped(&self) -> trap::UntypedLabel {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<{{name}}TrapLabel> for trap::Arg {
|
||||||
|
fn from(value: {{name}}TrapLabel) -> Self {
|
||||||
|
value.0.into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#table_name}}
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct {{name}} {
|
pub struct {{name}} {
|
||||||
pub id: TrapId,
|
pub id: trap::TrapId<{{name}}>,
|
||||||
{{#fields}}
|
{{#fields}}
|
||||||
pub {{field_name}}: {{type}},
|
pub {{field_name}}: {{type}},
|
||||||
{{/fields}}
|
{{/fields}}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TrapEntry for {{name}} {
|
impl trap::TrapEntry for {{name}} {
|
||||||
fn extract_id(&mut self) -> TrapId {
|
fn class_name() -> &'static str { "{{name}}" }
|
||||||
std::mem::replace(&mut self.id, TrapId::Star)
|
|
||||||
|
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||||
|
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
|
fn emit(self, id: Self::Label, out: &mut trap::Writer) {
|
||||||
{{#single_field_entries}}
|
{{#single_field_entries}}
|
||||||
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{#fields}}, self.{{field_name}}.into(){{/fields}}]);
|
out.add_tuple("{{table_name}}", vec![id.into(){{#fields}}, self.{{field_name}}.into(){{/fields}}]);
|
||||||
{{/single_field_entries}}
|
{{/single_field_entries}}
|
||||||
{{#fields}}
|
{{#fields}}
|
||||||
{{#is_predicate}}
|
{{#is_predicate}}
|
||||||
if self.{{field_name}} {
|
if self.{{field_name}} {
|
||||||
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id)]);
|
out.add_tuple("{{table_name}}", vec![id.into()]);
|
||||||
}
|
}
|
||||||
{{/is_predicate}}
|
{{/is_predicate}}
|
||||||
{{#is_optional}}
|
{{#is_optional}}
|
||||||
{{^is_repeated}}
|
{{^is_repeated}}
|
||||||
if let Some(v) = self.{{field_name}} {
|
if let Some(v) = self.{{field_name}} {
|
||||||
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id), v.into()]);
|
out.add_tuple("{{table_name}}", vec![id.into(), v.into()]);
|
||||||
}
|
}
|
||||||
{{/is_repeated}}
|
{{/is_repeated}}
|
||||||
{{/is_optional}}
|
{{/is_optional}}
|
||||||
{{#is_repeated}}
|
{{#is_repeated}}
|
||||||
for (i, v) in self.{{field_name}}.into_iter().enumerate() {
|
for (i, v) in self.{{field_name}}.into_iter().enumerate() {
|
||||||
{{^is_optional}}
|
{{^is_optional}}
|
||||||
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]);
|
out.add_tuple("{{table_name}}", vec![id.into(){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]);
|
||||||
{{/is_optional}}
|
{{/is_optional}}
|
||||||
{{#is_optional}}
|
{{#is_optional}}
|
||||||
if let Some(v) = v {
|
if let Some(v) = v {
|
||||||
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]);
|
out.add_tuple("{{table_name}}", vec![id.into(){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]);
|
||||||
}
|
}
|
||||||
{{/is_optional}}
|
{{/is_optional}}
|
||||||
}
|
}
|
||||||
@@ -51,4 +80,26 @@ impl TrapEntry for {{name}} {
|
|||||||
{{/fields}}
|
{{/fields}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{{/table_name}}
|
||||||
|
{{^table_name}}
|
||||||
|
{{! virtual class, make it unbuildable }}
|
||||||
|
pub struct {{name}} {
|
||||||
|
unused: ()
|
||||||
|
}
|
||||||
|
{{/table_name}}
|
||||||
|
|
||||||
|
impl trap::TrapClass for {{name}} {
|
||||||
|
type Label = {{name}}TrapLabel;
|
||||||
|
}
|
||||||
|
{{/classes}}
|
||||||
|
|
||||||
|
// Conversions
|
||||||
|
{{#classes}}
|
||||||
|
{{#ancestors}}
|
||||||
|
impl From<{{name}}TrapLabel> for {{.}}TrapLabel {
|
||||||
|
fn from(value: {{name}}TrapLabel) -> Self {
|
||||||
|
value.0.into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/ancestors}}
|
||||||
{{/classes}}
|
{{/classes}}
|
||||||
|
|||||||
2
rust/extractor/src/generated/.generated.list
generated
2
rust/extractor/src/generated/.generated.list
generated
@@ -1,2 +1,2 @@
|
|||||||
mod.rs 7cdfedcd68cf8e41134daf810c1af78624082b0c3e8be6570339b1a69a5d457e 7cdfedcd68cf8e41134daf810c1af78624082b0c3e8be6570339b1a69a5d457e
|
mod.rs 7cdfedcd68cf8e41134daf810c1af78624082b0c3e8be6570339b1a69a5d457e 7cdfedcd68cf8e41134daf810c1af78624082b0c3e8be6570339b1a69a5d457e
|
||||||
top.rs 7150acaeab0b57039ca9f2ed20311229aab5fd48b533f13410ecc34fd8e3bda0 7150acaeab0b57039ca9f2ed20311229aab5fd48b533f13410ecc34fd8e3bda0
|
top.rs e06dc90de4abd57719786fd5e49e6ea3089ec3ec167c64446e25d95a16b1714c e06dc90de4abd57719786fd5e49e6ea3089ec3ec167c64446e25d95a16b1714c
|
||||||
|
|||||||
4820
rust/extractor/src/generated/top.rs
generated
4820
rust/extractor/src/generated/top.rs
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,18 @@ use log::debug;
|
|||||||
use ra_ap_ide_db::line_index::LineCol;
|
use ra_ap_ide_db::line_index::LineCol;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
use std::hash::Hash;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
pub use trap::Label as UntypedLabel;
|
||||||
|
pub use trap::{Arg, Writer};
|
||||||
|
|
||||||
//TODO: typed labels
|
//TODO: typed labels
|
||||||
pub trait AsTrapKeyPart {
|
pub trait AsTrapKeyPart {
|
||||||
fn as_key_part(&self) -> String;
|
fn as_key_part(&self) -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsTrapKeyPart for trap::Label {
|
impl AsTrapKeyPart for UntypedLabel {
|
||||||
fn as_key_part(&self) -> String {
|
fn as_key_part(&self) -> String {
|
||||||
format!("{{{}}}", self)
|
format!("{{{}}}", self)
|
||||||
}
|
}
|
||||||
@@ -31,27 +35,27 @@ impl AsTrapKeyPart for &str {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum TrapId {
|
pub enum TrapId<T: TrapEntry> {
|
||||||
Star,
|
Star,
|
||||||
Key(String),
|
Key(String),
|
||||||
Label(trap::Label),
|
Label(T::Label),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<String> for TrapId {
|
impl<T: TrapEntry> From<String> for TrapId<T> {
|
||||||
fn from(value: String) -> Self {
|
fn from(value: String) -> Self {
|
||||||
TrapId::Key(value)
|
TrapId::Key(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&str> for TrapId {
|
impl<T: TrapEntry> From<&str> for TrapId<T> {
|
||||||
fn from(value: &str) -> Self {
|
fn from(value: &str) -> Self {
|
||||||
TrapId::Key(value.into())
|
TrapId::Key(value.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<trap::Label> for TrapId {
|
impl<T: TrapEntry> From<UntypedLabel> for TrapId<T> {
|
||||||
fn from(value: trap::Label) -> Self {
|
fn from(value: UntypedLabel) -> Self {
|
||||||
TrapId::Label(value)
|
TrapId::Label(value.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,9 +70,23 @@ macro_rules! trap_key {
|
|||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TrapEntry: std::fmt::Debug {
|
pub trait Label: From<UntypedLabel> + Clone + Debug + Hash + Into<Arg> {
|
||||||
fn extract_id(&mut self) -> TrapId;
|
fn as_untyped(&self) -> UntypedLabel;
|
||||||
fn emit(self, id: trap::Label, out: &mut trap::Writer);
|
|
||||||
|
fn as_key_part(&self) -> String {
|
||||||
|
self.as_untyped().as_key_part()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait TrapClass {
|
||||||
|
type Label: Label;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait TrapEntry: std::fmt::Debug + TrapClass + Sized {
|
||||||
|
fn class_name() -> &'static str;
|
||||||
|
|
||||||
|
fn extract_id(&mut self) -> TrapId<Self>;
|
||||||
|
fn emit(self, id: Self::Label, out: &mut trap::Writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TrapFile {
|
pub struct TrapFile {
|
||||||
@@ -78,10 +96,10 @@ pub struct TrapFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TrapFile {
|
impl TrapFile {
|
||||||
pub fn emit_location(
|
pub fn emit_location<L: Label>(
|
||||||
&mut self,
|
&mut self,
|
||||||
file_label: trap::Label,
|
file_label: UntypedLabel,
|
||||||
entity_label: trap::Label,
|
entity_label: L,
|
||||||
start: LineCol,
|
start: LineCol,
|
||||||
end: LineCol,
|
end: LineCol,
|
||||||
) {
|
) {
|
||||||
@@ -101,10 +119,7 @@ impl TrapFile {
|
|||||||
);
|
);
|
||||||
self.writer.add_tuple(
|
self.writer.add_tuple(
|
||||||
"locatable_locations",
|
"locatable_locations",
|
||||||
vec![
|
vec![entity_label.into(), location_label.into()],
|
||||||
trap::Arg::Label(entity_label),
|
|
||||||
trap::Arg::Label(location_label),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,17 +127,21 @@ impl TrapFile {
|
|||||||
extractor::populate_file(&mut self.writer, absolute_path)
|
extractor::populate_file(&mut self.writer, absolute_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn label(&mut self, id: TrapId) -> trap::Label {
|
pub fn label<T: TrapEntry>(&mut self, id: TrapId<T>) -> T::Label {
|
||||||
match id {
|
match id {
|
||||||
TrapId::Star => self.writer.fresh_id(),
|
TrapId::Star => self.writer.fresh_id().into(),
|
||||||
TrapId::Key(s) => self.writer.global_id(&s).0,
|
TrapId::Key(s) => self
|
||||||
|
.writer
|
||||||
|
.global_id(&format!("{},{}", T::class_name(), s))
|
||||||
|
.0
|
||||||
|
.into(),
|
||||||
TrapId::Label(l) => l,
|
TrapId::Label(l) => l,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn emit<T: TrapEntry>(&mut self, mut e: T) -> trap::Label {
|
pub fn emit<T: TrapEntry>(&mut self, mut e: T) -> T::Label {
|
||||||
let label = self.label(e.extract_id());
|
let label = self.label(e.extract_id());
|
||||||
e.emit(label, &mut self.writer);
|
e.emit(label.clone(), &mut self.writer);
|
||||||
label
|
label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
rust/ql/.generated.list
generated
13
rust/ql/.generated.list
generated
@@ -111,7 +111,6 @@ lib/codeql/rust/elements/TuplePatConstructor.qll 505c4f440b47da576acd7e3fc69d6b4
|
|||||||
lib/codeql/rust/elements/TupleStructPat.qll 50b7d89498dbe6737d97325037156c7689fd8d7e776d66fef9551f173fa3f2d6 f42edcf42be877424ecf2f11c90166a90f485249b24d73ed302294299d6a9bcd
|
lib/codeql/rust/elements/TupleStructPat.qll 50b7d89498dbe6737d97325037156c7689fd8d7e776d66fef9551f173fa3f2d6 f42edcf42be877424ecf2f11c90166a90f485249b24d73ed302294299d6a9bcd
|
||||||
lib/codeql/rust/elements/TupleStructPatConstructor.qll 15a15362572ac2dc98ed3257f195f20bb8dfe34a1fe203cf2a1a193ce16c406f 9e590b50cf865f6bc573b6fc17acea073f0d9389be241b01e820d9f3f8f14acb
|
lib/codeql/rust/elements/TupleStructPatConstructor.qll 15a15362572ac2dc98ed3257f195f20bb8dfe34a1fe203cf2a1a193ce16c406f 9e590b50cf865f6bc573b6fc17acea073f0d9389be241b01e820d9f3f8f14acb
|
||||||
lib/codeql/rust/elements/TypeRef.qll 223844544eab3e07b6edda805c6344fa8b486aeea7bbe62e4b98e235ce2008d8 7517748b0e7a57c925168f5ce7a31ecc1b59f7521a2095578f599b8d9045a4e5
|
lib/codeql/rust/elements/TypeRef.qll 223844544eab3e07b6edda805c6344fa8b486aeea7bbe62e4b98e235ce2008d8 7517748b0e7a57c925168f5ce7a31ecc1b59f7521a2095578f599b8d9045a4e5
|
||||||
lib/codeql/rust/elements/TypeRefConstructor.qll f8b2e5ef15517890a8b2d56643f471ae64cc74c420187049e33b182417e72e4f 683611e732b842756e301a77625b385bca0c4969971020c9e11220a1aa665a29
|
|
||||||
lib/codeql/rust/elements/UnaryOpExpr.qll 32e637510c03653cc28cb9a25a2873e9bf346aeb63ad2d7a571bfcbda45c59ce 044b22dd35491f9eafc6488fff5bc929aed12e2f36ac55883925c876978bf7cf
|
lib/codeql/rust/elements/UnaryOpExpr.qll 32e637510c03653cc28cb9a25a2873e9bf346aeb63ad2d7a571bfcbda45c59ce 044b22dd35491f9eafc6488fff5bc929aed12e2f36ac55883925c876978bf7cf
|
||||||
lib/codeql/rust/elements/UnaryOpExprConstructor.qll 43db7afbd3535b7edc801d99d772233a734f4ed31eeee2ca74e7ab26cae33e87 7345f8d4cb958ee2fa83d3634285f12829bdd1cbac2697236d6fae062313ab6d
|
lib/codeql/rust/elements/UnaryOpExprConstructor.qll 43db7afbd3535b7edc801d99d772233a734f4ed31eeee2ca74e7ab26cae33e87 7345f8d4cb958ee2fa83d3634285f12829bdd1cbac2697236d6fae062313ab6d
|
||||||
lib/codeql/rust/elements/UnderscoreExpr.qll cd49049149e268524412a17394daaef696ddca63f1f452b369172b9643e94d82 228568c12efc7c055f2ff7cc08c2d0ae150f6356f77ccea98b7f8be3d6bb4806
|
lib/codeql/rust/elements/UnderscoreExpr.qll cd49049149e268524412a17394daaef696ddca63f1f452b369172b9643e94d82 228568c12efc7c055f2ff7cc08c2d0ae150f6356f77ccea98b7f8be3d6bb4806
|
||||||
@@ -171,14 +170,14 @@ lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a25686a1
|
|||||||
lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62
|
lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62
|
||||||
lib/codeql/rust/generated/OffsetOfExpr.qll 58dfd632efcb48de7fe6ffbcb2192fcf95bfabdb407a751133f63a0e32ae7489 21ebb1b3d66849fc21c04083cfa751eb56c55809cd52664020bd61ccfbe5ea68
|
lib/codeql/rust/generated/OffsetOfExpr.qll 58dfd632efcb48de7fe6ffbcb2192fcf95bfabdb407a751133f63a0e32ae7489 21ebb1b3d66849fc21c04083cfa751eb56c55809cd52664020bd61ccfbe5ea68
|
||||||
lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398
|
lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398
|
||||||
lib/codeql/rust/generated/ParentChild.qll e1658ad4b3406b882726ed623e3668b99d1353c92c22f2939e2b7fc2b4053711 739da3c782d40cbd83c2b1d752376a0363802b64b950bea61e79cfb63bdd4f6d
|
lib/codeql/rust/generated/ParentChild.qll f101e2538cd97f54651d995271dda8ecf5d80a204522506b01994a2e37cfac7a 5d1ef956058bb407f3038787b2be2127afdc2a6910a434cce8dd35037c8841a3
|
||||||
lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7
|
lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7
|
||||||
lib/codeql/rust/generated/PathExpr.qll 3664ed2ad08097e4446b0fdad148118c754f8203541ae588d967ba9d79b6bf21 0d987d2358fe9b42e57585e7ae906de80e9f4ccf7c20e1d9bb7624ffbad96941
|
lib/codeql/rust/generated/PathExpr.qll 3664ed2ad08097e4446b0fdad148118c754f8203541ae588d967ba9d79b6bf21 0d987d2358fe9b42e57585e7ae906de80e9f4ccf7c20e1d9bb7624ffbad96941
|
||||||
lib/codeql/rust/generated/PathPat.qll acc4dda795bae97626a8d0041538f3ba1f0b591c743fed381cf198a8b04653cb c3deee1b3bb9bd37ae3ed4761d8ee2f498384fe5e1f5e31c0f9b99dfd864a0d5
|
lib/codeql/rust/generated/PathPat.qll acc4dda795bae97626a8d0041538f3ba1f0b591c743fed381cf198a8b04653cb c3deee1b3bb9bd37ae3ed4761d8ee2f498384fe5e1f5e31c0f9b99dfd864a0d5
|
||||||
lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573
|
lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573
|
||||||
lib/codeql/rust/generated/RangeExpr.qll f499d8c1f260d6262a55c1f3640aaee832ed8c9aac922cb2e05fefbca4509053 a01563640bc23fbce9d33da756bc209fd16155dc76a7fed4ba325979723f48a5
|
lib/codeql/rust/generated/RangeExpr.qll f499d8c1f260d6262a55c1f3640aaee832ed8c9aac922cb2e05fefbca4509053 a01563640bc23fbce9d33da756bc209fd16155dc76a7fed4ba325979723f48a5
|
||||||
lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4
|
lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4
|
||||||
lib/codeql/rust/generated/Raw.qll fcc1c9f3b06f7c1ae5ad6f7e7ab508c5fbbe9f13a5888db7e1a1e878d53b0f7e 45b6ee33b3ebe83d7f297eb0a9700da42648dc6228caed1e6649e940ea304907
|
lib/codeql/rust/generated/Raw.qll 8d6b4ff602a89f779b15d84885b1d165ab23e9fc8b5953d1dfd3294daf492d8d 04366012c0d1278ed49b753d1d39cf96fbb16f7319072e2ff9714d1ecdd224c3
|
||||||
lib/codeql/rust/generated/RecordFieldPat.qll 26bed2285d849b9b7ac52d86131eacb40df912db350e423e81fb98c393c08a69 05ed735aecee90901a1bdfae05d9f85d7f6581616eca3a9262fdef6673222f9b
|
lib/codeql/rust/generated/RecordFieldPat.qll 26bed2285d849b9b7ac52d86131eacb40df912db350e423e81fb98c393c08a69 05ed735aecee90901a1bdfae05d9f85d7f6581616eca3a9262fdef6673222f9b
|
||||||
lib/codeql/rust/generated/RecordLitExpr.qll 1d3264446ff57e8b169f1ad6da150b2d457d6b60eda0ff63e2353eb8ef9e9113 f523dd5ce7f4bac0aafab7b27c6cfe766c72a9ee0c92d7a263347e67edf096df
|
lib/codeql/rust/generated/RecordLitExpr.qll 1d3264446ff57e8b169f1ad6da150b2d457d6b60eda0ff63e2353eb8ef9e9113 f523dd5ce7f4bac0aafab7b27c6cfe766c72a9ee0c92d7a263347e67edf096df
|
||||||
lib/codeql/rust/generated/RecordLitField.qll bc704b56a986f3a399dc9c3dc2b61cca0d40cd389c694b9fe13374780835ffcc ab6b05a87f240a97cc2a8c15bb84a1338ad33ce367619125a8514e8815fd050e
|
lib/codeql/rust/generated/RecordLitField.qll bc704b56a986f3a399dc9c3dc2b61cca0d40cd389c694b9fe13374780835ffcc ab6b05a87f240a97cc2a8c15bb84a1338ad33ce367619125a8514e8815fd050e
|
||||||
@@ -189,15 +188,15 @@ lib/codeql/rust/generated/RepeatExpr.qll 43aff00e966e4550179d756489e4cbc30618d66
|
|||||||
lib/codeql/rust/generated/ReturnExpr.qll 6160f3a14ff1cbd6a297edae015769f90e8e31201639828d8a9d0d6e38c1ef99 b8c8a12f78281e558d230c6959236780758e9645fe22aca697b948535c20f9be
|
lib/codeql/rust/generated/ReturnExpr.qll 6160f3a14ff1cbd6a297edae015769f90e8e31201639828d8a9d0d6e38c1ef99 b8c8a12f78281e558d230c6959236780758e9645fe22aca697b948535c20f9be
|
||||||
lib/codeql/rust/generated/SlicePat.qll b4de6692eebf1205940e04da963adc20a07b15923c3c3a7a512a24e3bd8342c9 ee9b919983807f39d97cfe8ca66b76bdbfde76db02db5c93268ce22cbddf4213
|
lib/codeql/rust/generated/SlicePat.qll b4de6692eebf1205940e04da963adc20a07b15923c3c3a7a512a24e3bd8342c9 ee9b919983807f39d97cfe8ca66b76bdbfde76db02db5c93268ce22cbddf4213
|
||||||
lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd
|
lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd
|
||||||
lib/codeql/rust/generated/Synth.qll 6d1c4648a7f705bf5d7e8f8081f835c03feb6eee99bbf5fcca825902cb0cac20 620582c3743f8e0172288660bf5b2f344d8696620675ad0a04df20da55ba9c45
|
lib/codeql/rust/generated/Synth.qll 98478a5bd0cf16a11b4dc64d4d7d7d4bcd61ee637b29ae59af93938393f804f9 e254397b85bbf3c2254c163f010cc90d08a5c658eed461778e97346e4e60ff2c
|
||||||
lib/codeql/rust/generated/SynthConstructors.qll 15f62ecc76505a326df6a6d61896892ecbacdd1edc8bb4fede39f1a84e36431e 15f62ecc76505a326df6a6d61896892ecbacdd1edc8bb4fede39f1a84e36431e
|
lib/codeql/rust/generated/SynthConstructors.qll 6cfce4c3bfb6c68cf2fa518cf9cadf0fd968219cb97a60be8e471205d459a553 6cfce4c3bfb6c68cf2fa518cf9cadf0fd968219cb97a60be8e471205d459a553
|
||||||
lib/codeql/rust/generated/TupleExpr.qll 13e4dbc1afcabf388c793145cd399789f4014662f2eed1d49cbe96eeb8355413 bfa0708885c120bad24e29deb29641c69a5e5361654f3a144ead9543bfbd7197
|
lib/codeql/rust/generated/TupleExpr.qll 13e4dbc1afcabf388c793145cd399789f4014662f2eed1d49cbe96eeb8355413 bfa0708885c120bad24e29deb29641c69a5e5361654f3a144ead9543bfbd7197
|
||||||
lib/codeql/rust/generated/TuplePat.qll 23911b2ac7ee2279df8ef40a6e447437ef0ed62518504b17874a7652bf5e3f4b fc4f6f7ea40754290de194ac55939f08549bd637104baf8dc84ca3938bcbd1f1
|
lib/codeql/rust/generated/TuplePat.qll 23911b2ac7ee2279df8ef40a6e447437ef0ed62518504b17874a7652bf5e3f4b fc4f6f7ea40754290de194ac55939f08549bd637104baf8dc84ca3938bcbd1f1
|
||||||
lib/codeql/rust/generated/TupleStructPat.qll fff004cce780501eac94fe4b146619a84e02c85cae12ffeba5a4058e8c9738ea 738659f8208aa65d1d8cf601e0d92a90a890d6cbaec51cf04c81fc75a827e30b
|
lib/codeql/rust/generated/TupleStructPat.qll fff004cce780501eac94fe4b146619a84e02c85cae12ffeba5a4058e8c9738ea 738659f8208aa65d1d8cf601e0d92a90a890d6cbaec51cf04c81fc75a827e30b
|
||||||
lib/codeql/rust/generated/TypeRef.qll 7cc468c2f473ee13c11a97c4360100376560e8fc42f25a136f1500fe31a31533 7cc468c2f473ee13c11a97c4360100376560e8fc42f25a136f1500fe31a31533
|
lib/codeql/rust/generated/TypeRef.qll 3e8321504060e2e558e6679555e32c8056969806fc367867d4a76f67b9993558 0df712b2e10d366ced1c6518754ba2f56e1a71fc39753234a321c31f46aa3fba
|
||||||
lib/codeql/rust/generated/UnaryOpExpr.qll fd55d4bc9cd1a49d1f38f02fef16771f29bb5fb2512abd18341d56665859d18c f271ef5036410c018f48d6f15b17cb9beaf4111a42fc638ac4ed3db974a5f870
|
lib/codeql/rust/generated/UnaryOpExpr.qll fd55d4bc9cd1a49d1f38f02fef16771f29bb5fb2512abd18341d56665859d18c f271ef5036410c018f48d6f15b17cb9beaf4111a42fc638ac4ed3db974a5f870
|
||||||
lib/codeql/rust/generated/UnderscoreExpr.qll cd7f615e41562b80d89e413c1c808048da7746fd445f0eb6ad8c5d9996b44d5d cd7f615e41562b80d89e413c1c808048da7746fd445f0eb6ad8c5d9996b44d5d
|
lib/codeql/rust/generated/UnderscoreExpr.qll cd7f615e41562b80d89e413c1c808048da7746fd445f0eb6ad8c5d9996b44d5d cd7f615e41562b80d89e413c1c808048da7746fd445f0eb6ad8c5d9996b44d5d
|
||||||
lib/codeql/rust/generated/Unimplemented.qll 375b7935b7f4103728ece3042282ae82d19e471d7a9fa58c8cbdea31ea0cb113 375b7935b7f4103728ece3042282ae82d19e471d7a9fa58c8cbdea31ea0cb113
|
lib/codeql/rust/generated/Unimplemented.qll e2b1da6123c7ff71f9ce1133ae2665ac4e1c401084b0eb778aa4ae78cad2d363 e2b1da6123c7ff71f9ce1133ae2665ac4e1c401084b0eb778aa4ae78cad2d363
|
||||||
lib/codeql/rust/generated/UnsafeBlockExpr.qll 8464597373ea46f6391394f02c4ceb93ffe8441b434e6e71907b0a3369f72d8e 8464597373ea46f6391394f02c4ceb93ffe8441b434e6e71907b0a3369f72d8e
|
lib/codeql/rust/generated/UnsafeBlockExpr.qll 8464597373ea46f6391394f02c4ceb93ffe8441b434e6e71907b0a3369f72d8e 8464597373ea46f6391394f02c4ceb93ffe8441b434e6e71907b0a3369f72d8e
|
||||||
lib/codeql/rust/generated/WildPat.qll 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8
|
lib/codeql/rust/generated/WildPat.qll 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8 8a2cede00ac2941cb94e294ffa81ada9ae6e61d8d8a720ce4f288740345802f8
|
||||||
lib/codeql/rust/generated/YeetExpr.qll 2b37cf55ec26958cf226885e99d81c8bbc6ece69fbe92d9fcc8884ee0bc4aad4 e371531507311ea8a9fbaac74442fe9994ae85f0acdb79cc870e5318af52aba9
|
lib/codeql/rust/generated/YeetExpr.qll 2b37cf55ec26958cf226885e99d81c8bbc6ece69fbe92d9fcc8884ee0bc4aad4 e371531507311ea8a9fbaac74442fe9994ae85f0acdb79cc870e5318af52aba9
|
||||||
|
|||||||
1
rust/ql/.gitattributes
generated
vendored
1
rust/ql/.gitattributes
generated
vendored
@@ -113,7 +113,6 @@
|
|||||||
/lib/codeql/rust/elements/TupleStructPat.qll linguist-generated
|
/lib/codeql/rust/elements/TupleStructPat.qll linguist-generated
|
||||||
/lib/codeql/rust/elements/TupleStructPatConstructor.qll linguist-generated
|
/lib/codeql/rust/elements/TupleStructPatConstructor.qll linguist-generated
|
||||||
/lib/codeql/rust/elements/TypeRef.qll linguist-generated
|
/lib/codeql/rust/elements/TypeRef.qll linguist-generated
|
||||||
/lib/codeql/rust/elements/TypeRefConstructor.qll linguist-generated
|
|
||||||
/lib/codeql/rust/elements/UnaryOpExpr.qll linguist-generated
|
/lib/codeql/rust/elements/UnaryOpExpr.qll linguist-generated
|
||||||
/lib/codeql/rust/elements/UnaryOpExprConstructor.qll linguist-generated
|
/lib/codeql/rust/elements/UnaryOpExprConstructor.qll linguist-generated
|
||||||
/lib/codeql/rust/elements/UnderscoreExpr.qll linguist-generated
|
/lib/codeql/rust/elements/UnderscoreExpr.qll linguist-generated
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
// generated by codegen, remove this comment if you wish to edit this file
|
|
||||||
/**
|
|
||||||
* This module defines the hook used internally to tweak the characteristic predicate of
|
|
||||||
* `TypeRef` synthesized instances.
|
|
||||||
* INTERNAL: Do not use.
|
|
||||||
*/
|
|
||||||
|
|
||||||
private import codeql.rust.generated.Raw
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The characteristic predicate of `TypeRef` synthesized instances.
|
|
||||||
* INTERNAL: Do not use.
|
|
||||||
*/
|
|
||||||
predicate constructTypeRef(Raw::TypeRef id) { any() }
|
|
||||||
41
rust/ql/lib/codeql/rust/generated/ParentChild.qll
generated
41
rust/ql/lib/codeql/rust/generated/ParentChild.qll
generated
@@ -174,21 +174,6 @@ private module Impl {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private Element getImmediateChildOfUnimplemented(
|
|
||||||
Unimplemented e, int index, string partialPredicateCall
|
|
||||||
) {
|
|
||||||
exists(int b, int bAstNode, int n |
|
|
||||||
b = 0 and
|
|
||||||
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
|
|
||||||
n = bAstNode and
|
|
||||||
(
|
|
||||||
none()
|
|
||||||
or
|
|
||||||
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private Element getImmediateChildOfArrayExpr(ArrayExpr e, int index, string partialPredicateCall) {
|
private Element getImmediateChildOfArrayExpr(ArrayExpr e, int index, string partialPredicateCall) {
|
||||||
exists(int b, int bExpr, int n |
|
exists(int b, int bExpr, int n |
|
||||||
b = 0 and
|
b = 0 and
|
||||||
@@ -1081,6 +1066,26 @@ private module Impl {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Element getImmediateChildOfUnimplemented(
|
||||||
|
Unimplemented e, int index, string partialPredicateCall
|
||||||
|
) {
|
||||||
|
exists(int b, int bDeclaration, int bTypeRef, int n |
|
||||||
|
b = 0 and
|
||||||
|
bDeclaration =
|
||||||
|
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfDeclaration(e, i, _)) | i) and
|
||||||
|
bTypeRef =
|
||||||
|
bDeclaration + 1 + max(int i | i = -1 or exists(getImmediateChildOfTypeRef(e, i, _)) | i) and
|
||||||
|
n = bTypeRef and
|
||||||
|
(
|
||||||
|
none()
|
||||||
|
or
|
||||||
|
result = getImmediateChildOfDeclaration(e, index - b, partialPredicateCall)
|
||||||
|
or
|
||||||
|
result = getImmediateChildOfTypeRef(e, index - bDeclaration, partialPredicateCall)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private Element getImmediateChildOfWildPat(WildPat e, int index, string partialPredicateCall) {
|
private Element getImmediateChildOfWildPat(WildPat e, int index, string partialPredicateCall) {
|
||||||
exists(int b, int bPat, int n |
|
exists(int b, int bPat, int n |
|
||||||
b = 0 and
|
b = 0 and
|
||||||
@@ -1227,10 +1232,6 @@ private module Impl {
|
|||||||
or
|
or
|
||||||
result = getImmediateChildOfRecordLitField(e, index, partialAccessor)
|
result = getImmediateChildOfRecordLitField(e, index, partialAccessor)
|
||||||
or
|
or
|
||||||
result = getImmediateChildOfTypeRef(e, index, partialAccessor)
|
|
||||||
or
|
|
||||||
result = getImmediateChildOfUnimplemented(e, index, partialAccessor)
|
|
||||||
or
|
|
||||||
result = getImmediateChildOfAwaitExpr(e, index, partialAccessor)
|
result = getImmediateChildOfAwaitExpr(e, index, partialAccessor)
|
||||||
or
|
or
|
||||||
result = getImmediateChildOfBecomeExpr(e, index, partialAccessor)
|
result = getImmediateChildOfBecomeExpr(e, index, partialAccessor)
|
||||||
@@ -1325,6 +1326,8 @@ private module Impl {
|
|||||||
or
|
or
|
||||||
result = getImmediateChildOfUnderscoreExpr(e, index, partialAccessor)
|
result = getImmediateChildOfUnderscoreExpr(e, index, partialAccessor)
|
||||||
or
|
or
|
||||||
|
result = getImmediateChildOfUnimplemented(e, index, partialAccessor)
|
||||||
|
or
|
||||||
result = getImmediateChildOfWildPat(e, index, partialAccessor)
|
result = getImmediateChildOfWildPat(e, index, partialAccessor)
|
||||||
or
|
or
|
||||||
result = getImmediateChildOfYeetExpr(e, index, partialAccessor)
|
result = getImmediateChildOfYeetExpr(e, index, partialAccessor)
|
||||||
|
|||||||
18
rust/ql/lib/codeql/rust/generated/Raw.qll
generated
18
rust/ql/lib/codeql/rust/generated/Raw.qll
generated
@@ -111,16 +111,7 @@ module Raw {
|
|||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
*/
|
*/
|
||||||
class TypeRef extends @type_ref, AstNode {
|
class TypeRef extends @type_ref, AstNode { }
|
||||||
override string toString() { result = "TypeRef" }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* INTERNAL: Do not use.
|
|
||||||
*/
|
|
||||||
class Unimplemented extends @unimplemented, AstNode {
|
|
||||||
override string toString() { result = "Unimplemented" }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
@@ -931,6 +922,13 @@ module Raw {
|
|||||||
override string toString() { result = "UnderscoreExpr" }
|
override string toString() { result = "UnderscoreExpr" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INTERNAL: Do not use.
|
||||||
|
*/
|
||||||
|
class Unimplemented extends @unimplemented, Declaration, TypeRef {
|
||||||
|
override string toString() { result = "Unimplemented" }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
*/
|
*/
|
||||||
|
|||||||
49
rust/ql/lib/codeql/rust/generated/Synth.qll
generated
49
rust/ql/lib/codeql/rust/generated/Synth.qll
generated
@@ -227,10 +227,6 @@ module Synth {
|
|||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
*/
|
*/
|
||||||
TTupleStructPat(Raw::TupleStructPat id) { constructTupleStructPat(id) } or
|
TTupleStructPat(Raw::TupleStructPat id) { constructTupleStructPat(id) } or
|
||||||
/**
|
|
||||||
* INTERNAL: Do not use.
|
|
||||||
*/
|
|
||||||
TTypeRef(Raw::TypeRef id) { constructTypeRef(id) } or
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
*/
|
*/
|
||||||
@@ -270,7 +266,7 @@ module Synth {
|
|||||||
*/
|
*/
|
||||||
class TAstNode =
|
class TAstNode =
|
||||||
TDeclaration or TExpr or TLabel or TMatchArm or TPat or TRecordFieldPat or TRecordLitField or
|
TDeclaration or TExpr or TLabel or TMatchArm or TPat or TRecordFieldPat or TRecordLitField or
|
||||||
TStmt or TTypeRef or TUnimplemented;
|
TStmt or TTypeRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
@@ -280,7 +276,7 @@ module Synth {
|
|||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
*/
|
*/
|
||||||
class TDeclaration = TFunction or TModule;
|
class TDeclaration = TFunction or TModule or TUnimplemented;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
@@ -310,6 +306,11 @@ module Synth {
|
|||||||
*/
|
*/
|
||||||
class TStmt = TExprStmt or TItemStmt or TLetStmt;
|
class TStmt = TExprStmt or TItemStmt or TLetStmt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INTERNAL: Do not use.
|
||||||
|
*/
|
||||||
|
class TTypeRef = TUnimplemented;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
* Converts a raw element to a synthesized `TAsyncBlockExpr`, if possible.
|
* Converts a raw element to a synthesized `TAsyncBlockExpr`, if possible.
|
||||||
@@ -681,13 +682,6 @@ module Synth {
|
|||||||
cached
|
cached
|
||||||
TTupleStructPat convertTupleStructPatFromRaw(Raw::Element e) { result = TTupleStructPat(e) }
|
TTupleStructPat convertTupleStructPatFromRaw(Raw::Element e) { result = TTupleStructPat(e) }
|
||||||
|
|
||||||
/**
|
|
||||||
* INTERNAL: Do not use.
|
|
||||||
* Converts a raw element to a synthesized `TTypeRef`, if possible.
|
|
||||||
*/
|
|
||||||
cached
|
|
||||||
TTypeRef convertTypeRefFromRaw(Raw::Element e) { result = TTypeRef(e) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
* Converts a raw element to a synthesized `TUnaryOpExpr`, if possible.
|
* Converts a raw element to a synthesized `TUnaryOpExpr`, if possible.
|
||||||
@@ -771,8 +765,6 @@ module Synth {
|
|||||||
result = convertStmtFromRaw(e)
|
result = convertStmtFromRaw(e)
|
||||||
or
|
or
|
||||||
result = convertTypeRefFromRaw(e)
|
result = convertTypeRefFromRaw(e)
|
||||||
or
|
|
||||||
result = convertUnimplementedFromRaw(e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -797,6 +789,8 @@ module Synth {
|
|||||||
result = convertFunctionFromRaw(e)
|
result = convertFunctionFromRaw(e)
|
||||||
or
|
or
|
||||||
result = convertModuleFromRaw(e)
|
result = convertModuleFromRaw(e)
|
||||||
|
or
|
||||||
|
result = convertUnimplementedFromRaw(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -934,6 +928,13 @@ module Synth {
|
|||||||
result = convertLetStmtFromRaw(e)
|
result = convertLetStmtFromRaw(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INTERNAL: Do not use.
|
||||||
|
* Converts a raw DB element to a synthesized `TTypeRef`, if possible.
|
||||||
|
*/
|
||||||
|
cached
|
||||||
|
TTypeRef convertTypeRefFromRaw(Raw::Element e) { result = convertUnimplementedFromRaw(e) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
* Converts a synthesized `TAsyncBlockExpr` to a raw DB element, if possible.
|
* Converts a synthesized `TAsyncBlockExpr` to a raw DB element, if possible.
|
||||||
@@ -1305,13 +1306,6 @@ module Synth {
|
|||||||
cached
|
cached
|
||||||
Raw::Element convertTupleStructPatToRaw(TTupleStructPat e) { e = TTupleStructPat(result) }
|
Raw::Element convertTupleStructPatToRaw(TTupleStructPat e) { e = TTupleStructPat(result) }
|
||||||
|
|
||||||
/**
|
|
||||||
* INTERNAL: Do not use.
|
|
||||||
* Converts a synthesized `TTypeRef` to a raw DB element, if possible.
|
|
||||||
*/
|
|
||||||
cached
|
|
||||||
Raw::Element convertTypeRefToRaw(TTypeRef e) { e = TTypeRef(result) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: Do not use.
|
* INTERNAL: Do not use.
|
||||||
* Converts a synthesized `TUnaryOpExpr` to a raw DB element, if possible.
|
* Converts a synthesized `TUnaryOpExpr` to a raw DB element, if possible.
|
||||||
@@ -1395,8 +1389,6 @@ module Synth {
|
|||||||
result = convertStmtToRaw(e)
|
result = convertStmtToRaw(e)
|
||||||
or
|
or
|
||||||
result = convertTypeRefToRaw(e)
|
result = convertTypeRefToRaw(e)
|
||||||
or
|
|
||||||
result = convertUnimplementedToRaw(e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1421,6 +1413,8 @@ module Synth {
|
|||||||
result = convertFunctionToRaw(e)
|
result = convertFunctionToRaw(e)
|
||||||
or
|
or
|
||||||
result = convertModuleToRaw(e)
|
result = convertModuleToRaw(e)
|
||||||
|
or
|
||||||
|
result = convertUnimplementedToRaw(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1557,4 +1551,11 @@ module Synth {
|
|||||||
or
|
or
|
||||||
result = convertLetStmtToRaw(e)
|
result = convertLetStmtToRaw(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* INTERNAL: Do not use.
|
||||||
|
* Converts a synthesized `TTypeRef` to a raw DB element, if possible.
|
||||||
|
*/
|
||||||
|
cached
|
||||||
|
Raw::Element convertTypeRefToRaw(TTypeRef e) { result = convertUnimplementedToRaw(e) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ import codeql.rust.elements.SlicePatConstructor
|
|||||||
import codeql.rust.elements.TupleExprConstructor
|
import codeql.rust.elements.TupleExprConstructor
|
||||||
import codeql.rust.elements.TuplePatConstructor
|
import codeql.rust.elements.TuplePatConstructor
|
||||||
import codeql.rust.elements.TupleStructPatConstructor
|
import codeql.rust.elements.TupleStructPatConstructor
|
||||||
import codeql.rust.elements.TypeRefConstructor
|
|
||||||
import codeql.rust.elements.UnaryOpExprConstructor
|
import codeql.rust.elements.UnaryOpExprConstructor
|
||||||
import codeql.rust.elements.UnderscoreExprConstructor
|
import codeql.rust.elements.UnderscoreExprConstructor
|
||||||
import codeql.rust.elements.UnimplementedConstructor
|
import codeql.rust.elements.UnimplementedConstructor
|
||||||
|
|||||||
4
rust/ql/lib/codeql/rust/generated/TypeRef.qll
generated
4
rust/ql/lib/codeql/rust/generated/TypeRef.qll
generated
@@ -17,7 +17,5 @@ module Generated {
|
|||||||
* INTERNAL: Do not reference the `Generated::TypeRef` class directly.
|
* INTERNAL: Do not reference the `Generated::TypeRef` class directly.
|
||||||
* Use the subclass `TypeRef`, where the following predicates are available.
|
* Use the subclass `TypeRef`, where the following predicates are available.
|
||||||
*/
|
*/
|
||||||
class TypeRef extends Synth::TTypeRef, AstNode {
|
class TypeRef extends Synth::TTypeRef, AstNode { }
|
||||||
override string getAPrimaryQlClass() { result = "TypeRef" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
private import codeql.rust.generated.Synth
|
private import codeql.rust.generated.Synth
|
||||||
private import codeql.rust.generated.Raw
|
private import codeql.rust.generated.Raw
|
||||||
import codeql.rust.elements.AstNode
|
import codeql.rust.elements.Declaration
|
||||||
|
import codeql.rust.elements.TypeRef
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL: This module contains the fully generated definition of `Unimplemented` and should not
|
* INTERNAL: This module contains the fully generated definition of `Unimplemented` and should not
|
||||||
@@ -17,7 +18,7 @@ module Generated {
|
|||||||
* INTERNAL: Do not reference the `Generated::Unimplemented` class directly.
|
* INTERNAL: Do not reference the `Generated::Unimplemented` class directly.
|
||||||
* Use the subclass `Unimplemented`, where the following predicates are available.
|
* Use the subclass `Unimplemented`, where the following predicates are available.
|
||||||
*/
|
*/
|
||||||
class Unimplemented extends Synth::TUnimplemented, AstNode {
|
class Unimplemented extends Synth::TUnimplemented, Declaration, TypeRef {
|
||||||
override string getAPrimaryQlClass() { result = "Unimplemented" }
|
override string getAPrimaryQlClass() { result = "Unimplemented" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,12 +137,12 @@ locatable_locations(
|
|||||||
| @record_lit_field
|
| @record_lit_field
|
||||||
| @stmt
|
| @stmt
|
||||||
| @type_ref
|
| @type_ref
|
||||||
| @unimplemented
|
|
||||||
;
|
;
|
||||||
|
|
||||||
@declaration =
|
@declaration =
|
||||||
@function
|
@function
|
||||||
| @module
|
| @module
|
||||||
|
| @unimplemented
|
||||||
;
|
;
|
||||||
|
|
||||||
@expr =
|
@expr =
|
||||||
@@ -233,13 +233,9 @@ record_lit_fields(
|
|||||||
| @let_stmt
|
| @let_stmt
|
||||||
;
|
;
|
||||||
|
|
||||||
type_refs(
|
@type_ref =
|
||||||
unique int id: @type_ref
|
@unimplemented
|
||||||
);
|
;
|
||||||
|
|
||||||
unimplementeds(
|
|
||||||
unique int id: @unimplemented
|
|
||||||
);
|
|
||||||
|
|
||||||
@array_expr =
|
@array_expr =
|
||||||
@element_list_expr
|
@element_list_expr
|
||||||
@@ -801,6 +797,10 @@ underscore_exprs(
|
|||||||
unique int id: @underscore_expr
|
unique int id: @underscore_expr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
unimplementeds(
|
||||||
|
unique int id: @unimplemented
|
||||||
|
);
|
||||||
|
|
||||||
wild_pats(
|
wild_pats(
|
||||||
unique int id: @wild_pat
|
unique int id: @wild_pat
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ class AstNode(Locatable):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@qltest.skip
|
|
||||||
class Unimplemented(AstNode):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Declaration(AstNode):
|
class Declaration(AstNode):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -95,7 +90,7 @@ class MissingExpr(Expr):
|
|||||||
|
|
||||||
|
|
||||||
class PathExpr(Expr):
|
class PathExpr(Expr):
|
||||||
path: Unimplemented | child
|
path: "Unimplemented" | child
|
||||||
|
|
||||||
# If {
|
# If {
|
||||||
# condition: ExprId,
|
# condition: ExprId,
|
||||||
@@ -196,7 +191,7 @@ class MethodCallExpr(Expr):
|
|||||||
receiver: Expr | child
|
receiver: Expr | child
|
||||||
method_name: string
|
method_name: string
|
||||||
args: list[Expr] | child
|
args: list[Expr] | child
|
||||||
generic_args: optional[Unimplemented] | child
|
generic_args: optional["Unimplemented"] | child
|
||||||
|
|
||||||
# pub struct MatchArm {
|
# pub struct MatchArm {
|
||||||
# pub pat: PatId,
|
# pub pat: PatId,
|
||||||
@@ -287,7 +282,7 @@ class RecordLitField(AstNode):
|
|||||||
|
|
||||||
|
|
||||||
class RecordLitExpr(Expr):
|
class RecordLitExpr(Expr):
|
||||||
path: optional[Unimplemented] | child
|
path: optional["Unimplemented"] | child
|
||||||
fields: list[RecordLitField] | child
|
fields: list[RecordLitField] | child
|
||||||
spread: optional[Expr] | child
|
spread: optional[Expr] | child
|
||||||
has_ellipsis: predicate
|
has_ellipsis: predicate
|
||||||
@@ -514,7 +509,7 @@ class OrPat(Pat):
|
|||||||
|
|
||||||
|
|
||||||
class RecordPat(Pat):
|
class RecordPat(Pat):
|
||||||
path: optional[Unimplemented] | child
|
path: optional["Unimplemented"] | child
|
||||||
args: list[RecordFieldPat] | child
|
args: list[RecordFieldPat] | child
|
||||||
has_ellipsis: predicate
|
has_ellipsis: predicate
|
||||||
|
|
||||||
@@ -535,7 +530,7 @@ class SlicePat(Pat):
|
|||||||
|
|
||||||
|
|
||||||
class PathPat(Pat):
|
class PathPat(Pat):
|
||||||
path: Unimplemented | child
|
path: "Unimplemented" | child
|
||||||
|
|
||||||
# Lit(ExprId),
|
# Lit(ExprId),
|
||||||
|
|
||||||
@@ -554,7 +549,7 @@ class BindPat(Pat):
|
|||||||
|
|
||||||
|
|
||||||
class TupleStructPat(Pat):
|
class TupleStructPat(Pat):
|
||||||
path: optional[Unimplemented] | child
|
path: optional["Unimplemented"] | child
|
||||||
args: list[Pat] | child
|
args: list[Pat] | child
|
||||||
ellipsis_index: optional[int]
|
ellipsis_index: optional[int]
|
||||||
|
|
||||||
@@ -575,3 +570,8 @@ class BoxPat(Pat):
|
|||||||
|
|
||||||
class ConstBlockPat(Pat):
|
class ConstBlockPat(Pat):
|
||||||
expr: Expr | child
|
expr: Expr | child
|
||||||
|
|
||||||
|
|
||||||
|
@qltest.skip
|
||||||
|
class Unimplemented(Declaration, TypeRef):
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user