mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
There was a mismatch between a `self.macro_context_level += 1` and the corresponding `self.macro_context_level -= 1`, which resulted in an `usize` underflow (panic in debug mode, wrong behaviour in release mode). This fixes it and adds a relevant assertion and test. In order to properly test library mode extraction, a special option enforcing that on source code as well is added.
23 lines
458 B
Plaintext
23 lines
458 B
Plaintext
private import rust
|
|
|
|
predicate toBeTested(Element e) {
|
|
not e instanceof CrateElement and
|
|
not e instanceof Builtin and
|
|
(
|
|
not e instanceof Locatable
|
|
or
|
|
exists(e.(Locatable).getFile().getRelativePath())
|
|
)
|
|
}
|
|
|
|
class CrateElement extends Element {
|
|
CrateElement() {
|
|
this instanceof Crate or
|
|
this instanceof NamedCrate
|
|
}
|
|
}
|
|
|
|
class Builtin extends AstNode {
|
|
Builtin() { this.getFile().getAbsolutePath().matches("%/builtins/%.rs") }
|
|
}
|