[Rust] Get type of expression
- Vorherrschende Sprache
- CodeQL
- Sterne
- 10.1k
- Forks
- 2.1k
- Ø Merge
- 2 T. 15 Std.
- Gemergte PRs (30 T.)
- 141
Beschreibung
**Description of the issue**
How do I get the type of an expression in Rust?
For example, I want to constrain this to only accesses on string-like expressions.
```ql
private class IndexExprOnNonConstantString extends IndexExpr {
IndexExprOnNonConstantString() { not this.getBase() instanceof StringLiteralExpr }
}
```
**Actual**: No `getType` predicate on expr.
**Expected**: Predicate to get type of expr.
When will support be added for an - in my understanding - very basic feature?
Or is there a workaround/internal API?
Beitragsleitfaden
Rechercherichtung
Start by reviewing the Rust CodeQL expression model and the existing Expr predicates, using getBase() and StringLiteralExpr from the example as the initial entry points. Confirm whether an internal type API or workaround exists; done means an expression type can be queried well enough to constrain the shown index-expression class.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- devtools, security
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100