github / github/codeql

[Rust] Get type of expression

Aberta
#20,501 7 comentários 1 reação 0 responsáveis Ver no GitHub
question Rust
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
rust
Domínio
devtools, security
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.