From 925fac2a6c2a93fa9d9c4f0e5996b56c76c8fcb5 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 11 Dec 2024 15:39:14 +0100 Subject: [PATCH] Rust: split `ImplItemCanonicalPath` for trait and type impls --- rust/extractor/src/generated/.generated.list | 2 +- rust/extractor/src/generated/mod.rs | 149 ++++++++++++------ rust/extractor/src/translate/base.rs | 43 +++-- rust/extractor/src/translate/label_cache.rs | 14 +- rust/extractor/src/translate/mappings.rs | 12 +- rust/ql/.generated.list | 19 ++- rust/ql/.gitattributes | 9 +- rust/ql/lib/codeql/rust/elements.qll | 3 +- .../canonical_paths/ImplItemCanonicalPath.qll | 14 -- .../TraitImplItemCanonicalPath.qll | 14 ++ .../TypeImplItemCanonicalPath.qll | 13 ++ .../internal/ImplItemCanonicalPathImpl.qll | 30 ---- .../TraitImplItemCanonicalPathConstructor.qll | 14 ++ .../TraitImplItemCanonicalPathImpl.qll | 25 +++ ... TypeImplItemCanonicalPathConstructor.qll} | 6 +- .../TypeImplItemCanonicalPathImpl.qll | 23 +++ .../internal/generated/ParentChild.qll | 54 ++++--- .../rust/elements/internal/generated/Raw.qll | 64 +++++--- .../elements/internal/generated/Synth.qll | 81 +++++++--- .../internal/generated/SynthConstructors.qll | 3 +- .../canonical_paths/ImplItemCanonicalPath.qll | 60 ------- .../TraitImplItemCanonicalPath.qll | 58 +++++++ .../TypeImplItemCanonicalPath.qll | 47 ++++++ rust/ql/lib/rust.dbscheme | 30 ++-- rust/schema/prelude.py | 15 +- 25 files changed, 529 insertions(+), 273 deletions(-) delete mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/ImplItemCanonicalPath.qll create mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/TraitImplItemCanonicalPath.qll create mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/TypeImplItemCanonicalPath.qll delete mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathImpl.qll create mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathConstructor.qll create mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathImpl.qll rename rust/ql/lib/codeql/rust/elements/canonical_paths/internal/{ImplItemCanonicalPathConstructor.qll => TypeImplItemCanonicalPathConstructor.qll} (55%) create mode 100644 rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathImpl.qll delete mode 100644 rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/ImplItemCanonicalPath.qll create mode 100644 rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TraitImplItemCanonicalPath.qll create mode 100644 rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TypeImplItemCanonicalPath.qll diff --git a/rust/extractor/src/generated/.generated.list b/rust/extractor/src/generated/.generated.list index 18f343101db..8dca71c7af9 100644 --- a/rust/extractor/src/generated/.generated.list +++ b/rust/extractor/src/generated/.generated.list @@ -1 +1 @@ -mod.rs f80e3ee6008c0742d684de1fd89195710970b455dd2b5aedde5c895409e97ee4 f80e3ee6008c0742d684de1fd89195710970b455dd2b5aedde5c895409e97ee4 +mod.rs 19a788ebd1fb0ecd3bb612d29320aefd66b11aea63e85c27884d27b5e01d68b9 19a788ebd1fb0ecd3bb612d29320aefd66b11aea63e85c27884d27b5e01d68b9 diff --git a/rust/extractor/src/generated/mod.rs b/rust/extractor/src/generated/mod.rs index 48e2c1f35ff..523845bf57b 100644 --- a/rust/extractor/src/generated/mod.rs +++ b/rust/extractor/src/generated/mod.rs @@ -10751,58 +10751,6 @@ impl From> for trap::Label { } } -#[derive(Debug)] -pub struct ImplItemCanonicalPath { - pub id: trap::TrapId, - pub type_path: trap::Label, - pub trait_path: Option>, - pub name: String, -} - -impl trap::TrapEntry for ImplItemCanonicalPath { - fn extract_id(&mut self) -> trap::TrapId { - std::mem::replace(&mut self.id, trap::TrapId::Star) - } - - fn emit(self, id: trap::Label, out: &mut trap::Writer) { - out.add_tuple("impl_item_canonical_paths", vec![id.into(), self.type_path.into(), self.name.into()]); - if let Some(v) = self.trait_path { - out.add_tuple("impl_item_canonical_path_trait_paths", vec![id.into(), v.into()]); - } - } -} - -impl trap::TrapClass for ImplItemCanonicalPath { - fn class_name() -> &'static str { "ImplItemCanonicalPath" } -} - -impl From> for trap::Label { - fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ImplItemCanonicalPath is a subclass of CanonicalPath - unsafe { - Self::from_untyped(value.as_untyped()) - } - } -} - -impl From> for trap::Label { - fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ImplItemCanonicalPath is a subclass of CanonicalPathElement - unsafe { - Self::from_untyped(value.as_untyped()) - } - } -} - -impl From> for trap::Label { - fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ImplItemCanonicalPath is a subclass of Element - unsafe { - Self::from_untyped(value.as_untyped()) - } - } -} - #[derive(Debug)] pub struct LangCrateRoot { pub id: trap::TrapId, @@ -11099,6 +11047,55 @@ impl From> for trap::Label { } } +#[derive(Debug)] +pub struct TraitImplItemCanonicalPath { + pub id: trap::TrapId, + pub type_path: trap::Label, + pub trait_path: trap::Label, + pub name: String, +} + +impl trap::TrapEntry for TraitImplItemCanonicalPath { + fn extract_id(&mut self) -> trap::TrapId { + std::mem::replace(&mut self.id, trap::TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("trait_impl_item_canonical_paths", vec![id.into(), self.type_path.into(), self.trait_path.into(), self.name.into()]); + } +} + +impl trap::TrapClass for TraitImplItemCanonicalPath { + fn class_name() -> &'static str { "TraitImplItemCanonicalPath" } +} + +impl From> for trap::Label { + fn from(value: trap::Label) -> Self { + // SAFETY: this is safe because in the dbscheme TraitImplItemCanonicalPath is a subclass of CanonicalPath + unsafe { + Self::from_untyped(value.as_untyped()) + } + } +} + +impl From> for trap::Label { + fn from(value: trap::Label) -> Self { + // SAFETY: this is safe because in the dbscheme TraitImplItemCanonicalPath is a subclass of CanonicalPathElement + unsafe { + Self::from_untyped(value.as_untyped()) + } + } +} + +impl From> for trap::Label { + fn from(value: trap::Label) -> Self { + // SAFETY: this is safe because in the dbscheme TraitImplItemCanonicalPath is a subclass of Element + unsafe { + Self::from_untyped(value.as_untyped()) + } + } +} + #[derive(Debug)] pub struct TypeCanonicalPath { _unused: () @@ -11182,6 +11179,54 @@ impl From> for trap::Label { } } +#[derive(Debug)] +pub struct TypeImplItemCanonicalPath { + pub id: trap::TrapId, + pub parent: trap::Label, + pub name: String, +} + +impl trap::TrapEntry for TypeImplItemCanonicalPath { + fn extract_id(&mut self) -> trap::TrapId { + std::mem::replace(&mut self.id, trap::TrapId::Star) + } + + fn emit(self, id: trap::Label, out: &mut trap::Writer) { + out.add_tuple("type_impl_item_canonical_paths", vec![id.into(), self.parent.into(), self.name.into()]); + } +} + +impl trap::TrapClass for TypeImplItemCanonicalPath { + fn class_name() -> &'static str { "TypeImplItemCanonicalPath" } +} + +impl From> for trap::Label { + fn from(value: trap::Label) -> Self { + // SAFETY: this is safe because in the dbscheme TypeImplItemCanonicalPath is a subclass of CanonicalPath + unsafe { + Self::from_untyped(value.as_untyped()) + } + } +} + +impl From> for trap::Label { + fn from(value: trap::Label) -> Self { + // SAFETY: this is safe because in the dbscheme TypeImplItemCanonicalPath is a subclass of CanonicalPathElement + unsafe { + Self::from_untyped(value.as_untyped()) + } + } +} + +impl From> for trap::Label { + fn from(value: trap::Label) -> Self { + // SAFETY: this is safe because in the dbscheme TypeImplItemCanonicalPath is a subclass of Element + unsafe { + Self::from_untyped(value.as_untyped()) + } + } +} + #[derive(Debug)] pub struct TypeItemCanonicalPath { pub id: trap::TrapId, diff --git a/rust/extractor/src/translate/base.rs b/rust/extractor/src/translate/base.rs index b0223a157b2..9c3a84c4d83 100644 --- a/rust/extractor/src/translate/base.rs +++ b/rust/extractor/src/translate/base.rs @@ -643,19 +643,36 @@ impl<'a> Translator<'a> { ) } ItemContainer::Impl(it) => { - let trait_ref = it.trait_ref(sema.db); - let type_path = self.canonical_path_from_type(it.self_ty(sema.db))?; - let trait_path = trait_ref.and_then(|t| self.canonical_path_from_trait_ref(t)); - Some( - self.trap - .emit(generated::ImplItemCanonicalPath { - id: trap_key!("<", type_path, "as", trait_path, ">::", name), - type_path, - trait_path, - name, - }) - .into(), - ) + let ty = it.self_ty(sema.db); + if let Some(trait_path) = it + .trait_ref(sema.db) + .and_then(|t| self.canonical_path_from_trait_ref(t)) + { + let type_path = self.canonical_path_from_type(ty)?; + Some( + self.trap + .emit(generated::TraitImplItemCanonicalPath { + id: trap_key!("<", type_path, "as", trait_path, ">::", name), + type_path, + trait_path, + name, + }) + .into(), + ) + } else { + // with no trait this must be an Adt impl + let adt = ty.as_adt()?; + let parent = self.canonical_path_from_module_item(adt)?; + Some( + self.trap + .emit(generated::TypeImplItemCanonicalPath { + id: trap_key!(parent, name), + parent, + name, + }) + .into(), + ) + } } ItemContainer::Module(it) => { let namespace = self.canonical_path_from_module(it)?; diff --git a/rust/extractor/src/translate/label_cache.rs b/rust/extractor/src/translate/label_cache.rs index d39c9b653a3..1e5e49c8cc8 100644 --- a/rust/extractor/src/translate/label_cache.rs +++ b/rust/extractor/src/translate/label_cache.rs @@ -1,6 +1,8 @@ use crate::generated::{self}; use crate::trap::{Label, TrapClass, UntypedLabel}; -use ra_ap_hir::{Crate, Enum, Function, Module, Struct, Trait, TraitRef, Type, Union, Variant}; +use ra_ap_hir::{ + Adt, Crate, Enum, Function, Module, Struct, Trait, TraitRef, Type, Union, Variant, +}; use std::collections::HashMap; #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -57,6 +59,16 @@ impl StorableAsModuleItemCanonicalPath for Trait { } } +impl StorableAsModuleItemCanonicalPath for Adt { + fn to_key(&self) -> Key { + match *self { + Adt::Struct(it) => Key::Struct(it), + Adt::Union(it) => Key::Union(it), + Adt::Enum(it) => Key::Enum(it), + } + } +} + impl StorableAsModuleItemCanonicalPath for Enum { fn to_key(&self) -> Key { Key::Enum(*self) diff --git a/rust/extractor/src/translate/mappings.rs b/rust/extractor/src/translate/mappings.rs index c3ca63a3b4f..d10d637816b 100644 --- a/rust/extractor/src/translate/mappings.rs +++ b/rust/extractor/src/translate/mappings.rs @@ -1,5 +1,5 @@ use crate::translate::label_cache::StorableAsModuleItemCanonicalPath; -use ra_ap_hir::{Enum, Module, Semantics, Struct, Trait, Union}; +use ra_ap_hir::{Adt, Enum, Module, Semantics, Struct, Trait, Union}; use ra_ap_ide_db::RootDatabase; use ra_ap_syntax::{ast, ast::RangeItem, AstNode}; @@ -92,6 +92,16 @@ pub trait ModuleItem: StorableAsModuleItemCanonicalPath { fn name(&self, sema: &Semantics<'_, RootDatabase>) -> String; } +impl ModuleItem for Adt { + fn module(&self, sema: &Semantics<'_, RootDatabase>) -> Module { + Adt::module(*self, sema.db) + } + + fn name(&self, sema: &Semantics<'_, RootDatabase>) -> String { + Adt::name(*self, sema.db).as_str().to_owned() + } +} + impl ModuleItem for Enum { fn module(&self, sema: &Semantics<'_, RootDatabase>) -> Module { Enum::module(*self, sema.db) diff --git a/rust/ql/.generated.list b/rust/ql/.generated.list index 3b2bc50429c..12447d41a38 100644 --- a/rust/ql/.generated.list +++ b/rust/ql/.generated.list @@ -179,7 +179,6 @@ lib/codeql/rust/elements/canonical_paths/ConcreteTypeCanonicalPath.qll 720734f27 lib/codeql/rust/elements/canonical_paths/ConstGenericTypeArg.qll c20adef6f5dce4707c3eae6d62c1c5fec504479c12698f8772bc9a47de862204 dde369301c39faf01773704b29863257c87577015c21da8f4cb360d6799a0cc2 lib/codeql/rust/elements/canonical_paths/CrateRoot.qll 4f2507009d8db33506ba1afa8c7dd7632cbe97701a88e3f17fc5de5182b0d549 0110738a63deb881c009d239f901b73975b94a316fbcb0776256f0750251e756 lib/codeql/rust/elements/canonical_paths/DerivedTypeCanonicalPath.qll 74d633f843d4370a5b138bdd1dd055299f34bf4a35d4b5aff3b3989e03902fdd 2e59fcca32927ef0dceb07b882636abb93c3391f8ce00859b3866ab63b255e1c -lib/codeql/rust/elements/canonical_paths/ImplItemCanonicalPath.qll 5c39311ea95c63d114bafae217ffcbad8bdf3dbc680cf96871bcd2e1d1983688 aaeb83b3314b4ca9a39eceadf96f0e7c9428fd121a6ac8055cf8f743e7b37adf lib/codeql/rust/elements/canonical_paths/LangCrateRoot.qll 188e595753552bfd434181292df01e14c44ddc3f12947b43a681b6141997870b dfe218d86045807faec5e631269da45a91c87ddb363cf81224e88a0d2f017745 lib/codeql/rust/elements/canonical_paths/ModuleItemCanonicalPath.qll a2c1de98457b46e7b23ce883a4f7d89ad568916bcd1f9b952b5c533ebacf4300 4baeb47b9a5ce63fe038414f922056aa4e54f684d33c5348072218a121259925 lib/codeql/rust/elements/canonical_paths/Namespace.qll 614db7696ed96b7d52b590bc4700b78ee1ce00ca2c17635b595c296a1798191d 0ee32b32079405349c305bbe77181fc31e18f5d6c877f5d375d5f6ec963a9996 @@ -187,9 +186,11 @@ lib/codeql/rust/elements/canonical_paths/ParametrizedCanonicalPath.qll a22d55c98 lib/codeql/rust/elements/canonical_paths/PlaceholderTypeCanonicalPath.qll ff1be7f5267ceccf40d286c19b4b7933d625cff1bc992c4bbd7d8ca9e584ce93 b89e3bec9d3e2baecd7e76852688f9926b63a0006662778484e139fe2dec10f5 lib/codeql/rust/elements/canonical_paths/RepoCrateRoot.qll d2ef85b33579a72b019dd234ed9ce5ec76e49e064579ccbfc1e13f5a3294dfbc 3f0f7581fb6cfc9cd77e415df5404a8ccd732208c20707392423884836d2b007 lib/codeql/rust/elements/canonical_paths/RustcCrateRoot.qll 3fe51507ac4ef92530a5538ac1b425a0b53b9e2d010a7c71997e8a86e5a99647 a29988f27653863050494a4405c0f1e839e95e003993f96125019e64553767e2 +lib/codeql/rust/elements/canonical_paths/TraitImplItemCanonicalPath.qll c0a645274554605e53df715df9e4c8900118463a252892a7e88633b378ceddae 1c906216e8afd03414ea47888fe1b33c2c57fac8fcc1f0230334fae3808b43ba lib/codeql/rust/elements/canonical_paths/TypeCanonicalPath.qll 510f0c11ca8ac95ee8be57a0be18d2e7ce6350d8ab966e14eeb5a878d1acc781 ae68660f4f24f6426cdf32eeae065fe32d82d1ddece356b10cbbd5579a81e45a lib/codeql/rust/elements/canonical_paths/TypeGenericArg.qll 551e5bce7b474ff097dedfe80e52ca0b3808bda3c855961daddd0ecf36f67aef f3ac937ce08484edab04f285e459c77aac4552e8513b7ee124653aafdb3ceffc lib/codeql/rust/elements/canonical_paths/TypeGenericTypeArg.qll a8a31940baf116b4a41ab2316e995cedac2d0516c546898e028a63f23ea7cb63 b5df2d469245e507b7d2d35263be9f4d7229e6a7914199bf2eae938a1202dfe8 +lib/codeql/rust/elements/canonical_paths/TypeImplItemCanonicalPath.qll a482bf323d0f750ace7ba4df99ef2aed009b5c135d24d4f61c7b33d5fa7c5037 1f72d5a781f7c4986b8927811977093dc39bfa37067a00e320b109bca1aae840 lib/codeql/rust/elements/canonical_paths/TypeItemCanonicalPath.qll 3cdd980844dac4533bf7fc82c1679af39b151aecbe325a9dbd7a2275ecc3b72b df6232001508086a62ad0e629287d0705a072ba26437f8a55d8aad977e11f554 lib/codeql/rust/elements/canonical_paths/internal/BuiltinTypeCanonicalPathConstructor.qll c33ca6a182eae907bc01a11bbe9e10a705889d6d383cd8804c5380368cf785d4 af1677ff43fcb22dedde3dfa853dc12a197c6e5db7ec6191cfd6c9197e371a05 lib/codeql/rust/elements/canonical_paths/internal/BuiltinTypeCanonicalPathImpl.qll 6dbc6981e280717eb8a7cc2bf06bb91e760cc168e262dcf87db53f610b3a0362 ce81251f033173baabcfa9dd2a6a760169015329daac738760bb4e6689c0fe85 @@ -197,7 +198,6 @@ lib/codeql/rust/elements/canonical_paths/internal/CanonicalPathImpl.qll c368afc5 lib/codeql/rust/elements/canonical_paths/internal/ConcreteTypeCanonicalPathConstructor.qll 122781ed5b5bfddc0f6c5243d3a77eb969559115c7f612b81291f62b5790b48d 348ee1d8c92b803a1aaf8e3fc5a9061a41cd2a4c6f2f6fa51910659a1edfa00f lib/codeql/rust/elements/canonical_paths/internal/ConstGenericTypeArgConstructor.qll a2ef92745e712b091367e063662e800b8f84efdf28b02e7116c7c8ab0629e0fc 4a2689f585c0de2f77ca64620bb65986bafab6209fbc383646335040d6155018 lib/codeql/rust/elements/canonical_paths/internal/DerivedTypeCanonicalPathConstructor.qll 1127f0e1eaed5da946a5288271f679ef1984d984a3686cd59d9ec89a8251a234 04419a1231179c8d39637edd443c4ff038e010753f4e6a016ac8c9dbc8f6cccd -lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathConstructor.qll 051864c40fe6ed11b31d73292e6dfe7e84e9219afa20c8c12ed849ca6c84354f c7e00e76d7769b42b62cc1eeebfea307246d6dc9e389592df0b3a26069460e5b lib/codeql/rust/elements/canonical_paths/internal/LangCrateRootConstructor.qll 44b7353025ff44d85dc66e7998736bb94010be1c3ddec6f0e0d8500f89c131df e2cedd482d74cb66ef08a5cbfe9affe25d89d62496260ee5c3e3261cdef02464 lib/codeql/rust/elements/canonical_paths/internal/ModuleItemCanonicalPathConstructor.qll fc580aff51cf598ecfc61a8476044c69800d1bbc41ce5a7ddf1c773d9c20c5db 03ca4ddd5703f2c98609044f76d63c36607b59f25e1e21137818ca7291bb5baf lib/codeql/rust/elements/canonical_paths/internal/NamespaceConstructor.qll 31a7578929de91094425f88d5739a5264c17986e2a00b117075f329cbbef79b6 faf500f1e2a1b04d0bd949d32a639c8713052813cde33aa9cbd691b34a802aac @@ -205,8 +205,10 @@ lib/codeql/rust/elements/canonical_paths/internal/ParametrizedCanonicalPathConst lib/codeql/rust/elements/canonical_paths/internal/PlaceholderTypeCanonicalPathConstructor.qll 8c746f1b034a1f88eaa17244669d87891234a4149ce01139f2485a173802ce93 9d7317406fb9112998bee96f90cec9fbfb24f57497d0ea769e9e944c2aaeddd3 lib/codeql/rust/elements/canonical_paths/internal/RepoCrateRootConstructor.qll 99817342db732e1d66d69dc8eb683ce64cd55ad16913e22236a718fa611ba399 5168ad70d3c7cdf4c06dffa1f5fdedff7d522be0349232a9b15dbfc0b75b9ac5 lib/codeql/rust/elements/canonical_paths/internal/RustcCrateRootConstructor.qll 8e40b20cdd8d3a61c80d2f8832fd9ebaac92753e69a5a5ee658f89e2b3917ba3 8cb3d788e0a26d00e6785f0626a8aee4c3bd98993b0aac20f057c6a5abab8027 +lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathConstructor.qll 4548d2fb262c646ff2eb0409390b9360bcec2bd4a9b594817129f84b6215f362 3d593cf26f40379dda22bb449d05c53c12dad74c06ca4beec1fc59c50362ea67 lib/codeql/rust/elements/canonical_paths/internal/TypeCanonicalPathImpl.qll a6c0228c980b0e8874ccc8d278b4f2938db94ff6a40f065ba2fca5ea012682c6 6a0e7c9d0ea701b605aa19f71f6eeb928e1ab4df9b1961b337ad56e02e36a599 lib/codeql/rust/elements/canonical_paths/internal/TypeGenericTypeArgConstructor.qll dcc4210aa0ed7c2aadd8dfb1f343b29cdf4cfd8d54bddd4424b90f97eac18bf4 b5ce26d604c7e84f27f5981b45b0462e7746089c29522e13ca481e388503d446 +lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathConstructor.qll 4ff55c5fefada4209d9dde9c4a1eaa0d35ca3b1466b309e45c66d63aa96b529b 4f3ec452a35a5d16f4e61e8203d79c6af90ae74cc0c2a32579ce38e22aa8d1f0 lib/codeql/rust/elements/canonical_paths/internal/TypeItemCanonicalPathConstructor.qll b23c6d7902c56c758bc121cd5d3c7e351eccb66503131bc2fa4dda60abb9b4ae b097ab6555f06b12f7ae99378dc9bc347a8b7b7b2691d6a636b9392178cb5692 lib/codeql/rust/elements/internal/AbiConstructor.qll 4484538db49d7c1d31c139f0f21879fceb48d00416e24499a1d4b1337b4141ac 460818e397f2a1a8f2e5466d9551698b0e569d4640fcb87de6c4268a519b3da1 lib/codeql/rust/elements/internal/AbiImpl.qll 01439712ecadc9dc8da6f74d2e19cee13c77f8e1e25699055da675b2c88cb02d dcc9395ef8abd1af3805f3e7fcbc2d7ce30affbce654b6f5e559924768db403c @@ -557,7 +559,7 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b lib/codeql/rust/elements/internal/generated/ParenExpr.qll bc0731505bfe88516205ec360582a4222d2681d11342c93e15258590ddee82f2 d4bd6e0c80cf1d63746c88d4bcb3a01d4c75732e5da09e3ebd9437ced227fb60 lib/codeql/rust/elements/internal/generated/ParenPat.qll 4f168ef5d5bb87a903251cc31b2e44a759b099ec69c90af31783fbb15778c940 0e34f94a45a13396fd57d94c245dc64d1adde2ab0e22b56946f7e94c04e297fc lib/codeql/rust/elements/internal/generated/ParenTypeRepr.qll 40ab5c592e7699c621787793743e33988de71ff42ca27599f5ab3ddb70e3f7d8 12c0a6eed2202ee3e892f61da3b3ce77ac3190854cdf3097e8d2be98aa3cb91d -lib/codeql/rust/elements/internal/generated/ParentChild.qll 94fa8a44faeb32cc7574f9a91b7e08a9cea7a0ee5aec74fdeceb84d02be616c9 18151a38ab16f10346018eabe52b89178b8dee36a1ff1fe68b72cbe385198b6f +lib/codeql/rust/elements/internal/generated/ParentChild.qll 1d06fb28e4ded1394a62f16aafd7a3f3e405a26e6021903825d6a038467c751f 23c106c4b7058256444ccfb9218add6d623d18d28fd460351677ab2519d72f4d lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4 lib/codeql/rust/elements/internal/generated/Path.qll bf6a86e7fcb7164624cc070dcce86d2bda50a2516b95115b87d0ebb5596e50a1 fd7a9ad4034cdebe8dfe495619c46f464630d38195313072e0bd904061b0fb00 lib/codeql/rust/elements/internal/generated/PathAstNode.qll e6d4d5bffd3c623baaaee46bc183eb31ce88795535f164f6a9b9b4d98bbd6101 168db515404933479ba6b150c72e012d28592cbc32366aefcb1bf9599dbcd183 @@ -571,7 +573,7 @@ lib/codeql/rust/elements/internal/generated/PtrTypeRepr.qll 51d1e9e683fc79dddbff 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 16bcc7b31037cd9050b40bbcaf20e7fd56abeb14cab01fd094bad378ad41fde1 adeb639ad18e0dcdead0b85d6bc3d82ac6366f88476a525498136348de70a952 +lib/codeql/rust/elements/internal/generated/Raw.qll 51285a69ae63380b7b84d5ba70612117943d4f4be62752d6580e59ce5bec7ce8 c3966a03912682791a07351a23792968758efa7a365df3d2966017537590d402 lib/codeql/rust/elements/internal/generated/RecordExpr.qll 2131b2cb336caa76170082e69776011bf02576bbfdd34ba68ca84af24209250a 39a2e3ec32352b594c43cc1295e0e8b3f9808173322d3d73cb7d48ef969d5565 lib/codeql/rust/elements/internal/generated/RecordExprField.qll 7e9f8663d3b74ebbc9603b10c9912f082febba6bd73d344b100bbd3edf837802 fbe6b578e7fd5d5a6f21bbb8c388957ab7210a6a249ec71510a50fb35b319ea1 lib/codeql/rust/elements/internal/generated/RecordExprFieldList.qll 179a97211fe7aa6265085d4d54115cdbc0e1cd7c9b2135591e8f36d6432f13d3 dd44bbbc1e83a1ed3a587afb729d7debf7aeb7b63245de181726af13090e50c0 @@ -597,8 +599,8 @@ lib/codeql/rust/elements/internal/generated/Static.qll ea22838e0b7d9796dfaf5deda lib/codeql/rust/elements/internal/generated/Stmt.qll 8473ff532dd5cc9d7decaddcd174b94d610f6ca0aec8e473cc051dad9f3db917 6ef7d2b5237c2dbdcacbf7d8b39109d4dc100229f2b28b5c9e3e4fbf673ba72b lib/codeql/rust/elements/internal/generated/StmtList.qll a667193e32341e17400867c6e359878c4e645ef9f5f4d97676afc0283a33a026 a320ed678ee359302e2fc1b70a9476705cd616fcfa44a499d32f0c7715627f73 lib/codeql/rust/elements/internal/generated/Struct.qll 4d57f0db12dc7ad3e31e750a24172ef1505406b4dab16386af0674bd18bf8f4b 1a73c83df926b996f629316f74c61ea775be04532ab61b56af904223354f033e -lib/codeql/rust/elements/internal/generated/Synth.qll 1406426af42b0bcb62bba6438df8d21ac3d270e2889cbe1846fae27a10e71439 c28fec17a0bb864717783b4a7f254f221040f67c4b29320b46455bfa4c653e76 -lib/codeql/rust/elements/internal/generated/SynthConstructors.qll a2791ebe7281bbba12e385b84241d79260c700c655f8d7ae85bc75351c9e784b a2791ebe7281bbba12e385b84241d79260c700c655f8d7ae85bc75351c9e784b +lib/codeql/rust/elements/internal/generated/Synth.qll dae33e1611a5082ab52dbd5fca8bd55d1a95a8a1d2a453e6f0f9e14ebf0925b4 a6532f979175c7e17a14f411577fe716a779382dae83a684c09982364799561e +lib/codeql/rust/elements/internal/generated/SynthConstructors.qll 9acb065f62f596cfff088f50996be5cffb4c6c1469a3f2a5835cf5a5f6c50db4 9acb065f62f596cfff088f50996be5cffb4c6c1469a3f2a5835cf5a5f6c50db4 lib/codeql/rust/elements/internal/generated/Token.qll 77a91a25ca5669703cf3a4353b591cef4d72caa6b0b9db07bb9e005d69c848d1 2fdffc4882ed3a6ca9ac6d1fb5f1ac5a471ca703e2ffdc642885fa558d6e373b lib/codeql/rust/elements/internal/generated/TokenTree.qll 8577c2b097c1be2f0f7daa5acfcf146f78674a424d99563e08a84dd3e6d91b46 d2f30764e84dbfc0a6a5d3d8a5f935cd432413688cb32da9c94e420fbc10665c lib/codeql/rust/elements/internal/generated/Trait.qll 8fa41b50fa0f68333534f2b66bb4ec8e103ff09ac8fa5c2cc64bc04beafec205 ce1c9aa6d0e2f05d28aab8e1165c3b9fb8e24681ade0cf6a9df2e8617abeae7e @@ -639,7 +641,6 @@ lib/codeql/rust/elements/internal/generated/canonical_paths/ConcreteTypeCanonica lib/codeql/rust/elements/internal/generated/canonical_paths/ConstGenericTypeArg.qll 69aae3c8c9d0ba87d543e6cec3d8783950b31888a6da15e5be37da81c7690238 780a9afc1e43ec885afc2ea22259c4f417244a7efcfb8dd3dc6209462e5faffc lib/codeql/rust/elements/internal/generated/canonical_paths/CrateRoot.qll fe71542b7f5943dc612bf8e52bc817473276460a9138babb7b33176c97d734a7 9cdc982cd8bf7802a82ec08c628ee262c527e25967b15632dc0e47f8e78daa28 lib/codeql/rust/elements/internal/generated/canonical_paths/DerivedTypeCanonicalPath.qll 8e57c57332da344c2b5d9fcdbd079da0f8e322d500b953c5ddeac12dd783fb6f 57224ed02e4e1ada6b01dfa58953bdd7f13cab06d55b90957e64d9d1accead0a -lib/codeql/rust/elements/internal/generated/canonical_paths/ImplItemCanonicalPath.qll ec8e443974dfa7320f996fd676eac81b39b577d3daef58289cba90b9fb0a87e4 100b0d7a10bfdaaa5812bca8efcda90bd4ba53251fccb03d263c563e1ab0041f lib/codeql/rust/elements/internal/generated/canonical_paths/LangCrateRoot.qll 4573e6afb64c334e7337c996d944763cea78e05174e00f1f5fc7598a7b66e364 84892d3a47b66ae2fd0f542141ed747b2cd700731891a7f86fd1a193c745b3db lib/codeql/rust/elements/internal/generated/canonical_paths/ModuleItemCanonicalPath.qll 0b31c6cff057a402051b44ea06a1224c107d8255848c028dbb48c5d8d5e92544 0e157a31e92d6cb9ac4a4cc828b204144def6511ff9fa9002f95b43064cb81e2 lib/codeql/rust/elements/internal/generated/canonical_paths/Namespace.qll d0cc7157e09131e5f6a76b4ddda42ee2f8e5efb2002fe9e6d1da2c0b423a3c27 c2388f34f56333a0440c6c429833150fef7bdba6dbab1bf36224e6ff3dc6aea4 @@ -647,11 +648,13 @@ lib/codeql/rust/elements/internal/generated/canonical_paths/ParametrizedCanonica lib/codeql/rust/elements/internal/generated/canonical_paths/PlaceholderTypeCanonicalPath.qll 27d476cb88f57e342d23218402236f6b15079ef773435102deb80bf57846c364 f143115ea2bd1c8805f3cef32cdc0a52ef9bf53a714ae68bf19c8d48e16d21bd lib/codeql/rust/elements/internal/generated/canonical_paths/RepoCrateRoot.qll 9c9b3d4a0f00313cd8ef75e53e161fee78d08bfcac78d836fd8b9033a4617cc7 621349f2d1a66632ba57940c6ff8e963b297bc9881a4f3d901977fee4c6bcb83 lib/codeql/rust/elements/internal/generated/canonical_paths/RustcCrateRoot.qll 460256c888b3c9efa19556614607b4b9475329d37fab1d16dc33e649c403e247 84526e02752be57e1b776ca08d199f97b3b9e23978da82c0ab5020658c6270e9 +lib/codeql/rust/elements/internal/generated/canonical_paths/TraitImplItemCanonicalPath.qll 48db8a423bbb8c68ab09872dc7a98bfddc7c699d86dc41256f18111bd9579a1c c651f217821dcdde23e06e2ac2ca1c1f87b4170d449c9b4c35c20ebef246e686 lib/codeql/rust/elements/internal/generated/canonical_paths/TypeCanonicalPath.qll 98251c42bc4163504b8ceec3502075f3551c2f66f61dc046fef4b13149337253 9bd821857a18356ab980d7fb5b1daa9bb42a738499e36e20a2944565b757c49d lib/codeql/rust/elements/internal/generated/canonical_paths/TypeGenericArg.qll 37c3e3bdee579697aa304d7df713249dc22df3068e189c21c182bba32b780622 b6e785b81f5a39c9643598d19b06f2beb2745dc8da63c8c91e50200824b9e8a7 lib/codeql/rust/elements/internal/generated/canonical_paths/TypeGenericTypeArg.qll da1d56d3b9a41ac19ead37043e6035c4f42e32a284c0d6d925aadea4bf9691bc 4032024c23cc2910dab4760a2c249ec95324486c32d8f7fac1478e746635e19f +lib/codeql/rust/elements/internal/generated/canonical_paths/TypeImplItemCanonicalPath.qll a6d5d4b0d4ed8e5ee372ebb5cce9d8f046a319978c276f93daa6ae6fbf3b01e7 170ac3b7625f1ed867c19821105c5e651d69a382cc82706bd0ab3330e2c58fb3 lib/codeql/rust/elements/internal/generated/canonical_paths/TypeItemCanonicalPath.qll d2007a4ea331957899a5628c8f42794256952e1942f7331d078ac1c28a5f82e4 a385d0e88d8fcb02e6eea60c8970972ff1d4b96467468caf712d6b992f33fd79 -lib/codeql/rust/elements.qll 9b87ce888d083871402ccea1fb5f53bb3d85e754c7d8a5a84c545234eab91830 9b87ce888d083871402ccea1fb5f53bb3d85e754c7d8a5a84c545234eab91830 +lib/codeql/rust/elements.qll af50a798648d41478433341e6e344714ad82867d0100c093b4334845b15797d3 af50a798648d41478433341e6e344714ad82867d0100c093b4334845b15797d3 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 diff --git a/rust/ql/.gitattributes b/rust/ql/.gitattributes index e5b80c1c15d..27000b1123a 100644 --- a/rust/ql/.gitattributes +++ b/rust/ql/.gitattributes @@ -181,7 +181,6 @@ /lib/codeql/rust/elements/canonical_paths/ConstGenericTypeArg.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/CrateRoot.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/DerivedTypeCanonicalPath.qll linguist-generated -/lib/codeql/rust/elements/canonical_paths/ImplItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/LangCrateRoot.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/ModuleItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/Namespace.qll linguist-generated @@ -189,9 +188,11 @@ /lib/codeql/rust/elements/canonical_paths/PlaceholderTypeCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/RepoCrateRoot.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/RustcCrateRoot.qll linguist-generated +/lib/codeql/rust/elements/canonical_paths/TraitImplItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/TypeCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/TypeGenericArg.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/TypeGenericTypeArg.qll linguist-generated +/lib/codeql/rust/elements/canonical_paths/TypeImplItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/TypeItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/BuiltinTypeCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/BuiltinTypeCanonicalPathImpl.qll linguist-generated @@ -199,7 +200,6 @@ /lib/codeql/rust/elements/canonical_paths/internal/ConcreteTypeCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/ConstGenericTypeArgConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/DerivedTypeCanonicalPathConstructor.qll linguist-generated -/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/LangCrateRootConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/ModuleItemCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/NamespaceConstructor.qll linguist-generated @@ -207,8 +207,10 @@ /lib/codeql/rust/elements/canonical_paths/internal/PlaceholderTypeCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/RepoCrateRootConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/RustcCrateRootConstructor.qll linguist-generated +/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/TypeCanonicalPathImpl.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/TypeGenericTypeArgConstructor.qll linguist-generated +/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/canonical_paths/internal/TypeItemCanonicalPathConstructor.qll linguist-generated /lib/codeql/rust/elements/internal/AbiConstructor.qll linguist-generated /lib/codeql/rust/elements/internal/AbiImpl.qll linguist-generated @@ -641,7 +643,6 @@ /lib/codeql/rust/elements/internal/generated/canonical_paths/ConstGenericTypeArg.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/CrateRoot.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/DerivedTypeCanonicalPath.qll linguist-generated -/lib/codeql/rust/elements/internal/generated/canonical_paths/ImplItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/LangCrateRoot.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/ModuleItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/Namespace.qll linguist-generated @@ -649,9 +650,11 @@ /lib/codeql/rust/elements/internal/generated/canonical_paths/PlaceholderTypeCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/RepoCrateRoot.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/RustcCrateRoot.qll linguist-generated +/lib/codeql/rust/elements/internal/generated/canonical_paths/TraitImplItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/TypeCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/TypeGenericArg.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/TypeGenericTypeArg.qll linguist-generated +/lib/codeql/rust/elements/internal/generated/canonical_paths/TypeImplItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements/internal/generated/canonical_paths/TypeItemCanonicalPath.qll linguist-generated /lib/codeql/rust/elements.qll linguist-generated /test/extractor-tests/generated/Abi/Abi.ql linguist-generated diff --git a/rust/ql/lib/codeql/rust/elements.qll b/rust/ql/lib/codeql/rust/elements.qll index e09bac0fa7b..0503f983f1d 100644 --- a/rust/ql/lib/codeql/rust/elements.qll +++ b/rust/ql/lib/codeql/rust/elements.qll @@ -184,7 +184,6 @@ import codeql.rust.elements.canonical_paths.ConcreteTypeCanonicalPath import codeql.rust.elements.canonical_paths.ConstGenericTypeArg import codeql.rust.elements.canonical_paths.CrateRoot import codeql.rust.elements.canonical_paths.DerivedTypeCanonicalPath -import codeql.rust.elements.canonical_paths.ImplItemCanonicalPath import codeql.rust.elements.canonical_paths.LangCrateRoot import codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath import codeql.rust.elements.canonical_paths.Namespace @@ -192,7 +191,9 @@ import codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath import codeql.rust.elements.canonical_paths.PlaceholderTypeCanonicalPath import codeql.rust.elements.canonical_paths.RepoCrateRoot import codeql.rust.elements.canonical_paths.RustcCrateRoot +import codeql.rust.elements.canonical_paths.TraitImplItemCanonicalPath import codeql.rust.elements.canonical_paths.TypeCanonicalPath import codeql.rust.elements.canonical_paths.TypeGenericArg import codeql.rust.elements.canonical_paths.TypeGenericTypeArg +import codeql.rust.elements.canonical_paths.TypeImplItemCanonicalPath import codeql.rust.elements.canonical_paths.TypeItemCanonicalPath diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/ImplItemCanonicalPath.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/ImplItemCanonicalPath.qll deleted file mode 100644 index 33594da9b90..00000000000 --- a/rust/ql/lib/codeql/rust/elements/canonical_paths/ImplItemCanonicalPath.qll +++ /dev/null @@ -1,14 +0,0 @@ -// generated by codegen, do not edit -/** - * This module provides the public class `ImplItemCanonicalPath`. - */ - -private import internal.ImplItemCanonicalPathImpl -import codeql.rust.elements.canonical_paths.CanonicalPath -import codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath -import codeql.rust.elements.canonical_paths.TypeCanonicalPath - -/** - * A canonical path for an item defined in an impl (a method or associated type). - */ -final class ImplItemCanonicalPath = Impl::ImplItemCanonicalPath; diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/TraitImplItemCanonicalPath.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/TraitImplItemCanonicalPath.qll new file mode 100644 index 00000000000..da71b7bdbd7 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/canonical_paths/TraitImplItemCanonicalPath.qll @@ -0,0 +1,14 @@ +// generated by codegen, do not edit +/** + * This module provides the public class `TraitImplItemCanonicalPath`. + */ + +private import internal.TraitImplItemCanonicalPathImpl +import codeql.rust.elements.canonical_paths.CanonicalPath +import codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath +import codeql.rust.elements.canonical_paths.TypeCanonicalPath + +/** + * A canonical path for an item defined in a trait impl. + */ +final class TraitImplItemCanonicalPath = Impl::TraitImplItemCanonicalPath; diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/TypeImplItemCanonicalPath.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/TypeImplItemCanonicalPath.qll new file mode 100644 index 00000000000..6249b275889 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/canonical_paths/TypeImplItemCanonicalPath.qll @@ -0,0 +1,13 @@ +// generated by codegen, do not edit +/** + * This module provides the public class `TypeImplItemCanonicalPath`. + */ + +private import internal.TypeImplItemCanonicalPathImpl +import codeql.rust.elements.canonical_paths.CanonicalPath +import codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath + +/** + * A canonical path for an item defined in a type impl. + */ +final class TypeImplItemCanonicalPath = Impl::TypeImplItemCanonicalPath; diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathImpl.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathImpl.qll deleted file mode 100644 index 8234b676939..00000000000 --- a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathImpl.qll +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This module provides a hand-modifiable wrapper around the generated class `ImplItemCanonicalPath`. - * - * INTERNAL: Do not use. - */ - -private import codeql.rust.elements.internal.generated.canonical_paths.ImplItemCanonicalPath - -/** - * INTERNAL: This module contains the customizable definition of `ImplItemCanonicalPath` and should not - * be referenced directly. - */ -module Impl { - // the following QLdoc is generated: if you need to edit it, do it in the schema file - /** - * A canonical path for an item defined in an impl (a method or associated type). - */ - class ImplItemCanonicalPath extends Generated::ImplItemCanonicalPath { - override string toString() { - exists(string trait | - ( - if this.hasTraitPath() - then trait = " as " + this.getTraitPath().toAbbreviatedString() - else trait = "" - ) and - result = "<" + this.getTypePath().toAbbreviatedString() + trait + ">::" + this.getName() - ) - } - } -} diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathConstructor.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathConstructor.qll new file mode 100644 index 00000000000..e783b8e94ce --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathConstructor.qll @@ -0,0 +1,14 @@ +// generated by codegen, remove this comment if you wish to edit this file +/** + * This module defines the hook used internally to tweak the characteristic predicate of + * `TraitImplItemCanonicalPath` synthesized instances. + * INTERNAL: Do not use. + */ + +private import codeql.rust.elements.internal.generated.Raw + +/** + * The characteristic predicate of `TraitImplItemCanonicalPath` synthesized instances. + * INTERNAL: Do not use. + */ +predicate constructTraitImplItemCanonicalPath(Raw::TraitImplItemCanonicalPath id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathImpl.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathImpl.qll new file mode 100644 index 00000000000..af71d5abb7e --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TraitImplItemCanonicalPathImpl.qll @@ -0,0 +1,25 @@ +/** + * This module provides a hand-modifiable wrapper around the generated class `TraitImplItemCanonicalPath`. + * + * INTERNAL: Do not use. + */ + +private import codeql.rust.elements.internal.generated.canonical_paths.TraitImplItemCanonicalPath + +/** + * INTERNAL: This module contains the customizable definition of `TraitImplItemCanonicalPath` and should not + * be referenced directly. + */ +module Impl { + // the following QLdoc is generated: if you need to edit it, do it in the schema file + /** + * A canonical path for an item defined in a trait impl. + */ + class TraitImplItemCanonicalPath extends Generated::TraitImplItemCanonicalPath { + override string toString() { + result = + "<" + this.getTypePath().toAbbreviatedString() + " as " + + this.getTraitPath().toAbbreviatedString() + ">::" + this.getName() + } + } +} diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathConstructor.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathConstructor.qll similarity index 55% rename from rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathConstructor.qll rename to rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathConstructor.qll index a7a9b3f880a..a6a539fa473 100644 --- a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/ImplItemCanonicalPathConstructor.qll +++ b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathConstructor.qll @@ -1,14 +1,14 @@ // generated by codegen, remove this comment if you wish to edit this file /** * This module defines the hook used internally to tweak the characteristic predicate of - * `ImplItemCanonicalPath` synthesized instances. + * `TypeImplItemCanonicalPath` synthesized instances. * INTERNAL: Do not use. */ private import codeql.rust.elements.internal.generated.Raw /** - * The characteristic predicate of `ImplItemCanonicalPath` synthesized instances. + * The characteristic predicate of `TypeImplItemCanonicalPath` synthesized instances. * INTERNAL: Do not use. */ -predicate constructImplItemCanonicalPath(Raw::ImplItemCanonicalPath id) { any() } +predicate constructTypeImplItemCanonicalPath(Raw::TypeImplItemCanonicalPath id) { any() } diff --git a/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathImpl.qll b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathImpl.qll new file mode 100644 index 00000000000..67d31b77784 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/canonical_paths/internal/TypeImplItemCanonicalPathImpl.qll @@ -0,0 +1,23 @@ +/** + * This module provides a hand-modifiable wrapper around the generated class `TypeImplItemCanonicalPath`. + * + * INTERNAL: Do not use. + */ + +private import codeql.rust.elements.internal.generated.canonical_paths.TypeImplItemCanonicalPath + +/** + * INTERNAL: This module contains the customizable definition of `TypeImplItemCanonicalPath` and should not + * be referenced directly. + */ +module Impl { + // the following QLdoc is generated: if you need to edit it, do it in the schema file + /** + * A canonical path for an item defined in a type impl. + */ + class TypeImplItemCanonicalPath extends Generated::TypeImplItemCanonicalPath { + override string toString() { + result = "<" + this.getParent().toAbbreviatedString() + ">::" + this.getName() + } + } +} diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll index 59723adb140..f30f49b65e2 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/ParentChild.qll @@ -3816,22 +3816,6 @@ private module Impl { ) } - private Element getImmediateChildOfImplItemCanonicalPath( - ImplItemCanonicalPath e, int index, string partialPredicateCall - ) { - exists(int b, int bCanonicalPath, int n | - b = 0 and - bCanonicalPath = - b + 1 + max(int i | i = -1 or exists(getImmediateChildOfCanonicalPath(e, i, _)) | i) and - n = bCanonicalPath and - ( - none() - or - result = getImmediateChildOfCanonicalPath(e, index - b, partialPredicateCall) - ) - ) - } - private Element getImmediateChildOfLangCrateRoot( LangCrateRoot e, int index, string partialPredicateCall ) { @@ -3923,6 +3907,22 @@ private module Impl { ) } + private Element getImmediateChildOfTraitImplItemCanonicalPath( + TraitImplItemCanonicalPath e, int index, string partialPredicateCall + ) { + exists(int b, int bCanonicalPath, int n | + b = 0 and + bCanonicalPath = + b + 1 + max(int i | i = -1 or exists(getImmediateChildOfCanonicalPath(e, i, _)) | i) and + n = bCanonicalPath and + ( + none() + or + result = getImmediateChildOfCanonicalPath(e, index - b, partialPredicateCall) + ) + ) + } + private Element getImmediateChildOfTypeCanonicalPath( TypeCanonicalPath e, int index, string partialPredicateCall ) { @@ -3955,6 +3955,22 @@ private module Impl { ) } + private Element getImmediateChildOfTypeImplItemCanonicalPath( + TypeImplItemCanonicalPath e, int index, string partialPredicateCall + ) { + exists(int b, int bCanonicalPath, int n | + b = 0 and + bCanonicalPath = + b + 1 + max(int i | i = -1 or exists(getImmediateChildOfCanonicalPath(e, i, _)) | i) and + n = bCanonicalPath and + ( + none() + or + result = getImmediateChildOfCanonicalPath(e, index - b, partialPredicateCall) + ) + ) + } + private Element getImmediateChildOfTypeItemCanonicalPath( TypeItemCanonicalPath e, int index, string partialPredicateCall ) { @@ -4343,8 +4359,6 @@ private module Impl { or result = getImmediateChildOfConstGenericTypeArg(e, index, partialAccessor) or - result = getImmediateChildOfImplItemCanonicalPath(e, index, partialAccessor) - or result = getImmediateChildOfLangCrateRoot(e, index, partialAccessor) or result = getImmediateChildOfModuleItemCanonicalPath(e, index, partialAccessor) @@ -4357,8 +4371,12 @@ private module Impl { or result = getImmediateChildOfRustcCrateRoot(e, index, partialAccessor) or + result = getImmediateChildOfTraitImplItemCanonicalPath(e, index, partialAccessor) + or result = getImmediateChildOfTypeGenericTypeArg(e, index, partialAccessor) or + result = getImmediateChildOfTypeImplItemCanonicalPath(e, index, partialAccessor) + or result = getImmediateChildOfTypeItemCanonicalPath(e, index, partialAccessor) or result = getImmediateChildOfBuiltinTypeCanonicalPath(e, index, partialAccessor) diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll index 62c4c260c36..fd16c5ebdda 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll @@ -4006,29 +4006,6 @@ module Raw { string getValue() { const_generic_type_args(this, result) } } - /** - * INTERNAL: Do not use. - * A canonical path for an item defined in an impl (a method or associated type). - */ - class ImplItemCanonicalPath extends @impl_item_canonical_path, CanonicalPath { - override string toString() { result = "ImplItemCanonicalPath" } - - /** - * Gets the type path of this impl item canonical path. - */ - TypeCanonicalPath getTypePath() { impl_item_canonical_paths(this, result, _) } - - /** - * Gets the trait path of this impl item canonical path, if it exists. - */ - ParametrizedCanonicalPath getTraitPath() { impl_item_canonical_path_trait_paths(this, result) } - - /** - * Gets the name of this impl item canonical path. - */ - string getName() { impl_item_canonical_paths(this, _, result) } - } - /** * INTERNAL: Do not use. * A reference to a crate in the Rust standard libraries. @@ -4133,6 +4110,29 @@ module Raw { string getName() { rustc_crate_roots(this, result) } } + /** + * INTERNAL: Do not use. + * A canonical path for an item defined in a trait impl. + */ + class TraitImplItemCanonicalPath extends @trait_impl_item_canonical_path, CanonicalPath { + override string toString() { result = "TraitImplItemCanonicalPath" } + + /** + * Gets the type path of this trait impl item canonical path. + */ + TypeCanonicalPath getTypePath() { trait_impl_item_canonical_paths(this, result, _, _) } + + /** + * Gets the trait path of this trait impl item canonical path. + */ + ParametrizedCanonicalPath getTraitPath() { trait_impl_item_canonical_paths(this, _, result, _) } + + /** + * Gets the name of this trait impl item canonical path. + */ + string getName() { trait_impl_item_canonical_paths(this, _, _, result) } + } + /** * INTERNAL: Do not use. * The base for canonical paths for types. @@ -4152,6 +4152,24 @@ module Raw { TypeCanonicalPath getPath() { type_generic_type_args(this, result) } } + /** + * INTERNAL: Do not use. + * A canonical path for an item defined in a type impl. + */ + class TypeImplItemCanonicalPath extends @type_impl_item_canonical_path, CanonicalPath { + override string toString() { result = "TypeImplItemCanonicalPath" } + + /** + * Gets the parent of this type impl item canonical path. + */ + ModuleItemCanonicalPath getParent() { type_impl_item_canonical_paths(this, result, _) } + + /** + * Gets the name of this type impl item canonical path. + */ + string getName() { type_impl_item_canonical_paths(this, _, result) } + } + /** * INTERNAL: Do not use. * A canonical path for an item defined in a type or trait. diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll index 19186e82b9e..d6aa7c2994d 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/Synth.qll @@ -644,10 +644,6 @@ module Synth { TDerivedTypeCanonicalPath(Raw::DerivedTypeCanonicalPath id) { constructDerivedTypeCanonicalPath(id) } or - /** - * INTERNAL: Do not use. - */ - TImplItemCanonicalPath(Raw::ImplItemCanonicalPath id) { constructImplItemCanonicalPath(id) } or /** * INTERNAL: Do not use. */ @@ -682,10 +678,22 @@ module Synth { * INTERNAL: Do not use. */ TRustcCrateRoot(Raw::RustcCrateRoot id) { constructRustcCrateRoot(id) } or + /** + * INTERNAL: Do not use. + */ + TTraitImplItemCanonicalPath(Raw::TraitImplItemCanonicalPath id) { + constructTraitImplItemCanonicalPath(id) + } or /** * INTERNAL: Do not use. */ TTypeGenericTypeArg(Raw::TypeGenericTypeArg id) { constructTypeGenericTypeArg(id) } or + /** + * INTERNAL: Do not use. + */ + TTypeImplItemCanonicalPath(Raw::TypeImplItemCanonicalPath id) { + constructTypeImplItemCanonicalPath(id) + } or /** * INTERNAL: Do not use. */ @@ -840,8 +848,9 @@ module Synth { * INTERNAL: Do not use. */ class TCanonicalPath = - TImplItemCanonicalPath or TModuleItemCanonicalPath or TNamespace or - TParametrizedCanonicalPath or TTypeCanonicalPath or TTypeItemCanonicalPath; + TModuleItemCanonicalPath or TNamespace or TParametrizedCanonicalPath or + TTraitImplItemCanonicalPath or TTypeCanonicalPath or TTypeImplItemCanonicalPath or + TTypeItemCanonicalPath; /** * INTERNAL: Do not use. @@ -1807,14 +1816,6 @@ module Synth { result = TDerivedTypeCanonicalPath(e) } - /** - * INTERNAL: Do not use. - * Converts a raw element to a synthesized `TImplItemCanonicalPath`, if possible. - */ - TImplItemCanonicalPath convertImplItemCanonicalPathFromRaw(Raw::Element e) { - result = TImplItemCanonicalPath(e) - } - /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TLangCrateRoot`, if possible. @@ -1863,6 +1864,14 @@ module Synth { */ TRustcCrateRoot convertRustcCrateRootFromRaw(Raw::Element e) { result = TRustcCrateRoot(e) } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TTraitImplItemCanonicalPath`, if possible. + */ + TTraitImplItemCanonicalPath convertTraitImplItemCanonicalPathFromRaw(Raw::Element e) { + result = TTraitImplItemCanonicalPath(e) + } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TTypeGenericTypeArg`, if possible. @@ -1871,6 +1880,14 @@ module Synth { result = TTypeGenericTypeArg(e) } + /** + * INTERNAL: Do not use. + * Converts a raw element to a synthesized `TTypeImplItemCanonicalPath`, if possible. + */ + TTypeImplItemCanonicalPath convertTypeImplItemCanonicalPathFromRaw(Raw::Element e) { + result = TTypeImplItemCanonicalPath(e) + } + /** * INTERNAL: Do not use. * Converts a raw element to a synthesized `TTypeItemCanonicalPath`, if possible. @@ -2416,16 +2433,18 @@ module Synth { * Converts a raw DB element to a synthesized `TCanonicalPath`, if possible. */ TCanonicalPath convertCanonicalPathFromRaw(Raw::Element e) { - result = convertImplItemCanonicalPathFromRaw(e) - or result = convertModuleItemCanonicalPathFromRaw(e) or result = convertNamespaceFromRaw(e) or result = convertParametrizedCanonicalPathFromRaw(e) or + result = convertTraitImplItemCanonicalPathFromRaw(e) + or result = convertTypeCanonicalPathFromRaw(e) or + result = convertTypeImplItemCanonicalPathFromRaw(e) + or result = convertTypeItemCanonicalPathFromRaw(e) } @@ -3417,14 +3436,6 @@ module Synth { e = TDerivedTypeCanonicalPath(result) } - /** - * INTERNAL: Do not use. - * Converts a synthesized `TImplItemCanonicalPath` to a raw DB element, if possible. - */ - Raw::Element convertImplItemCanonicalPathToRaw(TImplItemCanonicalPath e) { - e = TImplItemCanonicalPath(result) - } - /** * INTERNAL: Do not use. * Converts a synthesized `TLangCrateRoot` to a raw DB element, if possible. @@ -3473,6 +3484,14 @@ module Synth { */ Raw::Element convertRustcCrateRootToRaw(TRustcCrateRoot e) { e = TRustcCrateRoot(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TTraitImplItemCanonicalPath` to a raw DB element, if possible. + */ + Raw::Element convertTraitImplItemCanonicalPathToRaw(TTraitImplItemCanonicalPath e) { + e = TTraitImplItemCanonicalPath(result) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TTypeGenericTypeArg` to a raw DB element, if possible. @@ -3481,6 +3500,14 @@ module Synth { e = TTypeGenericTypeArg(result) } + /** + * INTERNAL: Do not use. + * Converts a synthesized `TTypeImplItemCanonicalPath` to a raw DB element, if possible. + */ + Raw::Element convertTypeImplItemCanonicalPathToRaw(TTypeImplItemCanonicalPath e) { + e = TTypeImplItemCanonicalPath(result) + } + /** * INTERNAL: Do not use. * Converts a synthesized `TTypeItemCanonicalPath` to a raw DB element, if possible. @@ -4026,16 +4053,18 @@ module Synth { * Converts a synthesized `TCanonicalPath` to a raw DB element, if possible. */ Raw::Element convertCanonicalPathToRaw(TCanonicalPath e) { - result = convertImplItemCanonicalPathToRaw(e) - or result = convertModuleItemCanonicalPathToRaw(e) or result = convertNamespaceToRaw(e) or result = convertParametrizedCanonicalPathToRaw(e) or + result = convertTraitImplItemCanonicalPathToRaw(e) + or result = convertTypeCanonicalPathToRaw(e) or + result = convertTypeImplItemCanonicalPathToRaw(e) + or result = convertTypeItemCanonicalPathToRaw(e) } diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll index 4be8f262c0b..8e637dc12c4 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/SynthConstructors.qll @@ -157,7 +157,6 @@ import codeql.rust.elements.canonical_paths.internal.BuiltinTypeCanonicalPathCon import codeql.rust.elements.canonical_paths.internal.ConcreteTypeCanonicalPathConstructor import codeql.rust.elements.canonical_paths.internal.ConstGenericTypeArgConstructor import codeql.rust.elements.canonical_paths.internal.DerivedTypeCanonicalPathConstructor -import codeql.rust.elements.canonical_paths.internal.ImplItemCanonicalPathConstructor import codeql.rust.elements.canonical_paths.internal.LangCrateRootConstructor import codeql.rust.elements.canonical_paths.internal.ModuleItemCanonicalPathConstructor import codeql.rust.elements.canonical_paths.internal.NamespaceConstructor @@ -165,5 +164,7 @@ import codeql.rust.elements.canonical_paths.internal.ParametrizedCanonicalPathCo import codeql.rust.elements.canonical_paths.internal.PlaceholderTypeCanonicalPathConstructor import codeql.rust.elements.canonical_paths.internal.RepoCrateRootConstructor import codeql.rust.elements.canonical_paths.internal.RustcCrateRootConstructor +import codeql.rust.elements.canonical_paths.internal.TraitImplItemCanonicalPathConstructor import codeql.rust.elements.canonical_paths.internal.TypeGenericTypeArgConstructor +import codeql.rust.elements.canonical_paths.internal.TypeImplItemCanonicalPathConstructor import codeql.rust.elements.canonical_paths.internal.TypeItemCanonicalPathConstructor diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/ImplItemCanonicalPath.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/ImplItemCanonicalPath.qll deleted file mode 100644 index a28ca2cec5e..00000000000 --- a/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/ImplItemCanonicalPath.qll +++ /dev/null @@ -1,60 +0,0 @@ -// generated by codegen, do not edit -/** - * This module provides the generated definition of `ImplItemCanonicalPath`. - * 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.canonical_paths.internal.CanonicalPathImpl::Impl as CanonicalPathImpl -import codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath -import codeql.rust.elements.canonical_paths.TypeCanonicalPath - -/** - * INTERNAL: This module contains the fully generated definition of `ImplItemCanonicalPath` and should not - * be referenced directly. - */ -module Generated { - /** - * A canonical path for an item defined in an impl (a method or associated type). - * INTERNAL: Do not reference the `Generated::ImplItemCanonicalPath` class directly. - * Use the subclass `ImplItemCanonicalPath`, where the following predicates are available. - */ - class ImplItemCanonicalPath extends Synth::TImplItemCanonicalPath, - CanonicalPathImpl::CanonicalPath - { - override string getAPrimaryQlClass() { result = "ImplItemCanonicalPath" } - - /** - * Gets the type path of this impl item canonical path. - */ - TypeCanonicalPath getTypePath() { - result = - Synth::convertTypeCanonicalPathFromRaw(Synth::convertImplItemCanonicalPathToRaw(this) - .(Raw::ImplItemCanonicalPath) - .getTypePath()) - } - - /** - * Gets the trait path of this impl item canonical path, if it exists. - */ - ParametrizedCanonicalPath getTraitPath() { - result = - Synth::convertParametrizedCanonicalPathFromRaw(Synth::convertImplItemCanonicalPathToRaw(this) - .(Raw::ImplItemCanonicalPath) - .getTraitPath()) - } - - /** - * Holds if `getTraitPath()` exists. - */ - final predicate hasTraitPath() { exists(this.getTraitPath()) } - - /** - * Gets the name of this impl item canonical path. - */ - string getName() { - result = Synth::convertImplItemCanonicalPathToRaw(this).(Raw::ImplItemCanonicalPath).getName() - } - } -} diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TraitImplItemCanonicalPath.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TraitImplItemCanonicalPath.qll new file mode 100644 index 00000000000..d0906391c87 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TraitImplItemCanonicalPath.qll @@ -0,0 +1,58 @@ +// generated by codegen, do not edit +/** + * This module provides the generated definition of `TraitImplItemCanonicalPath`. + * 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.canonical_paths.internal.CanonicalPathImpl::Impl as CanonicalPathImpl +import codeql.rust.elements.canonical_paths.ParametrizedCanonicalPath +import codeql.rust.elements.canonical_paths.TypeCanonicalPath + +/** + * INTERNAL: This module contains the fully generated definition of `TraitImplItemCanonicalPath` and should not + * be referenced directly. + */ +module Generated { + /** + * A canonical path for an item defined in a trait impl. + * INTERNAL: Do not reference the `Generated::TraitImplItemCanonicalPath` class directly. + * Use the subclass `TraitImplItemCanonicalPath`, where the following predicates are available. + */ + class TraitImplItemCanonicalPath extends Synth::TTraitImplItemCanonicalPath, + CanonicalPathImpl::CanonicalPath + { + override string getAPrimaryQlClass() { result = "TraitImplItemCanonicalPath" } + + /** + * Gets the type path of this trait impl item canonical path. + */ + TypeCanonicalPath getTypePath() { + result = + Synth::convertTypeCanonicalPathFromRaw(Synth::convertTraitImplItemCanonicalPathToRaw(this) + .(Raw::TraitImplItemCanonicalPath) + .getTypePath()) + } + + /** + * Gets the trait path of this trait impl item canonical path. + */ + ParametrizedCanonicalPath getTraitPath() { + result = + Synth::convertParametrizedCanonicalPathFromRaw(Synth::convertTraitImplItemCanonicalPathToRaw(this) + .(Raw::TraitImplItemCanonicalPath) + .getTraitPath()) + } + + /** + * Gets the name of this trait impl item canonical path. + */ + string getName() { + result = + Synth::convertTraitImplItemCanonicalPathToRaw(this) + .(Raw::TraitImplItemCanonicalPath) + .getName() + } + } +} diff --git a/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TypeImplItemCanonicalPath.qll b/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TypeImplItemCanonicalPath.qll new file mode 100644 index 00000000000..baf76a691d8 --- /dev/null +++ b/rust/ql/lib/codeql/rust/elements/internal/generated/canonical_paths/TypeImplItemCanonicalPath.qll @@ -0,0 +1,47 @@ +// generated by codegen, do not edit +/** + * This module provides the generated definition of `TypeImplItemCanonicalPath`. + * 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.canonical_paths.internal.CanonicalPathImpl::Impl as CanonicalPathImpl +import codeql.rust.elements.canonical_paths.ModuleItemCanonicalPath + +/** + * INTERNAL: This module contains the fully generated definition of `TypeImplItemCanonicalPath` and should not + * be referenced directly. + */ +module Generated { + /** + * A canonical path for an item defined in a type impl. + * INTERNAL: Do not reference the `Generated::TypeImplItemCanonicalPath` class directly. + * Use the subclass `TypeImplItemCanonicalPath`, where the following predicates are available. + */ + class TypeImplItemCanonicalPath extends Synth::TTypeImplItemCanonicalPath, + CanonicalPathImpl::CanonicalPath + { + override string getAPrimaryQlClass() { result = "TypeImplItemCanonicalPath" } + + /** + * Gets the parent of this type impl item canonical path. + */ + ModuleItemCanonicalPath getParent() { + result = + Synth::convertModuleItemCanonicalPathFromRaw(Synth::convertTypeImplItemCanonicalPathToRaw(this) + .(Raw::TypeImplItemCanonicalPath) + .getParent()) + } + + /** + * Gets the name of this type impl item canonical path. + */ + string getName() { + result = + Synth::convertTypeImplItemCanonicalPathToRaw(this) + .(Raw::TypeImplItemCanonicalPath) + .getName() + } + } +} diff --git a/rust/ql/lib/rust.dbscheme b/rust/ql/lib/rust.dbscheme index ceebbb7a9b8..c7170e67601 100644 --- a/rust/ql/lib/rust.dbscheme +++ b/rust/ql/lib/rust.dbscheme @@ -3361,11 +3361,12 @@ while_expr_conditions( ; @canonical_path = - @impl_item_canonical_path -| @module_item_canonical_path + @module_item_canonical_path | @namespace | @parametrized_canonical_path +| @trait_impl_item_canonical_path | @type_canonical_path +| @type_impl_item_canonical_path | @type_item_canonical_path ; @@ -3385,18 +3386,6 @@ const_generic_type_args( //dir=canonical_paths string value: string ref ); -impl_item_canonical_paths( //dir=canonical_paths - unique int id: @impl_item_canonical_path, - int type_path: @type_canonical_path ref, - string name: string ref -); - -#keyset[id] -impl_item_canonical_path_trait_paths( //dir=canonical_paths - int id: @impl_item_canonical_path ref, - int trait_path: @parametrized_canonical_path ref -); - lang_crate_roots( //dir=canonical_paths unique int id: @lang_crate_root, string name: string ref @@ -3448,6 +3437,13 @@ rustc_crate_roots( //dir=canonical_paths string name: string ref ); +trait_impl_item_canonical_paths( //dir=canonical_paths + unique int id: @trait_impl_item_canonical_path, + int type_path: @type_canonical_path ref, + int trait_path: @parametrized_canonical_path ref, + string name: string ref +); + @type_canonical_path = @builtin_type_canonical_path | @concrete_type_canonical_path @@ -3460,6 +3456,12 @@ type_generic_type_args( //dir=canonical_paths int path: @type_canonical_path ref ); +type_impl_item_canonical_paths( //dir=canonical_paths + unique int id: @type_impl_item_canonical_path, + int parent: @module_item_canonical_path ref, + string name: string ref +); + type_item_canonical_paths( //dir=canonical_paths unique int id: @type_item_canonical_path, int parent: @module_item_canonical_path ref, diff --git a/rust/schema/prelude.py b/rust/schema/prelude.py index a1ae6edbafe..53e8092c5a2 100644 --- a/rust/schema/prelude.py +++ b/rust/schema/prelude.py @@ -220,13 +220,20 @@ class TypeItemCanonicalPath(CanonicalPath): """ A canonical path for an item defined in a type or trait. """ - parent: "ModuleItemCanonicalPath" + parent: ModuleItemCanonicalPath name: string -class ImplItemCanonicalPath(CanonicalPath): +class TraitImplItemCanonicalPath(CanonicalPath): """ - A canonical path for an item defined in an impl (a method or associated type). + A canonical path for an item defined in a trait impl. """ type_path: TypeCanonicalPath - trait_path: optional[ParametrizedCanonicalPath] + trait_path: ParametrizedCanonicalPath + name: string + +class TypeImplItemCanonicalPath(CanonicalPath): + """ + A canonical path for an item defined in a type impl. + """ + parent: ModuleItemCanonicalPath name: string