github / github/codeql

[Rust] Get type of expression

Abierto
#20,501 7 comentarios 1 reacción 0 asignados Ver en GitHub
question Rust
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

**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?

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
devtools, security
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.