Rust: Add a test for BuiltinTypes.

This commit is contained in:
Geoffrey White
2025-10-30 18:58:00 +00:00
parent 47019f7f24
commit 6433bec699
4 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
| struct bool | |
| struct char | |
| struct f32 | FloatingPointType, NumericType |
| struct f64 | FloatingPointType, NumericType |
| struct i8 | IntegralType, NumericType |
| struct i16 | IntegralType, NumericType |
| struct i32 | IntegralType, NumericType |
| struct i64 | IntegralType, NumericType |
| struct i128 | IntegralType, NumericType |
| struct isize | IntegralType, NumericType |
| struct str | |
| struct u8 | IntegralType, NumericType |
| struct u16 | IntegralType, NumericType |
| struct u32 | IntegralType, NumericType |
| struct u64 | IntegralType, NumericType |
| struct u128 | IntegralType, NumericType |
| struct usize | IntegralType, NumericType |

View File

@@ -0,0 +1,14 @@
import rust
import codeql.rust.frameworks.stdlib.Builtins
import codeql.rust.internal.Type
string describe(BuiltinType t) {
(t instanceof NumericType and result = "NumericType")
or
(t instanceof IntegralType and result = "IntegralType")
or
(t instanceof FloatingPointType and result = "FloatingPointType")
}
from BuiltinType t
select t.toString(), concat(describe(t), ", ")

View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "test"
version = "0.0.1"

View File

@@ -0,0 +1,5 @@
// --- tests ---
fn test_types() {
}