mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
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.
This commit is contained in:
@@ -951,6 +951,10 @@ class _:
|
||||
todo!()
|
||||
```
|
||||
"""
|
||||
has_implementation: predicate | doc("this constant has an implementation") | desc("""
|
||||
This is the same as `hasBody` for source code, but for library code (for which we always skip
|
||||
the body), this will hold when the body was present in the original code.
|
||||
""") | rust.detach
|
||||
|
||||
|
||||
@annotate(ConstArg)
|
||||
@@ -1882,6 +1886,10 @@ class _:
|
||||
class _:
|
||||
param_list: drop
|
||||
attrs: drop
|
||||
has_implementation: predicate | doc("this function has an implementation") | desc("""
|
||||
This is the same as `hasBody` for source code, but for library code (for which we always skip
|
||||
the body), this will hold when the body was present in the original code.
|
||||
""") | rust.detach
|
||||
|
||||
|
||||
@annotate(ClosureExpr, add_bases=[Callable])
|
||||
|
||||
Reference in New Issue
Block a user