mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #19824 from github/redsun82/rust-derive-macro-expansion
Rust: expand derive macros
This commit is contained in:
@@ -321,7 +321,7 @@ drop = object()
|
||||
def annotate(
|
||||
annotated_cls: type,
|
||||
add_bases: _Iterable[type] | None = None,
|
||||
replace_bases: _Dict[type, type] | None = None,
|
||||
replace_bases: _Dict[type, type | None] | None = None,
|
||||
cfg: bool = False,
|
||||
) -> _Callable[[type], _PropertyModifierList]:
|
||||
"""
|
||||
@@ -329,7 +329,8 @@ def annotate(
|
||||
|
||||
The name of the class used for annotation must be `_`.
|
||||
|
||||
`replace_bases` can be used to replace bases on the annotated class.
|
||||
`replace_bases` can be used to replace bases on the annotated class. Mapping to
|
||||
`None` will remove that base class.
|
||||
"""
|
||||
|
||||
def decorator(cls: type) -> _PropertyModifierList:
|
||||
@@ -341,7 +342,9 @@ def annotate(
|
||||
_ClassPragma(p, value=v)(annotated_cls)
|
||||
if replace_bases:
|
||||
annotated_cls.__bases__ = tuple(
|
||||
replace_bases.get(b, b) for b in annotated_cls.__bases__
|
||||
b
|
||||
for b in (replace_bases.get(b, b) for b in annotated_cls.__bases__)
|
||||
if b is not None
|
||||
)
|
||||
if add_bases:
|
||||
annotated_cls.__bases__ += tuple(add_bases)
|
||||
|
||||
@@ -66,6 +66,20 @@ impl {{name}} {
|
||||
pub fn emit_{{singular_field_name}}(id: trap::Label<Self>{{^is_predicate}}{{#is_repeated}}{{^is_unordered}}, i: usize{{/is_unordered}}{{/is_repeated}}, value: {{base_type}}{{/is_predicate}}, out: &mut trap::Writer) {
|
||||
out.add_tuple("{{table_name}}", vec![id.into(){{^is_predicate}}{{#is_repeated}}{{^is_unordered}}, i.into(){{/is_unordered}}{{/is_repeated}}, value.into(){{/is_predicate}}]);
|
||||
}
|
||||
|
||||
{{#is_repeated}}
|
||||
pub fn emit_{{field_name}}(id: trap::Label<Self>, values: impl IntoIterator<Item={{base_type}}>, out: &mut trap::Writer) {
|
||||
values
|
||||
.into_iter()
|
||||
{{^is_unordered}}
|
||||
.enumerate()
|
||||
.for_each(|(i, value)| Self::emit_{{singular_field_name}}(id, i, value, out));
|
||||
{{/is_unordered}}
|
||||
{{#is_unordered}}
|
||||
.for_each(|value| Self::emit_{{singular_field_name}}(id, value, out));
|
||||
{{/is_unordered}}
|
||||
}
|
||||
{{/is_repeated}}
|
||||
{{/detached_fields}}
|
||||
}
|
||||
{{/has_detached_fields}}
|
||||
|
||||
@@ -385,8 +385,8 @@ struct ExtractorInfo {
|
||||
}
|
||||
|
||||
fn enum_to_extractor_info(node: &AstEnumSrc) -> Option<ExtractorEnumInfo> {
|
||||
if node.name == "VariantDef" {
|
||||
// currently defined but unused
|
||||
if node.name == "Adt" {
|
||||
// no fields have `Adt` type, so we don't need extraction for it
|
||||
return None;
|
||||
}
|
||||
Some(ExtractorEnumInfo {
|
||||
@@ -484,8 +484,8 @@ fn main() -> anyhow::Result<()> {
|
||||
.parse()
|
||||
.expect("Failed to parse grammar");
|
||||
let mut grammar = codegen::grammar::lower(&grammar);
|
||||
|
||||
grammar.enums.retain(|x| x.name != "Adt");
|
||||
// remove the VariantDef enum, there is no use for it at the moment
|
||||
grammar.enums.retain(|e| e.name != "VariantDef");
|
||||
|
||||
let mut super_types: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
|
||||
for node in &grammar.enums {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
description: Remove `adt_derive_macro_expansions`
|
||||
compatibility: partial
|
||||
|
||||
adt_derive_macro_expansions.rel: delete
|
||||
2
rust/extractor/src/generated/.generated.list
generated
2
rust/extractor/src/generated/.generated.list
generated
@@ -1,2 +1,2 @@
|
||||
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
|
||||
top.rs 69c1fcaf0efea87feb898f32fdb7bcb842a22119b69ecedd61c2d946eb7e67de 69c1fcaf0efea87feb898f32fdb7bcb842a22119b69ecedd61c2d946eb7e67de
|
||||
top.rs 4cd878b17ebc18c28cbaac2eb77a7401d60c0870247877c4c1dd155c31342482 4cd878b17ebc18c28cbaac2eb77a7401d60c0870247877c4c1dd155c31342482
|
||||
|
||||
762
rust/extractor/src/generated/top.rs
generated
762
rust/extractor/src/generated/top.rs
generated
@@ -335,9 +335,11 @@ impl Addressable {
|
||||
pub fn emit_extended_canonical_path(id: trap::Label<Self>, value: String, out: &mut trap::Writer) {
|
||||
out.add_tuple("addressable_extended_canonical_paths", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
pub fn emit_crate_origin(id: trap::Label<Self>, value: String, out: &mut trap::Writer) {
|
||||
out.add_tuple("addressable_crate_origins", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Addressable {
|
||||
@@ -2058,9 +2060,11 @@ impl PathSegment {
|
||||
pub fn emit_type_repr(id: trap::Label<Self>, value: trap::Label<TypeRepr>, out: &mut trap::Writer) {
|
||||
out.add_tuple("path_segment_type_reprs", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
pub fn emit_trait_type_repr(id: trap::Label<Self>, value: trap::Label<PathTypeRepr>, out: &mut trap::Writer) {
|
||||
out.add_tuple("path_segment_trait_type_reprs", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for PathSegment {
|
||||
@@ -2153,9 +2157,11 @@ impl Resolvable {
|
||||
pub fn emit_resolved_path(id: trap::Label<Self>, value: String, out: &mut trap::Writer) {
|
||||
out.add_tuple("resolvable_resolved_paths", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
pub fn emit_resolved_crate_origin(id: trap::Label<Self>, value: String, out: &mut trap::Writer) {
|
||||
out.add_tuple("resolvable_resolved_crate_origins", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Resolvable {
|
||||
@@ -3221,42 +3227,6 @@ impl From<trap::Label<UseTreeList>> for trap::Label<Element> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VariantDef {
|
||||
_unused: ()
|
||||
}
|
||||
|
||||
impl trap::TrapClass for VariantDef {
|
||||
fn class_name() -> &'static str { "VariantDef" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<VariantDef>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<VariantDef>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme VariantDef is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<VariantDef>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<VariantDef>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme VariantDef is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<VariantDef>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<VariantDef>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme VariantDef is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VariantList {
|
||||
pub id: trap::TrapId<VariantList>,
|
||||
@@ -5764,6 +5734,7 @@ impl Item {
|
||||
pub fn emit_attribute_macro_expansion(id: trap::Label<Self>, value: trap::Label<MacroItems>, out: &mut trap::Writer) {
|
||||
out.add_tuple("item_attribute_macro_expansions", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Item {
|
||||
@@ -8639,9 +8610,9 @@ impl trap::TrapClass for Variant {
|
||||
fn class_name() -> &'static str { "Variant" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Variant>> for trap::Label<VariantDef> {
|
||||
impl From<trap::Label<Variant>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Variant>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Variant is a subclass of VariantDef
|
||||
// SAFETY: this is safe because in the dbscheme Variant is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
@@ -8675,15 +8646,6 @@ impl From<trap::Label<Variant>> for trap::Label<Element> {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Variant>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Variant>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Variant is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WildcardPat {
|
||||
pub id: trap::TrapId<WildcardPat>,
|
||||
@@ -8865,6 +8827,82 @@ impl From<trap::Label<YieldExpr>> for trap::Label<Element> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Adt {
|
||||
_unused: ()
|
||||
}
|
||||
|
||||
impl Adt {
|
||||
pub fn emit_derive_macro_expansion(id: trap::Label<Self>, i: usize, value: trap::Label<MacroItems>, out: &mut trap::Writer) {
|
||||
out.add_tuple("adt_derive_macro_expansions", vec![id.into(), i.into(), value.into()]);
|
||||
}
|
||||
|
||||
pub fn emit_derive_macro_expansions(id: trap::Label<Self>, values: impl IntoIterator<Item=trap::Label<MacroItems>>, out: &mut trap::Writer) {
|
||||
values
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.for_each(|(i, value)| Self::emit_derive_macro_expansion(id, i, value, out));
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Adt {
|
||||
fn class_name() -> &'static str { "Adt" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Adt>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Adt>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Adt is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Adt>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Adt>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Adt is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Adt>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Adt>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Adt is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Adt>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Adt>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Adt is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Adt>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Adt>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Adt is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Adt>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Adt>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Adt is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BlockExpr {
|
||||
pub id: trap::TrapId<BlockExpr>,
|
||||
@@ -9088,6 +9126,7 @@ impl Const {
|
||||
pub fn emit_has_implementation(id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("const_has_implementation", vec![id.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Const {
|
||||
@@ -9157,103 +9196,6 @@ impl From<trap::Label<Const>> for trap::Label<Addressable> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Enum {
|
||||
pub id: trap::TrapId<Enum>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub variant_list: Option<trap::Label<VariantList>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
pub where_clause: Option<trap::Label<WhereClause>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Enum {
|
||||
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("enums", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("enum_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("enum_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("enum_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.variant_list {
|
||||
out.add_tuple("enum_variant_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.visibility {
|
||||
out.add_tuple("enum_visibilities", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.where_clause {
|
||||
out.add_tuple("enum_where_clauses", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Enum {
|
||||
fn class_name() -> &'static str { "Enum" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExternBlock {
|
||||
pub id: trap::TrapId<ExternBlock>,
|
||||
@@ -9507,6 +9449,7 @@ impl Function {
|
||||
pub fn emit_has_implementation(id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("function_has_implementation", vec![id.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Function {
|
||||
@@ -9792,6 +9735,7 @@ impl MacroCall {
|
||||
pub fn emit_macro_call_expansion(id: trap::Label<Self>, value: trap::Label<AstNode>, out: &mut trap::Writer) {
|
||||
out.add_tuple("macro_call_macro_call_expansions", vec![id.into(), value.into()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl trap::TrapClass for MacroCall {
|
||||
@@ -10515,112 +10459,6 @@ impl From<trap::Label<Static>> for trap::Label<Addressable> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Struct {
|
||||
pub id: trap::TrapId<Struct>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub field_list: Option<trap::Label<FieldList>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
pub where_clause: Option<trap::Label<WhereClause>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Struct {
|
||||
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("structs", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("struct_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.field_list {
|
||||
out.add_tuple("struct_field_lists_", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("struct_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("struct_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.visibility {
|
||||
out.add_tuple("struct_visibilities", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.where_clause {
|
||||
out.add_tuple("struct_where_clauses", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Struct {
|
||||
fn class_name() -> &'static str { "Struct" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<VariantDef> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of VariantDef
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct StructExpr {
|
||||
pub id: trap::TrapId<StructExpr>,
|
||||
@@ -11193,112 +11031,6 @@ impl From<trap::Label<TypeAlias>> for trap::Label<Addressable> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Union {
|
||||
pub id: trap::TrapId<Union>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub struct_field_list: Option<trap::Label<StructFieldList>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
pub where_clause: Option<trap::Label<WhereClause>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Union {
|
||||
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("unions", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("union_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("union_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("union_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.struct_field_list {
|
||||
out.add_tuple("union_struct_field_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.visibility {
|
||||
out.add_tuple("union_visibilities", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.where_clause {
|
||||
out.add_tuple("union_where_clauses", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Union {
|
||||
fn class_name() -> &'static str { "Union" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<VariantDef> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of VariantDef
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Use {
|
||||
pub id: trap::TrapId<Use>,
|
||||
@@ -11384,6 +11116,112 @@ impl From<trap::Label<Use>> for trap::Label<Addressable> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Enum {
|
||||
pub id: trap::TrapId<Enum>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub variant_list: Option<trap::Label<VariantList>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
pub where_clause: Option<trap::Label<WhereClause>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Enum {
|
||||
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("enums", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("enum_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("enum_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("enum_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.variant_list {
|
||||
out.add_tuple("enum_variant_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.visibility {
|
||||
out.add_tuple("enum_visibilities", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.where_clause {
|
||||
out.add_tuple("enum_where_clauses", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Enum {
|
||||
fn class_name() -> &'static str { "Enum" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Adt> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Adt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Enum>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Enum>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Enum is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ForExpr {
|
||||
pub id: trap::TrapId<ForExpr>,
|
||||
@@ -11562,6 +11400,218 @@ impl From<trap::Label<LoopExpr>> for trap::Label<Element> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Struct {
|
||||
pub id: trap::TrapId<Struct>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub field_list: Option<trap::Label<FieldList>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
pub where_clause: Option<trap::Label<WhereClause>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Struct {
|
||||
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("structs", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("struct_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.field_list {
|
||||
out.add_tuple("struct_field_lists_", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("struct_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("struct_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.visibility {
|
||||
out.add_tuple("struct_visibilities", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.where_clause {
|
||||
out.add_tuple("struct_where_clauses", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Struct {
|
||||
fn class_name() -> &'static str { "Struct" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Adt> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Adt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Struct>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Struct>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Struct is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Union {
|
||||
pub id: trap::TrapId<Union>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub generic_param_list: Option<trap::Label<GenericParamList>>,
|
||||
pub name: Option<trap::Label<Name>>,
|
||||
pub struct_field_list: Option<trap::Label<StructFieldList>>,
|
||||
pub visibility: Option<trap::Label<Visibility>>,
|
||||
pub where_clause: Option<trap::Label<WhereClause>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for Union {
|
||||
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("unions", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("union_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.generic_param_list {
|
||||
out.add_tuple("union_generic_param_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.name {
|
||||
out.add_tuple("union_names", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.struct_field_list {
|
||||
out.add_tuple("union_struct_field_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.visibility {
|
||||
out.add_tuple("union_visibilities", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.where_clause {
|
||||
out.add_tuple("union_where_clauses", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for Union {
|
||||
fn class_name() -> &'static str { "Union" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Adt> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Adt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Item> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Item
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Stmt> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Stmt
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<Union>> for trap::Label<Addressable> {
|
||||
fn from(value: trap::Label<Union>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme Union is a subclass of Addressable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WhileExpr {
|
||||
pub id: trap::TrapId<WhileExpr>,
|
||||
|
||||
@@ -16,7 +16,7 @@ use ra_ap_ide_db::RootDatabase;
|
||||
use ra_ap_ide_db::line_index::{LineCol, LineIndex};
|
||||
use ra_ap_parser::SyntaxKind;
|
||||
use ra_ap_span::TextSize;
|
||||
use ra_ap_syntax::ast::HasName;
|
||||
use ra_ap_syntax::ast::{HasAttrs, HasName};
|
||||
use ra_ap_syntax::{
|
||||
AstNode, NodeOrToken, SyntaxElementChildren, SyntaxError, SyntaxNode, SyntaxToken, TextRange,
|
||||
ast,
|
||||
@@ -71,12 +71,15 @@ macro_rules! post_emit {
|
||||
$self.extract_canonical_origin($node, $label.into());
|
||||
};
|
||||
(Struct, $self:ident, $node:ident, $label:ident) => {
|
||||
$self.emit_derive_expansion($node, $label);
|
||||
$self.extract_canonical_origin($node, $label.into());
|
||||
};
|
||||
(Enum, $self:ident, $node:ident, $label:ident) => {
|
||||
$self.emit_derive_expansion($node, $label);
|
||||
$self.extract_canonical_origin($node, $label.into());
|
||||
};
|
||||
(Union, $self:ident, $node:ident, $label:ident) => {
|
||||
$self.emit_derive_expansion($node, $label);
|
||||
$self.extract_canonical_origin($node, $label.into());
|
||||
};
|
||||
(Module, $self:ident, $node:ident, $label:ident) => {
|
||||
@@ -322,6 +325,25 @@ impl<'a> Translator<'a> {
|
||||
.emit_diagnostic(severity, tag, message, full_message, location);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn emit_diagnostic_for_node(
|
||||
&mut self,
|
||||
node: &impl ast::AstNode,
|
||||
severity: DiagnosticSeverity,
|
||||
tag: String,
|
||||
message: String,
|
||||
full_message: String,
|
||||
) {
|
||||
let location = self.location_for_node(node);
|
||||
self.emit_diagnostic(
|
||||
severity,
|
||||
tag,
|
||||
message,
|
||||
full_message,
|
||||
location.unwrap_or(UNKNOWN_LOCATION),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn emit_parse_error(&mut self, owner: &impl ast::AstNode, err: &SyntaxError) {
|
||||
let owner_range: TextRange = owner.syntax().text_range();
|
||||
let err_range = err.range();
|
||||
@@ -806,6 +828,39 @@ impl<'a> Translator<'a> {
|
||||
None
|
||||
}
|
||||
|
||||
fn process_item_macro_expansion(
|
||||
&mut self,
|
||||
node: &impl ast::AstNode,
|
||||
ExpandResult { value, err }: ExpandResult<SyntaxNode>,
|
||||
) -> Option<Label<generated::MacroItems>> {
|
||||
let semantics = self.semantics.unwrap(); // if we are here, we have semantics
|
||||
self.emit_macro_expansion_parse_errors(node, &value);
|
||||
if let Some(err) = err {
|
||||
let rendered = err.render_to_string(semantics.db);
|
||||
self.emit_diagnostic_for_node(
|
||||
node,
|
||||
DiagnosticSeverity::Warning,
|
||||
"item_expansion".to_owned(),
|
||||
format!("item expansion failed ({})", rendered.kind),
|
||||
rendered.message,
|
||||
);
|
||||
}
|
||||
if let Some(items) = ast::MacroItems::cast(value) {
|
||||
self.emit_macro_items(&items)
|
||||
} else {
|
||||
let message =
|
||||
"attribute or derive macro expansion cannot be cast to MacroItems".to_owned();
|
||||
self.emit_diagnostic_for_node(
|
||||
node,
|
||||
DiagnosticSeverity::Warning,
|
||||
"item_expansion".to_owned(),
|
||||
message.clone(),
|
||||
message,
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_attribute_macro_expansion(
|
||||
&mut self,
|
||||
node: &ast::Item,
|
||||
@@ -818,23 +873,8 @@ impl<'a> Translator<'a> {
|
||||
// only expand the outermost attribute macro
|
||||
return None;
|
||||
}
|
||||
let ExpandResult {
|
||||
value: expanded, ..
|
||||
} = self.semantics.and_then(|s| s.expand_attr_macro(node))?;
|
||||
self.emit_macro_expansion_parse_errors(node, &expanded);
|
||||
let macro_items = ast::MacroItems::cast(expanded).or_else(|| {
|
||||
let message = "attribute macro expansion cannot be cast to MacroItems".to_owned();
|
||||
let location = self.location_for_node(node);
|
||||
self.emit_diagnostic(
|
||||
DiagnosticSeverity::Warning,
|
||||
"item_expansion".to_owned(),
|
||||
message.clone(),
|
||||
message,
|
||||
location.unwrap_or(UNKNOWN_LOCATION),
|
||||
);
|
||||
None
|
||||
})?;
|
||||
self.emit_macro_items(¯o_items)
|
||||
let expansion = self.semantics?.expand_attr_macro(node)?;
|
||||
self.process_item_macro_expansion(node, expansion)
|
||||
}
|
||||
|
||||
pub(crate) fn emit_item_expansion(&mut self, node: &ast::Item, label: Label<generated::Item>) {
|
||||
@@ -862,4 +902,26 @@ impl<'a> Translator<'a> {
|
||||
generated::Const::emit_has_implementation(label, &mut self.trap.writer);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn emit_derive_expansion(
|
||||
&mut self,
|
||||
node: &(impl Into<ast::Adt> + Clone),
|
||||
label: impl Into<Label<generated::Adt>> + Copy,
|
||||
) {
|
||||
let Some(semantics) = self.semantics else {
|
||||
return;
|
||||
};
|
||||
let node: ast::Adt = node.clone().into();
|
||||
let expansions = node
|
||||
.attrs()
|
||||
.filter_map(|attr| semantics.expand_derive_macro(&attr))
|
||||
.flatten()
|
||||
.filter_map(|expansion| self.process_item_macro_expansion(&node, expansion))
|
||||
.collect::<Vec<_>>();
|
||||
generated::Adt::emit_derive_macro_expansions(
|
||||
label.into(),
|
||||
expansions,
|
||||
&mut self.trap.writer,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
39
rust/ql/.generated.list
generated
39
rust/ql/.generated.list
generated
@@ -1,6 +1,7 @@
|
||||
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll 6a103a6d04c951ca2f0c2989bed737cdbac56dd5ea9432b858da3416412bbf79 cf2bc67b65a1555de58bbd0a35b834b8867112a2f7c1951307c9416400ce70d0
|
||||
lib/codeql/rust/elements/Abi.qll 485a2e79f6f7bfd1c02a6e795a71e62dede3c3e150149d5f8f18b761253b7208 6159ba175e7ead0dd2e3f2788f49516c306ee11b1a443bd4bdc00b7017d559bd
|
||||
lib/codeql/rust/elements/Addressable.qll 13011bfd2e1556694c3d440cc34af8527da4df49ad92b62f2939d3699ff2cea5 ddb25935f7553a1a384b1abe2e4b4fa90ab50b952dadec32fd867afcb054f4be
|
||||
lib/codeql/rust/elements/Adt.qll c2afed4ac2e17039ccd98f74ea22111f4d765c4e232c50ccd3128da0d26da837 1380bde2eb667c6ec2ef5f8710aa24e926851c9e321ebc72ba514fa92c369dc3
|
||||
lib/codeql/rust/elements/ArgList.qll 3d2f6f5542340b80a4c6e944ac17aba0d00727588bb66e501453ac0f80c82f83 afd52700bf5a337f19827846667cd0fb1fea5abbbcbc353828e292a727ea58c9
|
||||
lib/codeql/rust/elements/ArrayExpr.qll e4e7cff3518c50ec908271906dd46c1fbe9098faa1e8cd06a27f0a6e8d165ed1 fe02a4f4197f57ecd1e8e82d6c9384148ec29d8b106d7f696795b2f325e4a71b
|
||||
lib/codeql/rust/elements/ArrayListExpr.qll 451aedcecb479c385ff497588c7a07fda304fd5b873270223a4f2c804e96b245 a8cb008f6f732215623b5626c84b37b651ca01ccafb2cf4c835df35d5140c6ad
|
||||
@@ -46,7 +47,7 @@ lib/codeql/rust/elements/ContinueExpr.qll 9f27c5d5c819ad0ebc5bd10967ba8d33a9dc95
|
||||
lib/codeql/rust/elements/Crate.qll 1426960e6f36195e42ea5ea321405c1a72fccd40cd6c0a33673c321c20302d8d 1571a89f89dab43c5291b71386de7aadf52730755ba10f9d696db9ad2f760aff
|
||||
lib/codeql/rust/elements/DynTraitTypeRepr.qll e4d27112d27ae93c621defd2c976fd4e90663ab7f6115e83ae4fe8106cb5e015 eb9fde89698588f3b7116f62388c54e937f99559b22c93d11a5596e754560072
|
||||
lib/codeql/rust/elements/Element.qll 0b62d139fef54ed2cf2e2334806aa9bfbc036c9c2085d558f15a42cc3fa84c48 24b999b93df79383ef27ede46e38da752868c88a07fe35fcff5d526684ba7294
|
||||
lib/codeql/rust/elements/Enum.qll accb97d0bd8c0f41df873d41886f606b6ae4cd1ffa38b70fe9504cfb89d0bd7d b456103ac992e384165d151eb0f169499be4961c3ec35b94a32201b5e4e22189
|
||||
lib/codeql/rust/elements/Enum.qll 55d5a4a775f07d9c1d5183af76f9d8de1d700bfe1dea427cc7ff3083f39e13de f00a585596f1d0ab34e6f2b7cdaba6d4a89005820478f810e8685478cf88100e
|
||||
lib/codeql/rust/elements/Expr.qll e5d65e805ccf440d64d331e55df4c4144ab8c8f63f367382494714087659ffe8 2bbc1e5d3a65f413ec33d9822fa451fbdbe32349158db58cc0bfcfafb0e21bda
|
||||
lib/codeql/rust/elements/ExprStmt.qll 00ac4c7d0192b9e8b0f28d5ae59c27729ff5a831ca11938ea3e677a262337a64 7cc02aa5346cd7c50d75ca63cd6501097b0a3979eb2ed838adff114fe17d35a3
|
||||
lib/codeql/rust/elements/ExternBlock.qll 96c70d0761ec385fe17aa7228e15fd1711949d5abba5877a1c2f4c180d202125 38ad458868a368d437b2dda44307d788a85c887f45ea76c99adbfc9a53f14d81
|
||||
@@ -145,7 +146,7 @@ lib/codeql/rust/elements/SourceFile.qll 0b6a3e58767c07602b19975009a2ad53ecf1fd72
|
||||
lib/codeql/rust/elements/Static.qll a6d73152ddecb53a127aa3a4139f97007cd77b46203691c287600aa7200b8beb 547197e794803b3ea0c0e220f050980adec815a16fdef600f98ff795aa77f677
|
||||
lib/codeql/rust/elements/Stmt.qll 532b12973037301246daf7d8c0177f734202f43d9261c7a4ca6f5080eea8ca64 b838643c4f2b4623d2c816cddad0e68ca3e11f2879ab7beaece46f489ec4b1f3
|
||||
lib/codeql/rust/elements/StmtList.qll e874859ce03672d0085e47e0ca5e571b92b539b31bf0d5a8802f9727bef0c6b0 e5fe83237f713cdb57c446a6e1c20f645c2f49d9f5ef2c984032df83acb3c0de
|
||||
lib/codeql/rust/elements/Struct.qll c1f607aa4b039fc24bbbedc5992e49bd13e9851731296645c7ec2669425f19ad d7720c76a5a50284bd62df707cb113dfb19104226e9ee7578e75eb207da0655c
|
||||
lib/codeql/rust/elements/Struct.qll 297d3ea732fc7fbb8b8fb5479c1873ce84705146853ff752c84a6f70af12b923 3df0e5fd50a910a0b5611c3a860a1d7c318f6925c3a0727006d91840caf04812
|
||||
lib/codeql/rust/elements/StructExpr.qll af9059c01a97755e94f1a8b60c66d9c7663ed0705b2845b086b8953f16019fab 2d33d86b035a15c1b31c3e07e0e74c4bbe57a71c5a55d60e720827814e73b7ba
|
||||
lib/codeql/rust/elements/StructExprField.qll 3eb9f17ecd1ad38679689eb4ecc169d3a0b5b7a3fc597ae5a957a7aea2f74e4f 8fcd26f266f203004899a60447ba16e7eae4e3a654fbec7f54e26857730ede93
|
||||
lib/codeql/rust/elements/StructExprFieldList.qll 6efb2ec4889b38556dc679bb89bbd4bd76ed6a60014c41f8e232288fc23b2d52 dc867a0a4710621e04b36bbec7d317d6f360e0d6ac68b79168c8b714babde31d
|
||||
@@ -174,14 +175,13 @@ lib/codeql/rust/elements/TypeRepr.qll ea41b05ef0aaac71da460f9a6a8331cf98166f2c38
|
||||
lib/codeql/rust/elements/UnderscoreExpr.qll 233661b82b87c8cda16d8f2e17965658c3dc6b69efb23cb8eb9c4f50c68521e0 8edff8e80aac2ecf83a6b58f310cab688cbaeea0a0e68a298b644e565960cc74
|
||||
lib/codeql/rust/elements/Unextracted.qll 12e60c79ef5b94d72b579b19970622e7b73822ebc13fbcfedfe953527ab1ac36 ec015db2eb12c3c82693ddc71d32d9ab9ef7a958e741e2510681bb707ceca23e
|
||||
lib/codeql/rust/elements/Unimplemented.qll bf624d28163e5c99accda16c0c99f938bec4a3b1b920a463e86fc8529ff5ff02 013bc7777298d250338f835cd494b5a8accea2d6a4f9561851f283ac129a446b
|
||||
lib/codeql/rust/elements/Union.qll f035871f9d265a002f8a4535da11d6191f04337c1d22dc54f545e3b527067e20 fdb86022a4f4f7e323899aaf47741d0a4c4e6a987fe1b4e8fea24e28b1377177
|
||||
lib/codeql/rust/elements/Union.qll 13f7f62e98b117d18e79db5f6e6535447bc069ebb08f7cdb390b012678b7e085 bd8c37bc0ff09926753bc250e1848ed25923f224829d0136afc27b749eaddd1f
|
||||
lib/codeql/rust/elements/Use.qll fdcf70574403c2f219353211b6930f2f9bc79f41c2594e07548de5a8c6cbb24d e41f2b689fcbeb7b84c7ba8d09592f7561626559318642b73574bbac83f74546
|
||||
lib/codeql/rust/elements/UseBoundGenericArg.qll f16903f8fff676d3700eaad5490804624391141472ecc3166ccb1f70c794c120 5efda98088d096b42f53ceccae78c05f15c6953525b514d849681cb2cf65b147
|
||||
lib/codeql/rust/elements/UseBoundGenericArgs.qll d9821a82a1d57e609fdc5e79d65e9a88b0088f51d03927e09f41b6931d3484ab 181483a95e22622c7cee07cce87e9476053f824a82e67e2bdecabf5a39f672ad
|
||||
lib/codeql/rust/elements/UseTree.qll e67c148f63668319c37914a46ff600692de477242a0129fa1bb9839754c0f830 de9b39d3d078d51ec9130db6579bff13e6297e60556a7214a5c51cbf89d92791
|
||||
lib/codeql/rust/elements/UseTreeList.qll 92ebfee4392a485b38fb3265fdede7c8f2ed1dbe2ab860aa61b1497c33874d25 a4e677455d20838e422e430eebd73d0a488e34e8c960f375fef7b99e79d4c911
|
||||
lib/codeql/rust/elements/Variant.qll 9377fa841779e8283df08432bf868faf161c36cc03f332c52ae219422cb9f959 2440771a5a1ef28927fe6fdc81b0e95c91aae18911739c89753fbadce7ff6cc9
|
||||
lib/codeql/rust/elements/VariantDef.qll fb14bf049aba1fc0b62d156e69b7965b6526d12c9150793f1d38b0f8fb8a0a8f 71453a80a3c60288242c5d86ab81ef4d027a3bc870ceffa62160864d32a7d7ad
|
||||
lib/codeql/rust/elements/Variant.qll 7895461fa728f6c3a7293799c5e6b965b413b679566dcbd40bbe2609db8b6cde b0413547365a301bd9fbb6b266757f956394abad0a77f0e424446e23ec7d83e9
|
||||
lib/codeql/rust/elements/VariantList.qll 39803fbb873d48202c2a511c00c8eafede06e519894e0fd050c2a85bf5f4aa73 1735f89b2b8f6d5960a276b87ea10e4bb8c848c24a5d5fad7f3add7a4d94b7da
|
||||
lib/codeql/rust/elements/Visibility.qll aa69e8a3fd3b01f6fea0ae2d841a2adc51f4e46dcfc9f8f03c34fbe96f7e24e7 0d475e97e07b73c8da2b53555085b8309d8dc69c113bcb396fc901361dbfe6b8
|
||||
lib/codeql/rust/elements/WhereClause.qll 4e28e11ceec835a093e469854a4b615e698309cdcbc39ed83810e2e4e7c5953f 4736baf689b87dd6669cb0ef9e27eb2c0f2776ce7f29d7693670bbcea06eb4e4
|
||||
@@ -192,6 +192,7 @@ lib/codeql/rust/elements/YeetExpr.qll 4172bf70de31cab17639da6eed4a12a7afcefd7aa9
|
||||
lib/codeql/rust/elements/YieldExpr.qll de2dc096a077f6c57bba9d1c2b2dcdbecce501333753b866d77c3ffbe06aa516 1f3e8949689c09ed356ff4777394fe39f2ed2b1e6c381fd391790da4f5d5c76a
|
||||
lib/codeql/rust/elements/internal/AbiConstructor.qll 4484538db49d7c1d31c139f0f21879fceb48d00416e24499a1d4b1337b4141ac 460818e397f2a1a8f2e5466d9551698b0e569d4640fcb87de6c4268a519b3da1
|
||||
lib/codeql/rust/elements/internal/AbiImpl.qll 28a2b6bdb38fd626e5d7d1ed29b839b95976c3a03717d840669eb17c4d6f0c7a 8e83877855abe760f3be8f45c2cf91c1f6e810ec0301313910b8104b2474d9cf
|
||||
lib/codeql/rust/elements/internal/AdtImpl.qll 2dc727a14a0fc775512d35e224eab7955884ec143dbd7dbf4cada9a1f5516df4 f3991cea544c5537b0a810492979a317b47685e1c0e58b948df2a957c7a18fdc
|
||||
lib/codeql/rust/elements/internal/ArgListConstructor.qll a73685c8792ae23a2d628e7357658efb3f6e34006ff6e9661863ef116ec0b015 0bee572a046e8dfc031b1216d729843991519d94ae66280f5e795d20aea07a22
|
||||
lib/codeql/rust/elements/internal/ArgListImpl.qll 0903b2ca31b3e5439f631582d12f17d77721d63fdb54dc41372d19b742881ce4 2c71c153ccca4b4988e6a25c37e58dc8ecb5a7483273afff563a8542f33e7949
|
||||
lib/codeql/rust/elements/internal/ArrayExprInternal.qll 07a219b3d3fba3ff8b18e77686b2f58ab01acd99e0f5d5cad5d91af937e228f5 7528fc0e2064c481f0d6cbff3835950a044e429a2cd00c4d8442d2e132560d37
|
||||
@@ -442,7 +443,6 @@ lib/codeql/rust/elements/internal/UseTreeConstructor.qll 3e6e834100fcc7249f8a20f
|
||||
lib/codeql/rust/elements/internal/UseTreeListConstructor.qll 973577da5d7b58eb245f108bd1ae2fecc5645f2795421dedf7687b067a233003 f41e5e3ffcb2a387e5c37f56c0b271e8dc20428b6ff4c63e1ee42fcfa4e67d0a
|
||||
lib/codeql/rust/elements/internal/UseTreeListImpl.qll a155fbfeb9792d511e1f3331d6756ccff6cca18c7ca4cac0faa7184cbb2e0dd4 0eeb1343b2284c02f9a0f0237267c77857a3a3a0f57df8277437313fde38d1b7
|
||||
lib/codeql/rust/elements/internal/VariantConstructor.qll 0297d4a9a9b32448d6d6063d308c8d0e7a067d028b9ec97de10a1d659ee2cfdd 6a4bee28b340e97d06b262120fd39ab21717233a5bcc142ba542cb1b456eb952
|
||||
lib/codeql/rust/elements/internal/VariantDefImpl.qll 5530c04b8906d2947ec9c79fc17a05a2557b01a521dd4ca8a60518b78d13867b 3971558e1c907d8d2ef174b10f911e61b898916055a8173788e6f0b98869b144
|
||||
lib/codeql/rust/elements/internal/VariantListConstructor.qll c841fb345eb46ea3978a0ed7a689f8955efc9178044b140b74d98a6bcd0c926a c9e52d112abdba2b60013fa01a944c8770766bf7368f9878e6b13daaa4eed446
|
||||
lib/codeql/rust/elements/internal/VariantListImpl.qll 4ceeda617696eb547c707589ba26103cf4c5c3d889955531be24cbf224e79dff 4258196c126fd2fad0e18068cb3d570a67034a8b26e2f13f8223d7f1a246d1a4
|
||||
lib/codeql/rust/elements/internal/VisibilityConstructor.qll 1fd30663d87945f08d15cfaca54f586a658f26b7a98ea45ac73a35d36d4f65d0 6ddaf11742cc8fbbe03af2aa578394041ae077911e62d2fa6c885ae0543ba53a
|
||||
@@ -459,6 +459,7 @@ lib/codeql/rust/elements/internal/YieldExprConstructor.qll 8cbfa6405acb151ee31cc
|
||||
lib/codeql/rust/elements/internal/YieldExprImpl.qll af184649a348ddd0be16dee9daae307240bf123ace09243950342e9d71ededd9 17df90f67dd51623e8a5715b344ccd8740c8fc415af092469f801b99caacb70d
|
||||
lib/codeql/rust/elements/internal/generated/Abi.qll f5a22afe5596c261b4409395056ce3227b25d67602d51d0b72734d870f614df3 06d1c242ccd31f1cc90212823077e1a7a9e93cd3771a14ebe2f0659c979f3dd1
|
||||
lib/codeql/rust/elements/internal/generated/Addressable.qll 96a8b45166dd035b8d2c6d36b8b67019f2d4d0b4ccff6d492677c0c87197613e d8f1ce29feafc8ff7179399fc7eac5db031a7e1a8bc6b2cd75cfce1da3132e9b
|
||||
lib/codeql/rust/elements/internal/generated/Adt.qll 155f4025a26c3d2d5d3c42dfce9274a10f0862ea0574843c5d276179de421569 17138b271eea81d3ee2697c82cccfd7af752cd18cd925dd5fa20d7fce0e2432f
|
||||
lib/codeql/rust/elements/internal/generated/ArgList.qll e41f48258082876a8ceac9107209d94fdd00a62d2e4c632987a01a8394c4aff6 bf1982d14f8cd55fa0c3da2c6aab56fc73b15a3572ffc72d9a94f2c860f8f3b7
|
||||
lib/codeql/rust/elements/internal/generated/ArrayExpr.qll 73806a0de8168b38a9436fa6b8c6d68c92eeab3d64a1ae7edfff82f871929992 7ad998cdd8f4fed226473517ad7a5765cb35608033047aad53bf8aa3969fd03b
|
||||
lib/codeql/rust/elements/internal/generated/ArrayExprInternal.qll 67a7b0fae04b11cf771727ff39a123fb2d5ce6e2d650d32478fcb33a26ed5688 15833405fa85f6abe0e5146dac283cb5a142a07f08300ccc15a1dae30ed88942
|
||||
@@ -505,7 +506,7 @@ lib/codeql/rust/elements/internal/generated/ContinueExpr.qll e2010feb14fb6edeb83
|
||||
lib/codeql/rust/elements/internal/generated/Crate.qll 37f3760d7c0c1c3ca809d07daf7215a8eae6053eda05e88ed7db6e07f4db0781 649a3d7cd7ee99f95f8a4d3d3c41ea2fa848ce7d8415ccbac62977dfc9a49d35
|
||||
lib/codeql/rust/elements/internal/generated/DynTraitTypeRepr.qll b2e0e728b6708923b862d9d8d6104d13f572da17e393ec1485b8465e4bfdc206 4a87ea9669c55c4905ce4e781b680f674989591b0cb56af1e9fa1058c13300b3
|
||||
lib/codeql/rust/elements/internal/generated/Element.qll d56d22c060fa929464f837b1e16475a4a2a2e42d68235a014f7369bcb48431db 0e48426ca72179f675ac29aa49bbaadb8b1d27b08ad5cbc72ec5a005c291848e
|
||||
lib/codeql/rust/elements/internal/generated/Enum.qll ad2a79ae52665f88a41ee045adce4e60beb43483547d958f8230b9917824f0a1 cb12e304d04dffb4d8fb838eb9dbecf00fa8ac18fbf3edc37ee049ad248a4f67
|
||||
lib/codeql/rust/elements/internal/generated/Enum.qll 477eaa102c1268f0fa7603ecd88f1b83db1388c17c25e3719d4113ea980256f7 2d60db61ba4a385218f0a01e366e04ba1e7dad386b7e6a027c31f32fb730cca2
|
||||
lib/codeql/rust/elements/internal/generated/Expr.qll 5fa34f2ed21829a1509417440dae42d416234ff43433002974328e7aabb8f30f 46f3972c7413b7db28a3ea8acb5a50a74b6dd9b658e8725f6953a8829ac912f8
|
||||
lib/codeql/rust/elements/internal/generated/ExprStmt.qll d1112230015fbeb216b43407a268dc2ccd0f9e0836ab2dca4800c51b38fa1d7d 4a80562dcc55efa5e72c6c3b1d6747ab44fe494e76faff2b8f6e9f10a4b08b5b
|
||||
lib/codeql/rust/elements/internal/generated/ExternBlock.qll e7faac92297a53ac6e0420eec36255a54f360eeb962bf663a00da709407832dd 5ff32c54ec7097d43cc3311492090b9b90f411eead3bc849f258858f29405e81
|
||||
@@ -577,7 +578,7 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll eaa0cd4402d3665013d47e
|
||||
lib/codeql/rust/elements/internal/generated/ParenExpr.qll 812d2ff65079277f39f15c084657a955a960a7c1c0e96dd60472a58d56b945eb eb8c607f43e1fcbb41f37a10de203a1db806690e10ff4f04d48ed874189cb0eb
|
||||
lib/codeql/rust/elements/internal/generated/ParenPat.qll 24f9dc7fce75827d6fddb856cd48f80168143151b27295c0bab6db5a06567a09 ebadbc6f5498e9ed754b39893ce0763840409a0721036a25b56e1ead7dcc09aa
|
||||
lib/codeql/rust/elements/internal/generated/ParenTypeRepr.qll 03f5c5b96a37adeb845352d7fcea3e098da9050e534972d14ac0f70d60a2d776 ed3d6e5d02086523087adebce4e89e35461eb95f2a66d1d4100fe23fc691b126
|
||||
lib/codeql/rust/elements/internal/generated/ParentChild.qll 5278b74de04d54708f078fd813d83ae5f934fa12d420b188c1334e3a7c3b8324 61cf70eb649f241e2fcd5e0ba34df63f3a14f07032811b9ae151721783a0fd20
|
||||
lib/codeql/rust/elements/internal/generated/ParentChild.qll ce0c542d50e1b9a25132d4085dc2495dacaf152b5b960772c08977bcad297502 7015c8371a39b312635fced11440da95ef7a4e50c1b7bc990cd64e2ea4fcf5ea
|
||||
lib/codeql/rust/elements/internal/generated/ParenthesizedArgList.qll d901fdc8142a5b8847cc98fc2afcfd16428b8ace4fbffb457e761b5fd3901a77 5dbb0aea5a13f937da666ccb042494af8f11e776ade1459d16b70a4dd193f9fb
|
||||
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
|
||||
lib/codeql/rust/elements/internal/generated/Path.qll 9b12afb46fc5a9ad3a811b05472621bbecccb900c47504feb7f29d96b28421ca bcacbffc36fb3e0c9b26523b5963af0ffa9fd6b19f00a2a31bdb2316071546bd
|
||||
@@ -592,7 +593,7 @@ lib/codeql/rust/elements/internal/generated/PtrTypeRepr.qll 8d0ea4f6c7f8203340bf
|
||||
lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f
|
||||
lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9
|
||||
lib/codeql/rust/elements/internal/generated/RangePat.qll 80826a6a6868a803aa2372e31c52a03e1811a3f1f2abdb469f91ca0bfdd9ecb6 34ee1e208c1690cba505dff2c588837c0cd91e185e2a87d1fe673191962276a9
|
||||
lib/codeql/rust/elements/internal/generated/Raw.qll b6e439cc24f8c02fe73301cd2bc16d59dfd28e2a8a201388d8318c43937309e2 62139c3df2f6c4dca1c897b1384233ff0151b7e5fb1c41a178c5e8e41b5e7f05
|
||||
lib/codeql/rust/elements/internal/generated/Raw.qll e9071854089a126078be1f429bd518820eb5c80d8912ece4f77a34a865270747 3ba195ff7bce744e1290c14ff7330a9e096cd9f2850c9383f6baed8750765a76
|
||||
lib/codeql/rust/elements/internal/generated/RefExpr.qll 7d995884e3dc1c25fc719f5d7253179344d63650e217e9ff6530285fe7a57f64 f2c3c12551deea4964b66553fb9b6423ee16fec53bd63db4796191aa60dc6c66
|
||||
lib/codeql/rust/elements/internal/generated/RefPat.qll 456ede39837463ee22a630ec7ab6c8630d3664a8ea206fcc6e4f199e92fa564c 5622062765f32930465ba6b170e986706f159f6070f48adee3c20e24e8df4e05
|
||||
lib/codeql/rust/elements/internal/generated/RefTypeRepr.qll 5b0663a6d234572fb3e467e276d019415caa95ef006438cc59b7af4e1783161e 0e27c8a8f0e323c0e4d6db01fca821bf07c0864d293cdf96fa891b10820c1e4b
|
||||
@@ -609,7 +610,7 @@ lib/codeql/rust/elements/internal/generated/SourceFile.qll 4bc95c88b49868d1da1a8
|
||||
lib/codeql/rust/elements/internal/generated/Static.qll 34a4cdb9f4a93414499a30aeeaad1b3388f2341c982af5688815c3b0a0e9c57b 3c8354336eff68d580b804600df9abf49ee5ee10ec076722089087820cefe731
|
||||
lib/codeql/rust/elements/internal/generated/Stmt.qll 8473ff532dd5cc9d7decaddcd174b94d610f6ca0aec8e473cc051dad9f3db917 6ef7d2b5237c2dbdcacbf7d8b39109d4dc100229f2b28b5c9e3e4fbf673ba72b
|
||||
lib/codeql/rust/elements/internal/generated/StmtList.qll 816aebf8f56e179f5f0ba03e80d257ee85459ea757392356a0af6dbd0cd9ef5e 6aa51cdcdc8d93427555fa93f0e84afdfbbd4ffc8b8d378ae4a22b5b6f94f48b
|
||||
lib/codeql/rust/elements/internal/generated/Struct.qll 955c7e1e6453685fbc392e32514cf26a9aec948cecf9e62705ddc5c56c9dc97d cf47a9c53eebc0c7165985cd6120530b8a0fe965895d2293d01f7b95013c0102
|
||||
lib/codeql/rust/elements/internal/generated/Struct.qll 999da1b46e40d6e03fd2338fea02429462877c329c5d1338618cbd886a81567e daa7ff7bd32c554462e0a1502d8319cb5e734e056d0564e06596e416e2b88e9d
|
||||
lib/codeql/rust/elements/internal/generated/StructExpr.qll c6d861eaa0123b103fd9ffd2485423419ef9b7e0b4af9ed2a2090d8ec534f65d 50da99ee44771e1239ed8919f711991dd3ec98589fbe49b49b68c88074a07d74
|
||||
lib/codeql/rust/elements/internal/generated/StructExprField.qll 6bdc52ed325fd014495410c619536079b8c404e2247bd2435aa7685dd56c3833 501a30650cf813176ff325a1553da6030f78d14be3f84fea6d38032f4262c6b0
|
||||
lib/codeql/rust/elements/internal/generated/StructExprFieldList.qll 298d33442d1054922d2f97133a436ee559f1f35b7708523284d1f7eee7ebf443 7febe38a79fadf3dcb53fb8f8caf4c2780f5df55a1f8336269c7b674d53c6272
|
||||
@@ -618,7 +619,7 @@ lib/codeql/rust/elements/internal/generated/StructFieldList.qll 5da528a51a6a5db9
|
||||
lib/codeql/rust/elements/internal/generated/StructPat.qll c76fa005c2fd0448a8803233e1e8818c4123301eb66ac5cf69d0b9eaafc61e98 6e0dffccdce24bca20e87d5ba0f0995c9a1ae8983283e71e7dbfcf6fffc67a58
|
||||
lib/codeql/rust/elements/internal/generated/StructPatField.qll 5b5c7302dbc4a902ca8e69ff31875c867e295a16a626ba3cef29cd0aa248f179 4e192a0df79947f5cb0d47fdbbba7986137a6a40a1be92ae119873e2fad67edf
|
||||
lib/codeql/rust/elements/internal/generated/StructPatFieldList.qll 1a95a1bd9f64fb18e9571657cf2d02a8b13c747048a1f0f74baf31b91f0392ad fc274e414ff4ed54386046505920de92755ad0b4d39a7523cdffa4830bd53b37
|
||||
lib/codeql/rust/elements/internal/generated/Synth.qll eb248f4e57985ec8eabf9ed5cfb8ba8f5ebd6ca17fb712c992811bced0e342d4 bbcbdba484d3b977a0d6b9158c5fa506f59ced2ad3ae8239d536bf826bfb7e31
|
||||
lib/codeql/rust/elements/internal/generated/Synth.qll ebacd7cf6d7fb784cc77b75032608a622627e6f5e635aa70707df167ce3dc510 0e8ed9d5185afde22d263f3745e5029f23a1041690a80d0df916470823abdf43
|
||||
lib/codeql/rust/elements/internal/generated/SynthConstructors.qll bcc7f617b775ac0c7f04b1cc333ed7cc0bd91f1fabc8baa03c824d1df03f6076 bcc7f617b775ac0c7f04b1cc333ed7cc0bd91f1fabc8baa03c824d1df03f6076
|
||||
lib/codeql/rust/elements/internal/generated/Token.qll 77a91a25ca5669703cf3a4353b591cef4d72caa6b0b9db07bb9e005d69c848d1 2fdffc4882ed3a6ca9ac6d1fb5f1ac5a471ca703e2ffdc642885fa558d6e373b
|
||||
lib/codeql/rust/elements/internal/generated/TokenTree.qll 1a3c4f5f30659738641abdd28cb793dab3cfde484196b59656fc0a2767e53511 de2ebb210c7759ef7a6f7ee9f805e1cac879221287281775fc80ba34a5492edf
|
||||
@@ -640,14 +641,13 @@ lib/codeql/rust/elements/internal/generated/TypeRepr.qll 1e7b9d2ddab86e35dad7c31
|
||||
lib/codeql/rust/elements/internal/generated/UnderscoreExpr.qll b3780c99c5d57159bef4c6bd2fd8ec44ebd1854c892c1ca776c740f71249e58c 2fd451cbf0a779e8042e439882e7d9cadc19d1e596df3bbb086d16f2596407c7
|
||||
lib/codeql/rust/elements/internal/generated/Unextracted.qll 01563dfd769d6dc3c6b8a40d9a4dc0d99a3b6a0c6725c180d2bf4d7633929a17 a93ce90f8c03f4305e59de9c63f089fc7935298fc9a73d091d76933cf63e790c
|
||||
lib/codeql/rust/elements/internal/generated/Unimplemented.qll a3eb304781991bff1227de1e4422b68bf91e7b344e4f6c9e874b324e82a35e60 6bc4839fda3850a56dc993b79ef9ba921008395c8432b184e14438fba4566f21
|
||||
lib/codeql/rust/elements/internal/generated/Union.qll 0d5528d9331cc7599f0c7bc4d2b17908a9f90037bc94b8b7cd8bed058df98e45 986b33efddc36ff34acaf3d38bd3f90055aa14ec018432f5d4510037fc8ee59f
|
||||
lib/codeql/rust/elements/internal/generated/Union.qll 456504e6a32991ba17ca65f97636f4dfb86c758c7f8509aaca1b0d0432231dfe c96068edfec3e0755a7726426a10996455ee9f0f2d678af258719f1943a3063e
|
||||
lib/codeql/rust/elements/internal/generated/Use.qll cf95b5c4756b25bee74113207786e37464ffbc0fb5f776a04c651300afc53753 1fe26b3904db510184cb688cb0eeb0a8dbac7ac15e27a3b572d839743c738393
|
||||
lib/codeql/rust/elements/internal/generated/UseBoundGenericArg.qll 69162794e871291545ea04f61259b2d000671a96f7ca129f7dd9ed6e984067c4 31de9ebc0634b38e2347e0608b4ea888892f1f2732a2892464078cd8a07b4ee8
|
||||
lib/codeql/rust/elements/internal/generated/UseBoundGenericArgs.qll 2cc8ab0068b7bf44ca17a62b32a8dd1d89cd743532c8a96b262b164fd81b0c36 347e7709a0f5ace197beb6827f6cf04a31ff68ff2dff3707914c6b910658d00a
|
||||
lib/codeql/rust/elements/internal/generated/UseTree.qll 3d7cbcc8ae76068b8f660c7d5b81b05595026043015cd6b4d42a60ed4c165811 b9f0bcf82feb31f31406e787670fee93e1aa0966bcc0e4cc285c342e88793e4e
|
||||
lib/codeql/rust/elements/internal/generated/UseTreeList.qll 38efaa569b76ca79be047703279388e8f64583a126b98078fbbb6586e0c6eb56 1623a50fd2d3b1e4b85323ad73dd655172f7cbc658d3506aaa6b409e9ebe576e
|
||||
lib/codeql/rust/elements/internal/generated/Variant.qll 56ef12f3be672a467b443f8e121ba075551c88fe42dd1428e6fa7fc5affb6ec2 fd66722fd401a47305e0792458528a6af2437c97355a6a624727cf6632721a89
|
||||
lib/codeql/rust/elements/internal/generated/VariantDef.qll 3a579b21a13bdd6be8cddaa43a6aa0028a27c4e513caa003a6304e160fc53846 1ca1c41ed27660b17fbfb44b67aa8db087ea655f01bac29b57bb19fa259d07a2
|
||||
lib/codeql/rust/elements/internal/generated/Variant.qll fa6909715133049b3dba4622e6262fa30c4a9478b6219ec4fd12e07c58750709 71fc2ddac97fc4c4e6b92a13ee217cccc81dffc7c12295b6bc97c56ad25a92cc
|
||||
lib/codeql/rust/elements/internal/generated/VariantList.qll 3f70bfde982e5c5e8ee45da6ebe149286214f8d40377d5bc5e25df6ae8f3e2d1 22e5f428bf64fd3fd21c537bfa69a46089aad7c363d72c6566474fbe1d75859e
|
||||
lib/codeql/rust/elements/internal/generated/Visibility.qll af1069733c0120fae8610b3ebbcdcebe4b4c9ce4c3e3d9be3f82a93541873625 266106bdff4d7041d017871d755c011e7dd396c5999803d9e46725b6a03a2458
|
||||
lib/codeql/rust/elements/internal/generated/WhereClause.qll aec72d358689d99741c769b6e8e72b92c1458138c097ec2380e917aa68119ff0 81bb9d303bc0c8d2513dc7a2b8802ec15345b364e6c1e8b300f7860aac219c36
|
||||
@@ -656,7 +656,7 @@ lib/codeql/rust/elements/internal/generated/WhileExpr.qll 0353aab87c49569e1fbf58
|
||||
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 da721d51bc659921998521579df5bff6172d9079d8e243c2b65a5b9eb441b52e da721d51bc659921998521579df5bff6172d9079d8e243c2b65a5b9eb441b52e
|
||||
lib/codeql/rust/elements.qll 6ebcf16ef214075bc43562c246c11f8b90c089ff1b5041ab1b39ab9f4a40e9b3 6ebcf16ef214075bc43562c246c11f8b90c089ff1b5041ab1b39ab9f4a40e9b3
|
||||
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
|
||||
@@ -772,10 +772,11 @@ test/extractor-tests/generated/ContinueExpr/ContinueExpr_getLifetime.ql 39dae987
|
||||
test/extractor-tests/generated/Crate/MISSING_SOURCE.txt b6cf5771fdbbe981aeb3f443ec7a40517b6e99ffc9817fd8872c2e344240dae1 b6cf5771fdbbe981aeb3f443ec7a40517b6e99ffc9817fd8872c2e344240dae1
|
||||
test/extractor-tests/generated/DynTraitTypeRepr/DynTraitTypeRepr.ql 513d64b564f359e1022ae6f3d6d4a8ad637f595f01f29a6c2a167d1c2e8f1f99 0c7a7af6ee1005126b9ab77b2a7732821f85f1d2d426312c98206cbbedc19bb2
|
||||
test/extractor-tests/generated/DynTraitTypeRepr/DynTraitTypeRepr_getTypeBoundList.ql b20720ff0b147d55cea6f2de44d5bf297e79991eaf103938ccd7ab9d129e9656 eb8c9db2581cea00c29d7772de0b0a125be02c37092217a419f1a2b6a9711a6c
|
||||
test/extractor-tests/generated/Enum/Enum.ql eebc780aef77b87e6062724dd8ddb8f3ad33021061c95924c2c2439798ffbb87 0d19552872a2254f66a78b999a488ce2becdb0b0611b858e0bee2b119ee08eae
|
||||
test/extractor-tests/generated/Enum/Enum.ql 7c96c17f4adae679a7a8b097c5bfb26978263398b77dfa6e5b0e7f547d8bbd64 18375fad5a3d574c627b563529fa9c03f7d140e872ce7db81895fcb8da87f001
|
||||
test/extractor-tests/generated/Enum/Enum_getAttr.ql 8109ef2495f4a154e3bb408d549a16c6085e28de3aa9b40b51043af3d007afa7 868cf275a582266ffa8da556d99247bc8af0fdf3b43026c49e250cf0cac64687
|
||||
test/extractor-tests/generated/Enum/Enum_getAttributeMacroExpansion.ql 571ec6396fb7fc703b23aab651b3c6c05c9b5cd9d69a9ae8f5e36d69a18c89d3 c04025992f76bce7638728847f1ef835d3a48d3dc3368a4d3b73b778f1334618
|
||||
test/extractor-tests/generated/Enum/Enum_getCrateOrigin.ql 76d32838b7800ed8e5cab895c9dbea76129f96afab949598bebec2b0cb34b7ff 226d099377c9d499cc614b45aa7e26756124d82f07b797863ad2ac6a6b2f5acb
|
||||
test/extractor-tests/generated/Enum/Enum_getDeriveMacroExpansion.ql c7d3c2f1661a0a39bacf7f4977bd484133d9ee3934956d33f77ae1c83145b027 f5e374a3b620d3ef69bcc23123598179bcb4f1167dd29c18c84ad05c94c7957b
|
||||
test/extractor-tests/generated/Enum/Enum_getExtendedCanonicalPath.ql 001bb634adc4b20afb241bff41194bc91ba8544d1edd55958a01975e2ac428e1 c7c3fe3dc22a1887981a895a1e5262b1d0ad18f5052c67aa73094586de5212f6
|
||||
test/extractor-tests/generated/Enum/Enum_getGenericParamList.ql 2a858a07195a4b26b8c92e28519995bd6eba64889bddd126e161038f4a8d78e0 db188f238db915c67b084bc85aa0784c6a20b97b5a5f1966b3530c4c945b5527
|
||||
test/extractor-tests/generated/Enum/Enum_getName.ql 32a8638534f37bfd416a6906114a3bcaf985af118a165b78f2c8fffd9f1841b8 c9ca8030622932dd6ceab7d41e05f86b923f77067b457fb7ec196fe4f4155397
|
||||
@@ -1091,10 +1092,11 @@ test/extractor-tests/generated/StmtList/StmtList.ql 0010df0d5e30f7bed3bd5d916faf
|
||||
test/extractor-tests/generated/StmtList/StmtList_getAttr.ql 78d4bf65273498f04238706330b03d0b61dd03b001531f05fcb2230f24ceab64 6e02cee05c0b9f104ddea72b20097034edb76e985188b3f10f079bb03163b830
|
||||
test/extractor-tests/generated/StmtList/StmtList_getStatement.ql abbc3bcf98aab395fc851d5cc58c9c8a13fe1bdd531723bec1bc1b8ddbec6614 e302a26079986fa055306a1f641533dfde36c9bc0dd7958d21e2518b59e808c2
|
||||
test/extractor-tests/generated/StmtList/StmtList_getTailExpr.ql 578d7c944ef42bdb822fc6ce52fe3d49a0012cf7854cfddbb3d5117133700587 64ea407455a3b4dfbb86202e71a72b5abbff885479367b2834c0dd16d1f9d0ee
|
||||
test/extractor-tests/generated/Struct/Struct.ql a4e5d3fe4f994bdf911ebed54a65d237cd5a00510337e911bd5286637bc8ea80 a335224605f3cc35635bf5fd0bebcb50800429c0a82a5aa86a37cb9f6eb3f651
|
||||
test/extractor-tests/generated/Struct/Struct.ql ffaaa49314c26bd0a206b692d480254acc6e87233f679fbe936094c81c071de2 cae27f50c3bf787aead37077c9fe32e66c1a247a8a8c1f6f9b241493b1b793fc
|
||||
test/extractor-tests/generated/Struct/Struct_getAttr.ql 028d90ddc5189b82cfc8de20f9e05d98e8a12cc185705481f91dd209f2cb1f87 760780a48c12be4581c1675c46aae054a6198196a55b6b989402cc29b7caf245
|
||||
test/extractor-tests/generated/Struct/Struct_getAttributeMacroExpansion.ql a17504527a307615d26c2c4b6c21fe9b508f5a77a741d68ca605d2e69668e385 f755d8965c10568a57ff44432a795a0a36b86007fc7470bc652d555946e19231
|
||||
test/extractor-tests/generated/Struct/Struct_getCrateOrigin.ql 289622244a1333277d3b1507c5cea7c7dd29a7905774f974d8c2100cea50b35f d32941a2d08d7830b42c263ee336bf54de5240bfc22082341b4420a20a1886c7
|
||||
test/extractor-tests/generated/Struct/Struct_getDeriveMacroExpansion.ql e4849a63be9f413426dd0f183d1229fa4dd1c521e87479622a80c52179e3bb03 5ae88d61ffa7b0a52a62fd16ba5cc5816c2b7b2c0db726e3125e525bbbc10a18
|
||||
test/extractor-tests/generated/Struct/Struct_getExtendedCanonicalPath.ql 866a5893bd0869224fb8aadd071fba35b5386183bb476f5de45c9de7ab88c583 267aedc228d69e31ca8e95dcab6bcb1aa30f9ebaea43896a55016b7d68e3c441
|
||||
test/extractor-tests/generated/Struct/Struct_getFieldList.ql f45d6d5d953741e52aca67129994b80f6904b2e6b43c519d6d42c29c7b663c42 77a7d07e8462fa608efc58af97ce8f17c5369f9573f9d200191136607cb0e600
|
||||
test/extractor-tests/generated/Struct/Struct_getGenericParamList.ql cd72452713004690b77086163541fa319f8ab5faf503bb4a6a20bcaf2f790d38 4d72e891c5fac6e491d9e18b87ecf680dc423787d6b419da8f700fe1a14bc26f
|
||||
@@ -1206,10 +1208,11 @@ test/extractor-tests/generated/TypeParam/TypeParam_getName.ql 9d5b6d6a9f2a5793e2
|
||||
test/extractor-tests/generated/TypeParam/TypeParam_getTypeBoundList.ql 080a6b370ad460bf128fdfd632aa443af2ad91c3483e192ad756eb234dbfa4d8 8b048d282963f670db357f1eef9b8339f83d03adf57489a22b441d5c782aff62
|
||||
test/extractor-tests/generated/UnderscoreExpr/UnderscoreExpr.ql 4ad6ed0c803fb4f58094a55b866940b947b16259756c674200172551ee6546e0 d3270bdcc4c026325159bd2a59848eb51d96298b2bf21402ea0a83ac1ea6d291
|
||||
test/extractor-tests/generated/UnderscoreExpr/UnderscoreExpr_getAttr.ql d8502be88bcd97465f387c410b5078a4709e32b2baa556a4918ea5e609c40dd7 b238dc37404254e3e7806d50a7b1453e17e71da122931331b16a55853d3a843f
|
||||
test/extractor-tests/generated/Union/Union.ql 2795c83d4511fadf24cc66a762adbabca084bc6ac48501715f666979d2ea9ea5 7efae5209ae3ee8c73cd1c9e9e05f01b3fdda65d9a553c2ac5216351b6f15e5c
|
||||
test/extractor-tests/generated/Union/Union.ql 4974339feb10ab65bef60ba713058cb73ba7dcf5e451ddf6c919e94f96f56a80 f0f0025666940e4b0f72ef2e64b28e96b1a410f25f56c98cbebdd019ceece7b6
|
||||
test/extractor-tests/generated/Union/Union_getAttr.ql 42fa0878a6566208863b1d884baf7b68b46089827fdb1dbbfacbfccf5966a9a2 54aa94f0281ca80d1a4bdb0e2240f4384af2ab8d50f251875d1877d0964579fc
|
||||
test/extractor-tests/generated/Union/Union_getAttributeMacroExpansion.ql ddd0133a497dc057a353b86acc8ed991fefeaefa335d8ad9fe95109a90e39e54 fcaed4287815226843157c007674b1f1405cae31856fed1113d569bab5608d9b
|
||||
test/extractor-tests/generated/Union/Union_getCrateOrigin.ql c218308cf17b1490550229a725542d248617661b1a5fa14e9b0e18d29c5ecc00 e0489242c8ff7aa4dbfdebcd46a5e0d9bea0aa618eb0617e76b9b6f863a2907a
|
||||
test/extractor-tests/generated/Union/Union_getDeriveMacroExpansion.ql 82ee99ea42d6de9a45289a4b8e750cba887ac9daa2f6387b8c2a9062224da45c 1f18cd80f93ca2e19d3ac8ce733f264522ba785078f541342c816e16194748d6
|
||||
test/extractor-tests/generated/Union/Union_getExtendedCanonicalPath.ql 6268ddb68c3e05906e3fc85e40635925b84e5c7290746ded9c6814d362033068 04473b3b9891012e95733463018db8da0e96659ea0b10458b33dc857c091d278
|
||||
test/extractor-tests/generated/Union/Union_getGenericParamList.ql c55156ae26b766e385be7d21e67f8c3c45c29274201c93d660077fcc47e1ceee 4c4d338e17c32876ef6e51fd19cff67d125dd89c10e939dfaadbac824bef6a68
|
||||
test/extractor-tests/generated/Union/Union_getName.ql 17247183e1a8c8bbb15e67120f65ca323630bddeb614fa8a48e1e74319f8ed37 e21c2a0205bc991ba86f3e508451ef31398bdf5441f6d2a3f72113aaae9e152b
|
||||
|
||||
9
rust/ql/.gitattributes
generated
vendored
9
rust/ql/.gitattributes
generated
vendored
@@ -3,6 +3,7 @@
|
||||
/lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll linguist-generated
|
||||
/lib/codeql/rust/elements/Abi.qll linguist-generated
|
||||
/lib/codeql/rust/elements/Addressable.qll linguist-generated
|
||||
/lib/codeql/rust/elements/Adt.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ArgList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ArrayExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/ArrayListExpr.qll linguist-generated
|
||||
@@ -183,7 +184,6 @@
|
||||
/lib/codeql/rust/elements/UseTree.qll linguist-generated
|
||||
/lib/codeql/rust/elements/UseTreeList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/Variant.qll linguist-generated
|
||||
/lib/codeql/rust/elements/VariantDef.qll linguist-generated
|
||||
/lib/codeql/rust/elements/VariantList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/Visibility.qll linguist-generated
|
||||
/lib/codeql/rust/elements/WhereClause.qll linguist-generated
|
||||
@@ -194,6 +194,7 @@
|
||||
/lib/codeql/rust/elements/YieldExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/AbiConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/AbiImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/AdtImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ArgListConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ArgListImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/ArrayExprInternal.qll linguist-generated
|
||||
@@ -444,7 +445,6 @@
|
||||
/lib/codeql/rust/elements/internal/UseTreeListConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/UseTreeListImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/VariantConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/VariantDefImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/VariantListConstructor.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/VariantListImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/VisibilityConstructor.qll linguist-generated
|
||||
@@ -461,6 +461,7 @@
|
||||
/lib/codeql/rust/elements/internal/YieldExprImpl.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/Abi.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/Addressable.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/Adt.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ArgList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ArrayExpr.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/ArrayExprInternal.qll linguist-generated
|
||||
@@ -649,7 +650,6 @@
|
||||
/lib/codeql/rust/elements/internal/generated/UseTree.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/UseTreeList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/Variant.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/VariantDef.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/VariantList.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/Visibility.qll linguist-generated
|
||||
/lib/codeql/rust/elements/internal/generated/WhereClause.qll linguist-generated
|
||||
@@ -778,6 +778,7 @@
|
||||
/test/extractor-tests/generated/Enum/Enum_getAttr.ql linguist-generated
|
||||
/test/extractor-tests/generated/Enum/Enum_getAttributeMacroExpansion.ql linguist-generated
|
||||
/test/extractor-tests/generated/Enum/Enum_getCrateOrigin.ql linguist-generated
|
||||
/test/extractor-tests/generated/Enum/Enum_getDeriveMacroExpansion.ql linguist-generated
|
||||
/test/extractor-tests/generated/Enum/Enum_getExtendedCanonicalPath.ql linguist-generated
|
||||
/test/extractor-tests/generated/Enum/Enum_getGenericParamList.ql linguist-generated
|
||||
/test/extractor-tests/generated/Enum/Enum_getName.ql linguist-generated
|
||||
@@ -1097,6 +1098,7 @@
|
||||
/test/extractor-tests/generated/Struct/Struct_getAttr.ql linguist-generated
|
||||
/test/extractor-tests/generated/Struct/Struct_getAttributeMacroExpansion.ql linguist-generated
|
||||
/test/extractor-tests/generated/Struct/Struct_getCrateOrigin.ql linguist-generated
|
||||
/test/extractor-tests/generated/Struct/Struct_getDeriveMacroExpansion.ql linguist-generated
|
||||
/test/extractor-tests/generated/Struct/Struct_getExtendedCanonicalPath.ql linguist-generated
|
||||
/test/extractor-tests/generated/Struct/Struct_getFieldList.ql linguist-generated
|
||||
/test/extractor-tests/generated/Struct/Struct_getGenericParamList.ql linguist-generated
|
||||
@@ -1212,6 +1214,7 @@
|
||||
/test/extractor-tests/generated/Union/Union_getAttr.ql linguist-generated
|
||||
/test/extractor-tests/generated/Union/Union_getAttributeMacroExpansion.ql linguist-generated
|
||||
/test/extractor-tests/generated/Union/Union_getCrateOrigin.ql linguist-generated
|
||||
/test/extractor-tests/generated/Union/Union_getDeriveMacroExpansion.ql linguist-generated
|
||||
/test/extractor-tests/generated/Union/Union_getExtendedCanonicalPath.ql linguist-generated
|
||||
/test/extractor-tests/generated/Union/Union_getGenericParamList.ql linguist-generated
|
||||
/test/extractor-tests/generated/Union/Union_getName.ql linguist-generated
|
||||
|
||||
2
rust/ql/lib/codeql/rust/elements.qll
generated
2
rust/ql/lib/codeql/rust/elements.qll
generated
@@ -6,6 +6,7 @@
|
||||
import codeql.files.FileSystem
|
||||
import codeql.rust.elements.Abi
|
||||
import codeql.rust.elements.Addressable
|
||||
import codeql.rust.elements.Adt
|
||||
import codeql.rust.elements.ArgList
|
||||
import codeql.rust.elements.ArrayExpr
|
||||
import codeql.rust.elements.ArrayListExpr
|
||||
@@ -186,7 +187,6 @@ import codeql.rust.elements.UseBoundGenericArgs
|
||||
import codeql.rust.elements.UseTree
|
||||
import codeql.rust.elements.UseTreeList
|
||||
import codeql.rust.elements.Variant
|
||||
import codeql.rust.elements.VariantDef
|
||||
import codeql.rust.elements.VariantList
|
||||
import codeql.rust.elements.Visibility
|
||||
import codeql.rust.elements.WhereClause
|
||||
|
||||
13
rust/ql/lib/codeql/rust/elements/Adt.qll
generated
Normal file
13
rust/ql/lib/codeql/rust/elements/Adt.qll
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
// generated by codegen, do not edit
|
||||
/**
|
||||
* This module provides the public class `Adt`.
|
||||
*/
|
||||
|
||||
private import internal.AdtImpl
|
||||
import codeql.rust.elements.Item
|
||||
import codeql.rust.elements.MacroItems
|
||||
|
||||
/**
|
||||
* An ADT (Abstract Data Type) definition, such as `Struct`, `Enum`, or `Union`.
|
||||
*/
|
||||
final class Adt = Impl::Adt;
|
||||
2
rust/ql/lib/codeql/rust/elements/Enum.qll
generated
2
rust/ql/lib/codeql/rust/elements/Enum.qll
generated
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
|
||||
private import internal.EnumImpl
|
||||
import codeql.rust.elements.Adt
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.GenericParamList
|
||||
import codeql.rust.elements.Item
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.VariantList
|
||||
import codeql.rust.elements.Visibility
|
||||
|
||||
3
rust/ql/lib/codeql/rust/elements/Struct.qll
generated
3
rust/ql/lib/codeql/rust/elements/Struct.qll
generated
@@ -4,12 +4,11 @@
|
||||
*/
|
||||
|
||||
private import internal.StructImpl
|
||||
import codeql.rust.elements.Adt
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.FieldList
|
||||
import codeql.rust.elements.GenericParamList
|
||||
import codeql.rust.elements.Item
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.VariantDef
|
||||
import codeql.rust.elements.Visibility
|
||||
import codeql.rust.elements.WhereClause
|
||||
|
||||
|
||||
3
rust/ql/lib/codeql/rust/elements/Union.qll
generated
3
rust/ql/lib/codeql/rust/elements/Union.qll
generated
@@ -4,12 +4,11 @@
|
||||
*/
|
||||
|
||||
private import internal.UnionImpl
|
||||
import codeql.rust.elements.Adt
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.GenericParamList
|
||||
import codeql.rust.elements.Item
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.StructFieldList
|
||||
import codeql.rust.elements.VariantDef
|
||||
import codeql.rust.elements.Visibility
|
||||
import codeql.rust.elements.WhereClause
|
||||
|
||||
|
||||
1
rust/ql/lib/codeql/rust/elements/Variant.qll
generated
1
rust/ql/lib/codeql/rust/elements/Variant.qll
generated
@@ -9,7 +9,6 @@ import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.Expr
|
||||
import codeql.rust.elements.FieldList
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.VariantDef
|
||||
import codeql.rust.elements.Visibility
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// generated by codegen, do not edit
|
||||
/**
|
||||
* This module provides the public class `VariantDef`.
|
||||
*/
|
||||
|
||||
private import internal.VariantDefImpl
|
||||
import codeql.rust.elements.AstNode
|
||||
|
||||
final class VariantDef = Impl::VariantDef;
|
||||
@@ -1,16 +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 `VariantDef`.
|
||||
* This module provides a hand-modifiable wrapper around the generated class `Adt`.
|
||||
*
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
|
||||
private import codeql.rust.elements.internal.generated.VariantDef
|
||||
private import codeql.rust.elements.internal.generated.Adt
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the customizable definition of `VariantDef` and should not
|
||||
* INTERNAL: This module contains the customizable definition of `Adt` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Impl {
|
||||
class VariantDef extends Generated::VariantDef { }
|
||||
/**
|
||||
* An ADT (Abstract Data Type) definition, such as `Struct`, `Enum`, or `Union`.
|
||||
*/
|
||||
class Adt extends Generated::Adt { }
|
||||
}
|
||||
45
rust/ql/lib/codeql/rust/elements/internal/generated/Adt.qll
generated
Normal file
45
rust/ql/lib/codeql/rust/elements/internal/generated/Adt.qll
generated
Normal file
@@ -0,0 +1,45 @@
|
||||
// generated by codegen, do not edit
|
||||
/**
|
||||
* This module provides the generated definition of `Adt`.
|
||||
* 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.internal.ItemImpl::Impl as ItemImpl
|
||||
import codeql.rust.elements.MacroItems
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `Adt` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* An ADT (Abstract Data Type) definition, such as `Struct`, `Enum`, or `Union`.
|
||||
* INTERNAL: Do not reference the `Generated::Adt` class directly.
|
||||
* Use the subclass `Adt`, where the following predicates are available.
|
||||
*/
|
||||
class Adt extends Synth::TAdt, ItemImpl::Item {
|
||||
/**
|
||||
* Gets the `index`th derive macro expansion of this adt (0-based).
|
||||
*/
|
||||
MacroItems getDeriveMacroExpansion(int index) {
|
||||
result =
|
||||
Synth::convertMacroItemsFromRaw(Synth::convertAdtToRaw(this)
|
||||
.(Raw::Adt)
|
||||
.getDeriveMacroExpansion(index))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets any of the derive macro expansions of this adt.
|
||||
*/
|
||||
final MacroItems getADeriveMacroExpansion() { result = this.getDeriveMacroExpansion(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of derive macro expansions of this adt.
|
||||
*/
|
||||
final int getNumberOfDeriveMacroExpansions() {
|
||||
result = count(int i | exists(this.getDeriveMacroExpansion(i)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
private import codeql.rust.elements.internal.generated.Synth
|
||||
private import codeql.rust.elements.internal.generated.Raw
|
||||
import codeql.rust.elements.internal.AdtImpl::Impl as AdtImpl
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.GenericParamList
|
||||
import codeql.rust.elements.internal.ItemImpl::Impl as ItemImpl
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.VariantList
|
||||
import codeql.rust.elements.Visibility
|
||||
@@ -29,7 +29,7 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::Enum` class directly.
|
||||
* Use the subclass `Enum`, where the following predicates are available.
|
||||
*/
|
||||
class Enum extends Synth::TEnum, ItemImpl::Item {
|
||||
class Enum extends Synth::TEnum, AdtImpl::Adt {
|
||||
override string getAPrimaryQlClass() { result = "Enum" }
|
||||
|
||||
/**
|
||||
|
||||
@@ -1289,19 +1289,6 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfVariantDef(VariantDef 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 getImmediateChildOfVariantList(
|
||||
VariantList e, int index, string partialPredicateCall
|
||||
) {
|
||||
@@ -3074,14 +3061,12 @@ private module Impl {
|
||||
|
||||
private Element getImmediateChildOfVariant(Variant e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bVariantDef, int bAddressable, int n, int nAttr, int nDiscriminant, int nFieldList,
|
||||
int nName, int nVisibility
|
||||
int b, int bAddressable, int n, int nAttr, int nDiscriminant, int nFieldList, int nName,
|
||||
int nVisibility
|
||||
|
|
||||
b = 0 and
|
||||
bVariantDef =
|
||||
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfVariantDef(e, i, _)) | i) and
|
||||
bAddressable =
|
||||
bVariantDef + 1 + max(int i | i = -1 or exists(getImmediateChildOfAddressable(e, i, _)) | i) and
|
||||
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAddressable(e, i, _)) | i) and
|
||||
n = bAddressable and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nDiscriminant = nAttr + 1 and
|
||||
@@ -3091,9 +3076,7 @@ private module Impl {
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfVariantDef(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = getImmediateChildOfAddressable(e, index - bVariantDef, partialPredicateCall)
|
||||
result = getImmediateChildOfAddressable(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
@@ -3164,6 +3147,24 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfAdt(Adt e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bItem, int n, int nDeriveMacroExpansion |
|
||||
b = 0 and
|
||||
bItem = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfItem(e, i, _)) | i) and
|
||||
n = bItem and
|
||||
nDeriveMacroExpansion =
|
||||
n + 1 + max(int i | i = -1 or exists(e.getDeriveMacroExpansion(i)) | i) and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfItem(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getDeriveMacroExpansion(index - n) and
|
||||
partialPredicateCall = "DeriveMacroExpansion(" + (index - n).toString() + ")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfArrayListExpr(
|
||||
ArrayListExpr e, int index, string partialPredicateCall
|
||||
) {
|
||||
@@ -3275,47 +3276,6 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfEnum(Enum e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bItem, int n, int nAttr, int nGenericParamList, int nName, int nVariantList,
|
||||
int nVisibility, int nWhereClause
|
||||
|
|
||||
b = 0 and
|
||||
bItem = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfItem(e, i, _)) | i) and
|
||||
n = bItem and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nGenericParamList = nAttr + 1 and
|
||||
nName = nGenericParamList + 1 and
|
||||
nVariantList = nName + 1 and
|
||||
nVisibility = nVariantList + 1 and
|
||||
nWhereClause = nVisibility + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfItem(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and
|
||||
result = e.getGenericParamList() and
|
||||
partialPredicateCall = "GenericParamList()"
|
||||
or
|
||||
index = nGenericParamList and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and result = e.getVariantList() and partialPredicateCall = "VariantList()"
|
||||
or
|
||||
index = nVariantList and
|
||||
result = e.getVisibility() and
|
||||
partialPredicateCall = "Visibility()"
|
||||
or
|
||||
index = nVisibility and
|
||||
result = e.getWhereClause() and
|
||||
partialPredicateCall = "WhereClause()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfExternBlock(
|
||||
ExternBlock e, int index, string partialPredicateCall
|
||||
) {
|
||||
@@ -3730,49 +3690,6 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfStruct(Struct e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bItem, int bVariantDef, int n, int nAttr, int nFieldList, int nGenericParamList,
|
||||
int nName, int nVisibility, int nWhereClause
|
||||
|
|
||||
b = 0 and
|
||||
bItem = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfItem(e, i, _)) | i) and
|
||||
bVariantDef =
|
||||
bItem + 1 + max(int i | i = -1 or exists(getImmediateChildOfVariantDef(e, i, _)) | i) and
|
||||
n = bVariantDef and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nFieldList = nAttr + 1 and
|
||||
nGenericParamList = nFieldList + 1 and
|
||||
nName = nGenericParamList + 1 and
|
||||
nVisibility = nName + 1 and
|
||||
nWhereClause = nVisibility + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfItem(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = getImmediateChildOfVariantDef(e, index - bItem, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and result = e.getFieldList() and partialPredicateCall = "FieldList()"
|
||||
or
|
||||
index = nFieldList and
|
||||
result = e.getGenericParamList() and
|
||||
partialPredicateCall = "GenericParamList()"
|
||||
or
|
||||
index = nGenericParamList and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and result = e.getVisibility() and partialPredicateCall = "Visibility()"
|
||||
or
|
||||
index = nVisibility and
|
||||
result = e.getWhereClause() and
|
||||
partialPredicateCall = "WhereClause()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfStructExpr(StructExpr e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bExpr, int bPathAstNode, int n, int nStructExprFieldList |
|
||||
b = 0 and
|
||||
@@ -3978,53 +3895,6 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfUnion(Union e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bItem, int bVariantDef, int n, int nAttr, int nGenericParamList, int nName,
|
||||
int nStructFieldList, int nVisibility, int nWhereClause
|
||||
|
|
||||
b = 0 and
|
||||
bItem = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfItem(e, i, _)) | i) and
|
||||
bVariantDef =
|
||||
bItem + 1 + max(int i | i = -1 or exists(getImmediateChildOfVariantDef(e, i, _)) | i) and
|
||||
n = bVariantDef and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nGenericParamList = nAttr + 1 and
|
||||
nName = nGenericParamList + 1 and
|
||||
nStructFieldList = nName + 1 and
|
||||
nVisibility = nStructFieldList + 1 and
|
||||
nWhereClause = nVisibility + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfItem(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = getImmediateChildOfVariantDef(e, index - bItem, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and
|
||||
result = e.getGenericParamList() and
|
||||
partialPredicateCall = "GenericParamList()"
|
||||
or
|
||||
index = nGenericParamList and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and
|
||||
result = e.getStructFieldList() and
|
||||
partialPredicateCall = "StructFieldList()"
|
||||
or
|
||||
index = nStructFieldList and
|
||||
result = e.getVisibility() and
|
||||
partialPredicateCall = "Visibility()"
|
||||
or
|
||||
index = nVisibility and
|
||||
result = e.getWhereClause() and
|
||||
partialPredicateCall = "WhereClause()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfUse(Use e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bItem, int n, int nAttr, int nUseTree, int nVisibility |
|
||||
b = 0 and
|
||||
@@ -4048,6 +3918,47 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfEnum(Enum e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bAdt, int n, int nAttr, int nGenericParamList, int nName, int nVariantList,
|
||||
int nVisibility, int nWhereClause
|
||||
|
|
||||
b = 0 and
|
||||
bAdt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAdt(e, i, _)) | i) and
|
||||
n = bAdt and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nGenericParamList = nAttr + 1 and
|
||||
nName = nGenericParamList + 1 and
|
||||
nVariantList = nName + 1 and
|
||||
nVisibility = nVariantList + 1 and
|
||||
nWhereClause = nVisibility + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfAdt(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and
|
||||
result = e.getGenericParamList() and
|
||||
partialPredicateCall = "GenericParamList()"
|
||||
or
|
||||
index = nGenericParamList and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and result = e.getVariantList() and partialPredicateCall = "VariantList()"
|
||||
or
|
||||
index = nVariantList and
|
||||
result = e.getVisibility() and
|
||||
partialPredicateCall = "Visibility()"
|
||||
or
|
||||
index = nVisibility and
|
||||
result = e.getWhereClause() and
|
||||
partialPredicateCall = "WhereClause()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfForExpr(ForExpr e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bLoopingExpr, int n, int nAttr, int nIterable, int nPat |
|
||||
b = 0 and
|
||||
@@ -4090,6 +4001,88 @@ private module Impl {
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfStruct(Struct e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bAdt, int n, int nAttr, int nFieldList, int nGenericParamList, int nName,
|
||||
int nVisibility, int nWhereClause
|
||||
|
|
||||
b = 0 and
|
||||
bAdt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAdt(e, i, _)) | i) and
|
||||
n = bAdt and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nFieldList = nAttr + 1 and
|
||||
nGenericParamList = nFieldList + 1 and
|
||||
nName = nGenericParamList + 1 and
|
||||
nVisibility = nName + 1 and
|
||||
nWhereClause = nVisibility + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfAdt(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and result = e.getFieldList() and partialPredicateCall = "FieldList()"
|
||||
or
|
||||
index = nFieldList and
|
||||
result = e.getGenericParamList() and
|
||||
partialPredicateCall = "GenericParamList()"
|
||||
or
|
||||
index = nGenericParamList and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and result = e.getVisibility() and partialPredicateCall = "Visibility()"
|
||||
or
|
||||
index = nVisibility and
|
||||
result = e.getWhereClause() and
|
||||
partialPredicateCall = "WhereClause()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfUnion(Union e, int index, string partialPredicateCall) {
|
||||
exists(
|
||||
int b, int bAdt, int n, int nAttr, int nGenericParamList, int nName, int nStructFieldList,
|
||||
int nVisibility, int nWhereClause
|
||||
|
|
||||
b = 0 and
|
||||
bAdt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAdt(e, i, _)) | i) and
|
||||
n = bAdt and
|
||||
nAttr = n + 1 + max(int i | i = -1 or exists(e.getAttr(i)) | i) and
|
||||
nGenericParamList = nAttr + 1 and
|
||||
nName = nGenericParamList + 1 and
|
||||
nStructFieldList = nName + 1 and
|
||||
nVisibility = nStructFieldList + 1 and
|
||||
nWhereClause = nVisibility + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfAdt(e, index - b, partialPredicateCall)
|
||||
or
|
||||
result = e.getAttr(index - n) and
|
||||
partialPredicateCall = "Attr(" + (index - n).toString() + ")"
|
||||
or
|
||||
index = nAttr and
|
||||
result = e.getGenericParamList() and
|
||||
partialPredicateCall = "GenericParamList()"
|
||||
or
|
||||
index = nGenericParamList and result = e.getName() and partialPredicateCall = "Name()"
|
||||
or
|
||||
index = nName and
|
||||
result = e.getStructFieldList() and
|
||||
partialPredicateCall = "StructFieldList()"
|
||||
or
|
||||
index = nStructFieldList and
|
||||
result = e.getVisibility() and
|
||||
partialPredicateCall = "Visibility()"
|
||||
or
|
||||
index = nVisibility and
|
||||
result = e.getWhereClause() and
|
||||
partialPredicateCall = "WhereClause()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private Element getImmediateChildOfWhileExpr(WhileExpr e, int index, string partialPredicateCall) {
|
||||
exists(int b, int bLoopingExpr, int n, int nAttr, int nCondition |
|
||||
b = 0 and
|
||||
@@ -4395,8 +4388,6 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfConst(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfEnum(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfExternBlock(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfExternCrate(e, index, partialAccessor)
|
||||
@@ -4423,8 +4414,6 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfStatic(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfStruct(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfStructExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfStructPat(e, index, partialAccessor)
|
||||
@@ -4437,14 +4426,18 @@ private module Impl {
|
||||
or
|
||||
result = getImmediateChildOfTypeAlias(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfUnion(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfUse(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfEnum(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfForExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfLoopExpr(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfStruct(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfUnion(e, index, partialAccessor)
|
||||
or
|
||||
result = getImmediateChildOfWhileExpr(e, index, partialAccessor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1370,11 +1370,6 @@ module Raw {
|
||||
UseTree getUseTree(int index) { use_tree_list_use_trees(this, index, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class VariantDef extends @variant_def, AstNode { }
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A list of variants in an enum declaration.
|
||||
@@ -3523,7 +3518,7 @@ module Raw {
|
||||
* // ^ ^^^^^^ ^^^^^^^^^^^^
|
||||
* ```
|
||||
*/
|
||||
class Variant extends @variant, VariantDef, Addressable {
|
||||
class Variant extends @variant, Addressable {
|
||||
override string toString() { result = "Variant" }
|
||||
|
||||
/**
|
||||
@@ -3610,6 +3605,19 @@ module Raw {
|
||||
Expr getExpr() { yield_expr_exprs(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* An ADT (Abstract Data Type) definition, such as `Struct`, `Enum`, or `Union`.
|
||||
*/
|
||||
class Adt extends @adt, Item {
|
||||
/**
|
||||
* Gets the `index`th derive macro expansion of this adt (0-based).
|
||||
*/
|
||||
MacroItems getDeriveMacroExpansion(int index) {
|
||||
adt_derive_macro_expansions(this, index, result)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A block expression. For example:
|
||||
@@ -3744,49 +3752,6 @@ module Raw {
|
||||
predicate hasImplementation() { const_has_implementation(this) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* An enum declaration.
|
||||
*
|
||||
* For example:
|
||||
* ```rust
|
||||
* enum E {A, B(i32), C {x: i32}}
|
||||
* ```
|
||||
*/
|
||||
class Enum extends @enum, Item {
|
||||
override string toString() { result = "Enum" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this enum (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { enum_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the generic parameter list of this enum, if it exists.
|
||||
*/
|
||||
GenericParamList getGenericParamList() { enum_generic_param_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this enum, if it exists.
|
||||
*/
|
||||
Name getName() { enum_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the variant list of this enum, if it exists.
|
||||
*/
|
||||
VariantList getVariantList() { enum_variant_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the visibility of this enum, if it exists.
|
||||
*/
|
||||
Visibility getVisibility() { enum_visibilities(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the where clause of this enum, if it exists.
|
||||
*/
|
||||
WhereClause getWhereClause() { enum_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* An extern block containing foreign function declarations.
|
||||
@@ -4273,50 +4238,6 @@ module Raw {
|
||||
Visibility getVisibility() { static_visibilities(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A Struct. For example:
|
||||
* ```rust
|
||||
* struct Point {
|
||||
* x: i32,
|
||||
* y: i32,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Struct extends @struct, Item, VariantDef {
|
||||
override string toString() { result = "Struct" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this struct (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { struct_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the field list of this struct, if it exists.
|
||||
*/
|
||||
FieldList getFieldList() { struct_field_lists_(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the generic parameter list of this struct, if it exists.
|
||||
*/
|
||||
GenericParamList getGenericParamList() { struct_generic_param_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this struct, if it exists.
|
||||
*/
|
||||
Name getName() { struct_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the visibility of this struct, if it exists.
|
||||
*/
|
||||
Visibility getVisibility() { struct_visibilities(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the where clause of this struct, if it exists.
|
||||
*/
|
||||
WhereClause getWhereClause() { struct_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A struct expression. For example:
|
||||
@@ -4538,49 +4459,6 @@ module Raw {
|
||||
WhereClause getWhereClause() { type_alias_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A union declaration.
|
||||
*
|
||||
* For example:
|
||||
* ```rust
|
||||
* union U { f1: u32, f2: f32 }
|
||||
* ```
|
||||
*/
|
||||
class Union extends @union, Item, VariantDef {
|
||||
override string toString() { result = "Union" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this union (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { union_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the generic parameter list of this union, if it exists.
|
||||
*/
|
||||
GenericParamList getGenericParamList() { union_generic_param_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this union, if it exists.
|
||||
*/
|
||||
Name getName() { union_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the struct field list of this union, if it exists.
|
||||
*/
|
||||
StructFieldList getStructFieldList() { union_struct_field_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the visibility of this union, if it exists.
|
||||
*/
|
||||
Visibility getVisibility() { union_visibilities(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the where clause of this union, if it exists.
|
||||
*/
|
||||
WhereClause getWhereClause() { union_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A `use` statement. For example:
|
||||
@@ -4607,6 +4485,49 @@ module Raw {
|
||||
Visibility getVisibility() { use_visibilities(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* An enum declaration.
|
||||
*
|
||||
* For example:
|
||||
* ```rust
|
||||
* enum E {A, B(i32), C {x: i32}}
|
||||
* ```
|
||||
*/
|
||||
class Enum extends @enum, Adt {
|
||||
override string toString() { result = "Enum" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this enum (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { enum_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the generic parameter list of this enum, if it exists.
|
||||
*/
|
||||
GenericParamList getGenericParamList() { enum_generic_param_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this enum, if it exists.
|
||||
*/
|
||||
Name getName() { enum_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the variant list of this enum, if it exists.
|
||||
*/
|
||||
VariantList getVariantList() { enum_variant_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the visibility of this enum, if it exists.
|
||||
*/
|
||||
Visibility getVisibility() { enum_visibilities(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the where clause of this enum, if it exists.
|
||||
*/
|
||||
WhereClause getWhereClause() { enum_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A for loop expression.
|
||||
@@ -4671,6 +4592,93 @@ module Raw {
|
||||
Attr getAttr(int index) { loop_expr_attrs(this, index, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A Struct. For example:
|
||||
* ```rust
|
||||
* struct Point {
|
||||
* x: i32,
|
||||
* y: i32,
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class Struct extends @struct, Adt {
|
||||
override string toString() { result = "Struct" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this struct (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { struct_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the field list of this struct, if it exists.
|
||||
*/
|
||||
FieldList getFieldList() { struct_field_lists_(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the generic parameter list of this struct, if it exists.
|
||||
*/
|
||||
GenericParamList getGenericParamList() { struct_generic_param_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this struct, if it exists.
|
||||
*/
|
||||
Name getName() { struct_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the visibility of this struct, if it exists.
|
||||
*/
|
||||
Visibility getVisibility() { struct_visibilities(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the where clause of this struct, if it exists.
|
||||
*/
|
||||
WhereClause getWhereClause() { struct_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A union declaration.
|
||||
*
|
||||
* For example:
|
||||
* ```rust
|
||||
* union U { f1: u32, f2: f32 }
|
||||
* ```
|
||||
*/
|
||||
class Union extends @union, Adt {
|
||||
override string toString() { result = "Union" }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this union (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { union_attrs(this, index, result) }
|
||||
|
||||
/**
|
||||
* Gets the generic parameter list of this union, if it exists.
|
||||
*/
|
||||
GenericParamList getGenericParamList() { union_generic_param_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the name of this union, if it exists.
|
||||
*/
|
||||
Name getName() { union_names(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the struct field list of this union, if it exists.
|
||||
*/
|
||||
StructFieldList getStructFieldList() { union_struct_field_lists(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the visibility of this union, if it exists.
|
||||
*/
|
||||
Visibility getVisibility() { union_visibilities(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the where clause of this union, if it exists.
|
||||
*/
|
||||
WhereClause getWhereClause() { union_where_clauses(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* A while loop expression.
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
|
||||
private import codeql.rust.elements.internal.generated.Synth
|
||||
private import codeql.rust.elements.internal.generated.Raw
|
||||
import codeql.rust.elements.internal.AdtImpl::Impl as AdtImpl
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.FieldList
|
||||
import codeql.rust.elements.GenericParamList
|
||||
import codeql.rust.elements.internal.ItemImpl::Impl as ItemImpl
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.internal.VariantDefImpl::Impl as VariantDefImpl
|
||||
import codeql.rust.elements.Visibility
|
||||
import codeql.rust.elements.WhereClause
|
||||
|
||||
@@ -31,7 +30,7 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::Struct` class directly.
|
||||
* Use the subclass `Struct`, where the following predicates are available.
|
||||
*/
|
||||
class Struct extends Synth::TStruct, ItemImpl::Item, VariantDefImpl::VariantDef {
|
||||
class Struct extends Synth::TStruct, AdtImpl::Adt {
|
||||
override string getAPrimaryQlClass() { result = "Struct" }
|
||||
|
||||
/**
|
||||
|
||||
@@ -688,6 +688,11 @@ module Synth {
|
||||
*/
|
||||
class TAddressable = TItem or TVariant;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TAdt = TEnum or TStruct or TUnion;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
@@ -722,8 +727,8 @@ module Synth {
|
||||
TReturnTypeSyntax or TSourceFile or TStmt or TStmtList or TStructExprField or
|
||||
TStructExprFieldList or TStructField or TStructPatField or TStructPatFieldList or TToken or
|
||||
TTokenTree or TTupleField or TTypeBound or TTypeBoundList or TTypeRepr or
|
||||
TUseBoundGenericArg or TUseBoundGenericArgs or TUseTree or TUseTreeList or TVariantDef or
|
||||
TVariantList or TVisibility or TWhereClause or TWherePred;
|
||||
TUseBoundGenericArg or TUseBoundGenericArgs or TUseTree or TUseTreeList or TVariantList or
|
||||
TVisibility or TWhereClause or TWherePred;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -770,9 +775,9 @@ module Synth {
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TItem =
|
||||
TConst or TEnum or TExternBlock or TExternCrate or TFunction or TImpl or TMacroCall or
|
||||
TMacroDef or TMacroRules or TModule or TStatic or TStruct or TTrait or TTraitAlias or
|
||||
TTypeAlias or TUnion or TUse;
|
||||
TAdt or TConst or TExternBlock or TExternCrate or TFunction or TImpl or TMacroCall or
|
||||
TMacroDef or TMacroRules or TModule or TStatic or TTrait or TTraitAlias or TTypeAlias or
|
||||
TUse;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -845,11 +850,6 @@ module Synth {
|
||||
*/
|
||||
class TUseBoundGenericArg = TLifetime or TNameRef;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*/
|
||||
class TVariantDef = TStruct or TUnion or TVariant;
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw element to a synthesized `TAbi`, if possible.
|
||||
@@ -1864,6 +1864,18 @@ module Synth {
|
||||
result = convertVariantFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw DB element to a synthesized `TAdt`, if possible.
|
||||
*/
|
||||
TAdt convertAdtFromRaw(Raw::Element e) {
|
||||
result = convertEnumFromRaw(e)
|
||||
or
|
||||
result = convertStructFromRaw(e)
|
||||
or
|
||||
result = convertUnionFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw DB element to a synthesized `TArrayExpr`, if possible.
|
||||
@@ -2039,8 +2051,6 @@ module Synth {
|
||||
or
|
||||
result = convertUseTreeListFromRaw(e)
|
||||
or
|
||||
result = convertVariantDefFromRaw(e)
|
||||
or
|
||||
result = convertVariantListFromRaw(e)
|
||||
or
|
||||
result = convertVisibilityFromRaw(e)
|
||||
@@ -2213,9 +2223,9 @@ module Synth {
|
||||
* Converts a raw DB element to a synthesized `TItem`, if possible.
|
||||
*/
|
||||
TItem convertItemFromRaw(Raw::Element e) {
|
||||
result = convertConstFromRaw(e)
|
||||
result = convertAdtFromRaw(e)
|
||||
or
|
||||
result = convertEnumFromRaw(e)
|
||||
result = convertConstFromRaw(e)
|
||||
or
|
||||
result = convertExternBlockFromRaw(e)
|
||||
or
|
||||
@@ -2235,16 +2245,12 @@ module Synth {
|
||||
or
|
||||
result = convertStaticFromRaw(e)
|
||||
or
|
||||
result = convertStructFromRaw(e)
|
||||
or
|
||||
result = convertTraitFromRaw(e)
|
||||
or
|
||||
result = convertTraitAliasFromRaw(e)
|
||||
or
|
||||
result = convertTypeAliasFromRaw(e)
|
||||
or
|
||||
result = convertUnionFromRaw(e)
|
||||
or
|
||||
result = convertUseFromRaw(e)
|
||||
}
|
||||
|
||||
@@ -2440,18 +2446,6 @@ module Synth {
|
||||
result = convertNameRefFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a raw DB element to a synthesized `TVariantDef`, if possible.
|
||||
*/
|
||||
TVariantDef convertVariantDefFromRaw(Raw::Element e) {
|
||||
result = convertStructFromRaw(e)
|
||||
or
|
||||
result = convertUnionFromRaw(e)
|
||||
or
|
||||
result = convertVariantFromRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TAbi` to a raw DB element, if possible.
|
||||
@@ -3464,6 +3458,18 @@ module Synth {
|
||||
result = convertVariantToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TAdt` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertAdtToRaw(TAdt e) {
|
||||
result = convertEnumToRaw(e)
|
||||
or
|
||||
result = convertStructToRaw(e)
|
||||
or
|
||||
result = convertUnionToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TArrayExpr` to a raw DB element, if possible.
|
||||
@@ -3639,8 +3645,6 @@ module Synth {
|
||||
or
|
||||
result = convertUseTreeListToRaw(e)
|
||||
or
|
||||
result = convertVariantDefToRaw(e)
|
||||
or
|
||||
result = convertVariantListToRaw(e)
|
||||
or
|
||||
result = convertVisibilityToRaw(e)
|
||||
@@ -3813,9 +3817,9 @@ module Synth {
|
||||
* Converts a synthesized `TItem` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertItemToRaw(TItem e) {
|
||||
result = convertConstToRaw(e)
|
||||
result = convertAdtToRaw(e)
|
||||
or
|
||||
result = convertEnumToRaw(e)
|
||||
result = convertConstToRaw(e)
|
||||
or
|
||||
result = convertExternBlockToRaw(e)
|
||||
or
|
||||
@@ -3835,16 +3839,12 @@ module Synth {
|
||||
or
|
||||
result = convertStaticToRaw(e)
|
||||
or
|
||||
result = convertStructToRaw(e)
|
||||
or
|
||||
result = convertTraitToRaw(e)
|
||||
or
|
||||
result = convertTraitAliasToRaw(e)
|
||||
or
|
||||
result = convertTypeAliasToRaw(e)
|
||||
or
|
||||
result = convertUnionToRaw(e)
|
||||
or
|
||||
result = convertUseToRaw(e)
|
||||
}
|
||||
|
||||
@@ -4039,16 +4039,4 @@ module Synth {
|
||||
or
|
||||
result = convertNameRefToRaw(e)
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
* Converts a synthesized `TVariantDef` to a raw DB element, if possible.
|
||||
*/
|
||||
Raw::Element convertVariantDefToRaw(TVariantDef e) {
|
||||
result = convertStructToRaw(e)
|
||||
or
|
||||
result = convertUnionToRaw(e)
|
||||
or
|
||||
result = convertVariantToRaw(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
|
||||
private import codeql.rust.elements.internal.generated.Synth
|
||||
private import codeql.rust.elements.internal.generated.Raw
|
||||
import codeql.rust.elements.internal.AdtImpl::Impl as AdtImpl
|
||||
import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.GenericParamList
|
||||
import codeql.rust.elements.internal.ItemImpl::Impl as ItemImpl
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.StructFieldList
|
||||
import codeql.rust.elements.internal.VariantDefImpl::Impl as VariantDefImpl
|
||||
import codeql.rust.elements.Visibility
|
||||
import codeql.rust.elements.WhereClause
|
||||
|
||||
@@ -30,7 +29,7 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::Union` class directly.
|
||||
* Use the subclass `Union`, where the following predicates are available.
|
||||
*/
|
||||
class Union extends Synth::TUnion, ItemImpl::Item, VariantDefImpl::VariantDef {
|
||||
class Union extends Synth::TUnion, AdtImpl::Adt {
|
||||
override string getAPrimaryQlClass() { result = "Union" }
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ import codeql.rust.elements.Attr
|
||||
import codeql.rust.elements.Expr
|
||||
import codeql.rust.elements.FieldList
|
||||
import codeql.rust.elements.Name
|
||||
import codeql.rust.elements.internal.VariantDefImpl::Impl as VariantDefImpl
|
||||
import codeql.rust.elements.Visibility
|
||||
|
||||
/**
|
||||
@@ -30,7 +29,7 @@ module Generated {
|
||||
* INTERNAL: Do not reference the `Generated::Variant` class directly.
|
||||
* Use the subclass `Variant`, where the following predicates are available.
|
||||
*/
|
||||
class Variant extends Synth::TVariant, VariantDefImpl::VariantDef, AddressableImpl::Addressable {
|
||||
class Variant extends Synth::TVariant, AddressableImpl::Addressable {
|
||||
override string getAPrimaryQlClass() { result = "Variant" }
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// generated by codegen, do not edit
|
||||
/**
|
||||
* This module provides the generated definition of `VariantDef`.
|
||||
* 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.internal.AstNodeImpl::Impl as AstNodeImpl
|
||||
|
||||
/**
|
||||
* INTERNAL: This module contains the fully generated definition of `VariantDef` and should not
|
||||
* be referenced directly.
|
||||
*/
|
||||
module Generated {
|
||||
/**
|
||||
* INTERNAL: Do not reference the `Generated::VariantDef` class directly.
|
||||
* Use the subclass `VariantDef`, where the following predicates are available.
|
||||
*/
|
||||
class VariantDef extends Synth::TVariantDef, AstNodeImpl::AstNode { }
|
||||
}
|
||||
@@ -215,7 +215,6 @@ named_crates(
|
||||
| @use_bound_generic_args
|
||||
| @use_tree
|
||||
| @use_tree_list
|
||||
| @variant_def
|
||||
| @variant_list
|
||||
| @visibility
|
||||
| @where_clause
|
||||
@@ -1161,12 +1160,6 @@ use_tree_list_use_trees(
|
||||
int use_tree: @use_tree ref
|
||||
);
|
||||
|
||||
@variant_def =
|
||||
@struct
|
||||
| @union
|
||||
| @variant
|
||||
;
|
||||
|
||||
variant_lists(
|
||||
unique int id: @variant_list
|
||||
);
|
||||
@@ -1917,8 +1910,8 @@ infer_type_reprs(
|
||||
);
|
||||
|
||||
@item =
|
||||
@const
|
||||
| @enum
|
||||
@adt
|
||||
| @const
|
||||
| @extern_block
|
||||
| @extern_crate
|
||||
| @function
|
||||
@@ -1928,11 +1921,9 @@ infer_type_reprs(
|
||||
| @macro_rules
|
||||
| @module
|
||||
| @static
|
||||
| @struct
|
||||
| @trait
|
||||
| @trait_alias
|
||||
| @type_alias
|
||||
| @union
|
||||
| @use
|
||||
;
|
||||
|
||||
@@ -2714,6 +2705,19 @@ yield_expr_exprs(
|
||||
int expr: @expr ref
|
||||
);
|
||||
|
||||
@adt =
|
||||
@enum
|
||||
| @struct
|
||||
| @union
|
||||
;
|
||||
|
||||
#keyset[id, index]
|
||||
adt_derive_macro_expansions(
|
||||
int id: @adt ref,
|
||||
int index: int ref,
|
||||
int derive_macro_expansion: @macro_items ref
|
||||
);
|
||||
|
||||
block_exprs(
|
||||
unique int id: @block_expr
|
||||
);
|
||||
@@ -2821,47 +2825,6 @@ const_has_implementation(
|
||||
int id: @const ref
|
||||
);
|
||||
|
||||
enums(
|
||||
unique int id: @enum
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
enum_attrs(
|
||||
int id: @enum ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_generic_param_lists(
|
||||
int id: @enum ref,
|
||||
int generic_param_list: @generic_param_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_names(
|
||||
int id: @enum ref,
|
||||
int name: @name ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_variant_lists(
|
||||
int id: @enum ref,
|
||||
int variant_list: @variant_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_visibilities(
|
||||
int id: @enum ref,
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_where_clauses(
|
||||
int id: @enum ref,
|
||||
int where_clause: @where_clause ref
|
||||
);
|
||||
|
||||
extern_blocks(
|
||||
unique int id: @extern_block
|
||||
);
|
||||
@@ -3278,47 +3241,6 @@ static_visibilities(
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
structs(
|
||||
unique int id: @struct
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
struct_attrs(
|
||||
int id: @struct ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_field_lists_(
|
||||
int id: @struct ref,
|
||||
int field_list: @field_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_generic_param_lists(
|
||||
int id: @struct ref,
|
||||
int generic_param_list: @generic_param_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_names(
|
||||
int id: @struct ref,
|
||||
int name: @name ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_visibilities(
|
||||
int id: @struct ref,
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_where_clauses(
|
||||
int id: @struct ref,
|
||||
int where_clause: @where_clause ref
|
||||
);
|
||||
|
||||
struct_exprs(
|
||||
unique int id: @struct_expr
|
||||
);
|
||||
@@ -3500,6 +3422,145 @@ type_alias_where_clauses(
|
||||
int where_clause: @where_clause ref
|
||||
);
|
||||
|
||||
uses(
|
||||
unique int id: @use
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
use_attrs(
|
||||
int id: @use ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
use_use_trees(
|
||||
int id: @use ref,
|
||||
int use_tree: @use_tree ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
use_visibilities(
|
||||
int id: @use ref,
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
enums(
|
||||
unique int id: @enum
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
enum_attrs(
|
||||
int id: @enum ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_generic_param_lists(
|
||||
int id: @enum ref,
|
||||
int generic_param_list: @generic_param_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_names(
|
||||
int id: @enum ref,
|
||||
int name: @name ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_variant_lists(
|
||||
int id: @enum ref,
|
||||
int variant_list: @variant_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_visibilities(
|
||||
int id: @enum ref,
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
enum_where_clauses(
|
||||
int id: @enum ref,
|
||||
int where_clause: @where_clause ref
|
||||
);
|
||||
|
||||
for_exprs(
|
||||
unique int id: @for_expr
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
for_expr_attrs(
|
||||
int id: @for_expr ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
for_expr_iterables(
|
||||
int id: @for_expr ref,
|
||||
int iterable: @expr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
for_expr_pats(
|
||||
int id: @for_expr ref,
|
||||
int pat: @pat ref
|
||||
);
|
||||
|
||||
loop_exprs(
|
||||
unique int id: @loop_expr
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
loop_expr_attrs(
|
||||
int id: @loop_expr ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
structs(
|
||||
unique int id: @struct
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
struct_attrs(
|
||||
int id: @struct ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_field_lists_(
|
||||
int id: @struct ref,
|
||||
int field_list: @field_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_generic_param_lists(
|
||||
int id: @struct ref,
|
||||
int generic_param_list: @generic_param_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_names(
|
||||
int id: @struct ref,
|
||||
int name: @name ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_visibilities(
|
||||
int id: @struct ref,
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
struct_where_clauses(
|
||||
int id: @struct ref,
|
||||
int where_clause: @where_clause ref
|
||||
);
|
||||
|
||||
unions(
|
||||
unique int id: @union
|
||||
);
|
||||
@@ -3541,63 +3602,6 @@ union_where_clauses(
|
||||
int where_clause: @where_clause ref
|
||||
);
|
||||
|
||||
uses(
|
||||
unique int id: @use
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
use_attrs(
|
||||
int id: @use ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
use_use_trees(
|
||||
int id: @use ref,
|
||||
int use_tree: @use_tree ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
use_visibilities(
|
||||
int id: @use ref,
|
||||
int visibility: @visibility ref
|
||||
);
|
||||
|
||||
for_exprs(
|
||||
unique int id: @for_expr
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
for_expr_attrs(
|
||||
int id: @for_expr ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
for_expr_iterables(
|
||||
int id: @for_expr ref,
|
||||
int iterable: @expr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
for_expr_pats(
|
||||
int id: @for_expr ref,
|
||||
int pat: @pat ref
|
||||
);
|
||||
|
||||
loop_exprs(
|
||||
unique int id: @loop_expr
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
loop_expr_attrs(
|
||||
int id: @loop_expr ref,
|
||||
int index: int ref,
|
||||
int attr: @attr ref
|
||||
);
|
||||
|
||||
while_exprs(
|
||||
unique int id: @while_expr
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
description: Add `adt_derive_macro_expansions`
|
||||
compatibility: backwards
|
||||
@@ -5,6 +5,9 @@ canonicalPath
|
||||
| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
|
||||
| lib.rs:2:1:2:12 | mod regular | test::regular |
|
||||
| regular.rs:1:1:2:18 | struct Struct | test::regular::Struct |
|
||||
| regular.rs:2:12:2:17 | fn eq | <test::regular::Struct as core::cmp::PartialEq>::eq |
|
||||
| regular.rs:2:12:2:17 | impl ...::Eq for Struct::<...> { ... } | <test::regular::Struct as core::cmp::Eq> |
|
||||
| regular.rs:2:12:2:17 | impl ...::PartialEq for Struct::<...> { ... } | <test::regular::Struct as core::cmp::PartialEq> |
|
||||
| regular.rs:4:1:6:1 | trait Trait | test::regular::Trait |
|
||||
| regular.rs:5:5:5:16 | fn f | <_ as test::regular::Trait>::f |
|
||||
| regular.rs:8:1:10:1 | impl Trait for Struct { ... } | <test::regular::Struct as test::regular::Trait> |
|
||||
@@ -42,6 +45,9 @@ canonicalPaths
|
||||
| lib.rs:1:1:1:14 | mod anonymous | repo::test | crate::anonymous |
|
||||
| lib.rs:2:1:2:12 | mod regular | repo::test | crate::regular |
|
||||
| regular.rs:1:1:2:18 | struct Struct | repo::test | crate::regular::Struct |
|
||||
| regular.rs:2:12:2:17 | fn eq | repo::test | <crate::regular::Struct as crate::cmp::PartialEq>::eq |
|
||||
| regular.rs:2:12:2:17 | impl ...::Eq for Struct::<...> { ... } | None | None |
|
||||
| regular.rs:2:12:2:17 | impl ...::PartialEq for Struct::<...> { ... } | None | None |
|
||||
| regular.rs:4:1:6:1 | trait Trait | repo::test | crate::regular::Trait |
|
||||
| regular.rs:5:5:5:16 | fn f | repo::test | crate::regular::Trait::f |
|
||||
| regular.rs:8:1:10:1 | impl Trait for Struct { ... } | None | None |
|
||||
@@ -66,6 +72,8 @@ resolvedPaths
|
||||
| anonymous.rs:29:9:29:9 | s | None | None |
|
||||
| anonymous.rs:29:9:29:13 | s.g() | None | None |
|
||||
| anonymous.rs:30:9:30:14 | nested | None | None |
|
||||
| regular.rs:1:1:1:24 | other | None | None |
|
||||
| regular.rs:1:1:1:24 | self | None | None |
|
||||
| regular.rs:27:13:27:21 | Struct {...} | repo::test | crate::regular::Struct |
|
||||
| regular.rs:28:5:28:5 | s | None | None |
|
||||
| regular.rs:28:5:28:9 | s.f() | repo::test | <crate::regular::Struct as crate::regular::Trait>::f |
|
||||
|
||||
@@ -5,6 +5,9 @@ canonicalPath
|
||||
| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
|
||||
| lib.rs:2:1:2:12 | mod regular | test::regular |
|
||||
| regular.rs:4:1:5:18 | struct Struct | test::regular::Struct |
|
||||
| regular.rs:5:12:5:17 | fn eq | <test::regular::Struct as core::cmp::PartialEq>::eq |
|
||||
| regular.rs:5:12:5:17 | impl ...::Eq for Struct::<...> { ... } | <test::regular::Struct as core::cmp::Eq> |
|
||||
| regular.rs:5:12:5:17 | impl ...::PartialEq for Struct::<...> { ... } | <test::regular::Struct as core::cmp::PartialEq> |
|
||||
| regular.rs:7:1:9:1 | trait Trait | test::regular::Trait |
|
||||
| regular.rs:8:5:8:16 | fn f | <_ as test::regular::Trait>::f |
|
||||
| regular.rs:11:1:13:1 | impl Trait for Struct { ... } | <test::regular::Struct as test::regular::Trait> |
|
||||
@@ -42,6 +45,9 @@ canonicalPaths
|
||||
| lib.rs:1:1:1:14 | mod anonymous | None | None |
|
||||
| lib.rs:2:1:2:12 | mod regular | None | None |
|
||||
| regular.rs:4:1:5:18 | struct Struct | None | None |
|
||||
| regular.rs:5:12:5:17 | fn eq | None | None |
|
||||
| regular.rs:5:12:5:17 | impl ...::Eq for Struct::<...> { ... } | None | None |
|
||||
| regular.rs:5:12:5:17 | impl ...::PartialEq for Struct::<...> { ... } | None | None |
|
||||
| regular.rs:7:1:9:1 | trait Trait | None | None |
|
||||
| regular.rs:8:5:8:16 | fn f | None | None |
|
||||
| regular.rs:11:1:13:1 | impl Trait for Struct { ... } | None | None |
|
||||
@@ -66,6 +72,8 @@ resolvedPaths
|
||||
| anonymous.rs:32:9:32:9 | s | None | None |
|
||||
| anonymous.rs:32:9:32:13 | s.g() | None | None |
|
||||
| anonymous.rs:33:9:33:14 | nested | None | None |
|
||||
| regular.rs:4:1:4:24 | other | None | None |
|
||||
| regular.rs:4:1:4:24 | self | None | None |
|
||||
| regular.rs:30:13:30:21 | Struct {...} | None | None |
|
||||
| regular.rs:31:5:31:5 | s | None | None |
|
||||
| regular.rs:31:5:31:9 | s.f() | None | None |
|
||||
|
||||
7
rust/ql/test/extractor-tests/generated/Enum/Cargo.lock
generated
Normal file
7
rust/ql/test/extractor-tests/generated/Enum/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "test"
|
||||
version = "0.0.1"
|
||||
@@ -1 +1 @@
|
||||
| gen_enum.rs:4:5:7:34 | enum E | hasExtendedCanonicalPath: | no | hasCrateOrigin: | no | hasAttributeMacroExpansion: | no | getNumberOfAttrs: | 0 | hasGenericParamList: | no | hasName: | yes | hasVariantList: | yes | hasVisibility: | no | hasWhereClause: | no |
|
||||
| gen_enum.rs:4:5:7:34 | enum E | hasExtendedCanonicalPath: | no | hasCrateOrigin: | no | hasAttributeMacroExpansion: | no | getNumberOfDeriveMacroExpansions: | 0 | getNumberOfAttrs: | 0 | hasGenericParamList: | no | hasName: | yes | hasVariantList: | yes | hasVisibility: | no | hasWhereClause: | no |
|
||||
|
||||
12
rust/ql/test/extractor-tests/generated/Enum/Enum.ql
generated
12
rust/ql/test/extractor-tests/generated/Enum/Enum.ql
generated
@@ -4,8 +4,8 @@ import TestUtils
|
||||
|
||||
from
|
||||
Enum x, string hasExtendedCanonicalPath, string hasCrateOrigin, string hasAttributeMacroExpansion,
|
||||
int getNumberOfAttrs, string hasGenericParamList, string hasName, string hasVariantList,
|
||||
string hasVisibility, string hasWhereClause
|
||||
int getNumberOfDeriveMacroExpansions, int getNumberOfAttrs, string hasGenericParamList,
|
||||
string hasName, string hasVariantList, string hasVisibility, string hasWhereClause
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -20,6 +20,7 @@ where
|
||||
then hasAttributeMacroExpansion = "yes"
|
||||
else hasAttributeMacroExpansion = "no"
|
||||
) and
|
||||
getNumberOfDeriveMacroExpansions = x.getNumberOfDeriveMacroExpansions() and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
(if x.hasGenericParamList() then hasGenericParamList = "yes" else hasGenericParamList = "no") and
|
||||
(if x.hasName() then hasName = "yes" else hasName = "no") and
|
||||
@@ -27,6 +28,7 @@ where
|
||||
(if x.hasVisibility() then hasVisibility = "yes" else hasVisibility = "no") and
|
||||
if x.hasWhereClause() then hasWhereClause = "yes" else hasWhereClause = "no"
|
||||
select x, "hasExtendedCanonicalPath:", hasExtendedCanonicalPath, "hasCrateOrigin:", hasCrateOrigin,
|
||||
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfAttrs:", getNumberOfAttrs,
|
||||
"hasGenericParamList:", hasGenericParamList, "hasName:", hasName, "hasVariantList:",
|
||||
hasVariantList, "hasVisibility:", hasVisibility, "hasWhereClause:", hasWhereClause
|
||||
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfDeriveMacroExpansions:",
|
||||
getNumberOfDeriveMacroExpansions, "getNumberOfAttrs:", getNumberOfAttrs, "hasGenericParamList:",
|
||||
hasGenericParamList, "hasName:", hasName, "hasVariantList:", hasVariantList, "hasVisibility:",
|
||||
hasVisibility, "hasWhereClause:", hasWhereClause
|
||||
|
||||
7
rust/ql/test/extractor-tests/generated/Enum/Enum_getDeriveMacroExpansion.ql
generated
Normal file
7
rust/ql/test/extractor-tests/generated/Enum/Enum_getDeriveMacroExpansion.ql
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
// generated by codegen, do not edit
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from Enum x, int index
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, index, x.getDeriveMacroExpansion(index)
|
||||
@@ -1 +1,2 @@
|
||||
| gen_macro_items.rs:5:5:5:38 | MacroItems | getNumberOfItems: | 2 |
|
||||
| gen_macro_items.rs:13:12:13:14 | MacroItems | getNumberOfItems: | 1 |
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
| gen_macro_items.rs:5:5:5:38 | MacroItems | 0 | gen_macro_items.rs:5:5:5:38 | use ...::Path |
|
||||
| gen_macro_items.rs:5:5:5:38 | MacroItems | 1 | gen_macro_items.rs:5:5:5:38 | fn get_parent |
|
||||
| gen_macro_items.rs:13:12:13:14 | MacroItems | 0 | gen_macro_items.rs:13:12:13:14 | impl ...::Debug for Bar::<...> { ... } |
|
||||
|
||||
7
rust/ql/test/extractor-tests/generated/Struct/Cargo.lock
generated
Normal file
7
rust/ql/test/extractor-tests/generated/Struct/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "test"
|
||||
version = "0.0.1"
|
||||
@@ -1 +1 @@
|
||||
| gen_struct.rs:4:5:8:5 | struct Point | hasExtendedCanonicalPath: | no | hasCrateOrigin: | no | hasAttributeMacroExpansion: | no | getNumberOfAttrs: | 0 | hasFieldList: | yes | hasGenericParamList: | no | hasName: | yes | hasVisibility: | no | hasWhereClause: | no |
|
||||
| gen_struct.rs:4:5:8:5 | struct Point | hasExtendedCanonicalPath: | no | hasCrateOrigin: | no | hasAttributeMacroExpansion: | no | getNumberOfDeriveMacroExpansions: | 0 | getNumberOfAttrs: | 0 | hasFieldList: | yes | hasGenericParamList: | no | hasName: | yes | hasVisibility: | no | hasWhereClause: | no |
|
||||
|
||||
@@ -4,8 +4,9 @@ import TestUtils
|
||||
|
||||
from
|
||||
Struct x, string hasExtendedCanonicalPath, string hasCrateOrigin,
|
||||
string hasAttributeMacroExpansion, int getNumberOfAttrs, string hasFieldList,
|
||||
string hasGenericParamList, string hasName, string hasVisibility, string hasWhereClause
|
||||
string hasAttributeMacroExpansion, int getNumberOfDeriveMacroExpansions, int getNumberOfAttrs,
|
||||
string hasFieldList, string hasGenericParamList, string hasName, string hasVisibility,
|
||||
string hasWhereClause
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -20,6 +21,7 @@ where
|
||||
then hasAttributeMacroExpansion = "yes"
|
||||
else hasAttributeMacroExpansion = "no"
|
||||
) and
|
||||
getNumberOfDeriveMacroExpansions = x.getNumberOfDeriveMacroExpansions() and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
(if x.hasFieldList() then hasFieldList = "yes" else hasFieldList = "no") and
|
||||
(if x.hasGenericParamList() then hasGenericParamList = "yes" else hasGenericParamList = "no") and
|
||||
@@ -27,6 +29,7 @@ where
|
||||
(if x.hasVisibility() then hasVisibility = "yes" else hasVisibility = "no") and
|
||||
if x.hasWhereClause() then hasWhereClause = "yes" else hasWhereClause = "no"
|
||||
select x, "hasExtendedCanonicalPath:", hasExtendedCanonicalPath, "hasCrateOrigin:", hasCrateOrigin,
|
||||
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfAttrs:", getNumberOfAttrs,
|
||||
"hasFieldList:", hasFieldList, "hasGenericParamList:", hasGenericParamList, "hasName:", hasName,
|
||||
"hasVisibility:", hasVisibility, "hasWhereClause:", hasWhereClause
|
||||
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfDeriveMacroExpansions:",
|
||||
getNumberOfDeriveMacroExpansions, "getNumberOfAttrs:", getNumberOfAttrs, "hasFieldList:",
|
||||
hasFieldList, "hasGenericParamList:", hasGenericParamList, "hasName:", hasName, "hasVisibility:",
|
||||
hasVisibility, "hasWhereClause:", hasWhereClause
|
||||
|
||||
7
rust/ql/test/extractor-tests/generated/Struct/Struct_getDeriveMacroExpansion.ql
generated
Normal file
7
rust/ql/test/extractor-tests/generated/Struct/Struct_getDeriveMacroExpansion.ql
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
// generated by codegen, do not edit
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from Struct x, int index
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, index, x.getDeriveMacroExpansion(index)
|
||||
7
rust/ql/test/extractor-tests/generated/Union/Cargo.lock
generated
Normal file
7
rust/ql/test/extractor-tests/generated/Union/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "test"
|
||||
version = "0.0.1"
|
||||
@@ -1 +1 @@
|
||||
| gen_union.rs:4:5:7:32 | union U | hasExtendedCanonicalPath: | no | hasCrateOrigin: | no | hasAttributeMacroExpansion: | no | getNumberOfAttrs: | 0 | hasGenericParamList: | no | hasName: | yes | hasStructFieldList: | yes | hasVisibility: | no | hasWhereClause: | no |
|
||||
| gen_union.rs:4:5:7:32 | union U | hasExtendedCanonicalPath: | no | hasCrateOrigin: | no | hasAttributeMacroExpansion: | no | getNumberOfDeriveMacroExpansions: | 0 | getNumberOfAttrs: | 0 | hasGenericParamList: | no | hasName: | yes | hasStructFieldList: | yes | hasVisibility: | no | hasWhereClause: | no |
|
||||
|
||||
@@ -4,8 +4,9 @@ import TestUtils
|
||||
|
||||
from
|
||||
Union x, string hasExtendedCanonicalPath, string hasCrateOrigin,
|
||||
string hasAttributeMacroExpansion, int getNumberOfAttrs, string hasGenericParamList,
|
||||
string hasName, string hasStructFieldList, string hasVisibility, string hasWhereClause
|
||||
string hasAttributeMacroExpansion, int getNumberOfDeriveMacroExpansions, int getNumberOfAttrs,
|
||||
string hasGenericParamList, string hasName, string hasStructFieldList, string hasVisibility,
|
||||
string hasWhereClause
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -20,6 +21,7 @@ where
|
||||
then hasAttributeMacroExpansion = "yes"
|
||||
else hasAttributeMacroExpansion = "no"
|
||||
) and
|
||||
getNumberOfDeriveMacroExpansions = x.getNumberOfDeriveMacroExpansions() and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
(if x.hasGenericParamList() then hasGenericParamList = "yes" else hasGenericParamList = "no") and
|
||||
(if x.hasName() then hasName = "yes" else hasName = "no") and
|
||||
@@ -27,6 +29,7 @@ where
|
||||
(if x.hasVisibility() then hasVisibility = "yes" else hasVisibility = "no") and
|
||||
if x.hasWhereClause() then hasWhereClause = "yes" else hasWhereClause = "no"
|
||||
select x, "hasExtendedCanonicalPath:", hasExtendedCanonicalPath, "hasCrateOrigin:", hasCrateOrigin,
|
||||
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfAttrs:", getNumberOfAttrs,
|
||||
"hasGenericParamList:", hasGenericParamList, "hasName:", hasName, "hasStructFieldList:",
|
||||
hasStructFieldList, "hasVisibility:", hasVisibility, "hasWhereClause:", hasWhereClause
|
||||
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfDeriveMacroExpansions:",
|
||||
getNumberOfDeriveMacroExpansions, "getNumberOfAttrs:", getNumberOfAttrs, "hasGenericParamList:",
|
||||
hasGenericParamList, "hasName:", hasName, "hasStructFieldList:", hasStructFieldList,
|
||||
"hasVisibility:", hasVisibility, "hasWhereClause:", hasWhereClause
|
||||
|
||||
7
rust/ql/test/extractor-tests/generated/Union/Union_getDeriveMacroExpansion.ql
generated
Normal file
7
rust/ql/test/extractor-tests/generated/Union/Union_getDeriveMacroExpansion.ql
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
// generated by codegen, do not edit
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from Union x, int index
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, index, x.getDeriveMacroExpansion(index)
|
||||
@@ -0,0 +1,2 @@
|
||||
illFormedTypeMention
|
||||
| macro_expansion.rs:99:7:99:19 | MyDeriveUnion |
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
use proc_macro::{repeat, add_one, erase};
|
||||
use proc_macro::{repeat, add_one, erase, MyTrait};
|
||||
|
||||
#[add_one]
|
||||
pub fn foo() {
|
||||
@@ -78,3 +78,25 @@ type MyInt = my_int!(); // this didn't expand in 0.0.274..0.0.287
|
||||
struct MyStruct {
|
||||
field: my_int!(), // this didn't expand in 0.0.274..0.0.287
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
struct MyDerive {
|
||||
field: usize,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
enum MyDeriveEnum {
|
||||
Variant1,
|
||||
Variant2,
|
||||
}
|
||||
|
||||
trait MyTrait {
|
||||
fn my_method() -> u32;
|
||||
}
|
||||
|
||||
#[derive(MyTrait)]
|
||||
union MyDeriveUnion {
|
||||
field1: usize,
|
||||
field2: f64,
|
||||
}
|
||||
@@ -32,3 +32,20 @@ pub fn add_one(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
pub fn erase(_attr: TokenStream, _item: TokenStream) -> TokenStream {
|
||||
TokenStream::new()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(MyTrait)]
|
||||
pub fn my_trait_derive(input: TokenStream) -> TokenStream {
|
||||
let ast = syn::parse_macro_input!(input as syn::DeriveInput);
|
||||
let name = &ast.ident;
|
||||
let const_ident = syn::Ident::new(&format!("CONST_{}", name), name.span());
|
||||
quote! {
|
||||
const #const_ident: u32 = 42;
|
||||
|
||||
impl MyTrait for #name {
|
||||
fn my_method() -> u32 {
|
||||
#const_ident
|
||||
}
|
||||
}
|
||||
}.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,12 @@ attribute_macros
|
||||
| macro_expansion.rs:31:5:34:5 | fn bzz | 0 | macro_expansion.rs:32:5:33:17 | fn bzz_0 |
|
||||
| macro_expansion.rs:31:5:34:5 | fn bzz | 1 | macro_expansion.rs:32:5:33:17 | fn bzz_1 |
|
||||
| macro_expansion.rs:31:5:34:5 | fn bzz | 2 | macro_expansion.rs:32:5:33:17 | fn bzz_2 |
|
||||
derive_macros
|
||||
| macro_expansion.rs:83:1:86:1 | struct MyDerive | 0 | 0 | macro_expansion.rs:84:8:85:9 | impl ...::Debug for MyDerive::<...> { ... } |
|
||||
| macro_expansion.rs:88:1:92:1 | enum MyDeriveEnum | 0 | 0 | macro_expansion.rs:89:6:91:12 | impl ...::PartialEq for MyDeriveEnum::<...> { ... } |
|
||||
| macro_expansion.rs:88:1:92:1 | enum MyDeriveEnum | 1 | 0 | macro_expansion.rs:89:6:89:17 | impl ...::Eq for MyDeriveEnum::<...> { ... } |
|
||||
| macro_expansion.rs:98:1:102:1 | union MyDeriveUnion | 0 | 0 | macro_expansion.rs:99:7:99:19 | Const |
|
||||
| macro_expansion.rs:98:1:102:1 | union MyDeriveUnion | 0 | 1 | macro_expansion.rs:99:7:99:19 | impl MyTrait for MyDeriveUnion { ... } |
|
||||
macro_calls
|
||||
| included/included.rs:2:9:2:39 | concat!... | included/included.rs:2:17:2:38 | "Hello world!" |
|
||||
| macro_expansion.rs:5:9:5:34 | concat!... | macro_expansion.rs:5:17:5:34 | "Hello world!" |
|
||||
|
||||
@@ -5,6 +5,10 @@ query predicate attribute_macros(Item i, int index, Item expanded) {
|
||||
i.fromSource() and expanded = i.getAttributeMacroExpansion().getItem(index)
|
||||
}
|
||||
|
||||
query predicate derive_macros(Adt i, int index, int subIndex, Item expanded) {
|
||||
i.fromSource() and expanded = i.getDeriveMacroExpansion(index).getItem(subIndex)
|
||||
}
|
||||
|
||||
query predicate macro_calls(MacroCall c, AstNode expansion) {
|
||||
c.fromSource() and
|
||||
not c.getLocation().getFile().getAbsolutePath().matches("%proc_macro.rs") and
|
||||
|
||||
@@ -86,6 +86,10 @@ multiplePathResolutions
|
||||
| test_futures_io.rs:25:23:25:61 | ...::try_from | file://:0:0:0:0 | fn try_from |
|
||||
| test_futures_io.rs:145:26:145:43 | ...::with_capacity | file://:0:0:0:0 | fn with_capacity |
|
||||
| test_futures_io.rs:145:26:145:43 | ...::with_capacity | file://:0:0:0:0 | fn with_capacity |
|
||||
| web_frameworks.rs:40:5:40:26 | ...::write_str | file://:0:0:0:0 | fn write_str |
|
||||
| web_frameworks.rs:40:5:40:26 | ...::write_str | file://:0:0:0:0 | fn write_str |
|
||||
| web_frameworks.rs:40:5:40:26 | ...::write_str | file://:0:0:0:0 | fn write_str |
|
||||
| web_frameworks.rs:40:5:40:26 | ...::write_str | file://:0:0:0:0 | fn write_str |
|
||||
multipleCanonicalPaths
|
||||
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Equal as core::cmp::Ord>::to_ordering |
|
||||
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Equal as typenum::marker_traits::Ord>::to_ordering |
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -503,7 +503,7 @@ fn phi_read(b1 : bool, b2 : bool) {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
struct MyStruct {
|
||||
val: i64,
|
||||
}
|
||||
|
||||
@@ -16,6 +16,14 @@ class LoopingExpr(LabelableExpr):
|
||||
loop_body: optional["BlockExpr"] | child
|
||||
|
||||
|
||||
@annotate(Adt, replace_bases={AstNode: Item})
|
||||
class _:
|
||||
"""
|
||||
An ADT (Abstract Data Type) definition, such as `Struct`, `Enum`, or `Union`.
|
||||
"""
|
||||
derive_macro_expansions: list[MacroItems] | child | rust.detach
|
||||
|
||||
|
||||
@annotate(Module)
|
||||
@rust.doc_test_signature(None)
|
||||
class _:
|
||||
@@ -1032,7 +1040,7 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(Enum)
|
||||
@annotate(Enum, replace_bases={Item: None}) # still an Item via Adt
|
||||
class _:
|
||||
"""
|
||||
An enum declaration.
|
||||
@@ -1827,7 +1835,7 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(Struct)
|
||||
@annotate(Struct, replace_bases={Item: None}) # still an Item via Adt
|
||||
class _:
|
||||
"""
|
||||
A Struct. For example:
|
||||
@@ -2006,7 +2014,7 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(Union)
|
||||
@annotate(Union, replace_bases={Item: None}) # still an Item via Adt
|
||||
class _:
|
||||
"""
|
||||
A union declaration.
|
||||
@@ -2054,7 +2062,7 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(Variant, add_bases=(Addressable,))
|
||||
@annotate(Variant, replace_bases={AstNode: Addressable})
|
||||
class _:
|
||||
"""
|
||||
A variant in an enum declaration.
|
||||
|
||||
14
rust/schema/ast.py
generated
14
rust/schema/ast.py
generated
@@ -2,6 +2,9 @@
|
||||
|
||||
from .prelude import *
|
||||
|
||||
class Adt(AstNode, ):
|
||||
pass
|
||||
|
||||
class AsmOperand(AstNode, ):
|
||||
pass
|
||||
|
||||
@@ -38,9 +41,6 @@ class TypeRepr(AstNode, ):
|
||||
class UseBoundGenericArg(AstNode, ):
|
||||
pass
|
||||
|
||||
class VariantDef(AstNode, ):
|
||||
pass
|
||||
|
||||
class Item(Stmt, ):
|
||||
pass
|
||||
|
||||
@@ -207,7 +207,7 @@ class ContinueExpr(Expr, ):
|
||||
class DynTraitTypeRepr(TypeRepr, ):
|
||||
type_bound_list: optional["TypeBoundList"] | child
|
||||
|
||||
class Enum(Item, ):
|
||||
class Enum(Adt, Item, ):
|
||||
attrs: list["Attr"] | child
|
||||
generic_param_list: optional["GenericParamList"] | child
|
||||
name: optional["Name"] | child
|
||||
@@ -625,7 +625,7 @@ class StmtList(AstNode, ):
|
||||
statements: list["Stmt"] | child
|
||||
tail_expr: optional["Expr"] | child
|
||||
|
||||
class Struct(Item, VariantDef, ):
|
||||
class Struct(Adt, Item, ):
|
||||
attrs: list["Attr"] | child
|
||||
field_list: optional["FieldList"] | child
|
||||
generic_param_list: optional["GenericParamList"] | child
|
||||
@@ -713,7 +713,7 @@ class TypeParam(GenericParam, ):
|
||||
class UnderscoreExpr(Expr, ):
|
||||
attrs: list["Attr"] | child
|
||||
|
||||
class Union(Item, VariantDef, ):
|
||||
class Union(Adt, Item, ):
|
||||
attrs: list["Attr"] | child
|
||||
generic_param_list: optional["GenericParamList"] | child
|
||||
name: optional["Name"] | child
|
||||
@@ -738,7 +738,7 @@ class UseTree(AstNode, ):
|
||||
class UseTreeList(AstNode, ):
|
||||
use_trees: list["UseTree"] | child
|
||||
|
||||
class Variant(VariantDef, ):
|
||||
class Variant(AstNode, ):
|
||||
attrs: list["Attr"] | child
|
||||
discriminant: optional["Expr"] | child
|
||||
field_list: optional["FieldList"] | child
|
||||
|
||||
Reference in New Issue
Block a user