Files
codeql/rust/ql/test/extractor-tests/generated/Const/Const.ql
Paolo Tranquilli 667eed9b9b Rust: store in the DB if a library function or const had a body
When skipping bodies in library code, we lose the information whether a
body was originally present. This can be important, for example when
determining whether a trait method has a default implementation.

With this change that information can be recovered via the
`hasImplementation` predicate.
2025-06-03 10:41:31 +02:00

37 lines
1.7 KiB
Plaintext
Generated

// generated by codegen, do not edit
import codeql.rust.elements
import TestUtils
from
Const x, string hasExtendedCanonicalPath, string hasCrateOrigin,
string hasAttributeMacroExpansion, int getNumberOfAttrs, string hasBody, string isConst,
string isDefault, string hasName, string hasTypeRepr, string hasVisibility,
string hasImplementation
where
toBeTested(x) and
not x.isUnknown() and
(
if x.hasExtendedCanonicalPath()
then hasExtendedCanonicalPath = "yes"
else hasExtendedCanonicalPath = "no"
) and
(if x.hasCrateOrigin() then hasCrateOrigin = "yes" else hasCrateOrigin = "no") and
(
if x.hasAttributeMacroExpansion()
then hasAttributeMacroExpansion = "yes"
else hasAttributeMacroExpansion = "no"
) and
getNumberOfAttrs = x.getNumberOfAttrs() and
(if x.hasBody() then hasBody = "yes" else hasBody = "no") and
(if x.isConst() then isConst = "yes" else isConst = "no") and
(if x.isDefault() then isDefault = "yes" else isDefault = "no") and
(if x.hasName() then hasName = "yes" else hasName = "no") and
(if x.hasTypeRepr() then hasTypeRepr = "yes" else hasTypeRepr = "no") and
(if x.hasVisibility() then hasVisibility = "yes" else hasVisibility = "no") and
if x.hasImplementation() then hasImplementation = "yes" else hasImplementation = "no"
select x, "hasExtendedCanonicalPath:", hasExtendedCanonicalPath, "hasCrateOrigin:", hasCrateOrigin,
"hasAttributeMacroExpansion:", hasAttributeMacroExpansion, "getNumberOfAttrs:", getNumberOfAttrs,
"hasBody:", hasBody, "isConst:", isConst, "isDefault:", isDefault, "hasName:", hasName,
"hasTypeRepr:", hasTypeRepr, "hasVisibility:", hasVisibility, "hasImplementation:",
hasImplementation