Skip to content

Commit 6433bec

Browse files
committed
Rust: Add a test for BuiltinTypes.
1 parent 47019f7 commit 6433bec

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
| struct bool | |
2+
| struct char | |
3+
| struct f32 | FloatingPointType, NumericType |
4+
| struct f64 | FloatingPointType, NumericType |
5+
| struct i8 | IntegralType, NumericType |
6+
| struct i16 | IntegralType, NumericType |
7+
| struct i32 | IntegralType, NumericType |
8+
| struct i64 | IntegralType, NumericType |
9+
| struct i128 | IntegralType, NumericType |
10+
| struct isize | IntegralType, NumericType |
11+
| struct str | |
12+
| struct u8 | IntegralType, NumericType |
13+
| struct u16 | IntegralType, NumericType |
14+
| struct u32 | IntegralType, NumericType |
15+
| struct u64 | IntegralType, NumericType |
16+
| struct u128 | IntegralType, NumericType |
17+
| struct usize | IntegralType, NumericType |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import rust
2+
import codeql.rust.frameworks.stdlib.Builtins
3+
import codeql.rust.internal.Type
4+
5+
string describe(BuiltinType t) {
6+
(t instanceof NumericType and result = "NumericType")
7+
or
8+
(t instanceof IntegralType and result = "IntegralType")
9+
or
10+
(t instanceof FloatingPointType and result = "FloatingPointType")
11+
}
12+
13+
from BuiltinType t
14+
select t.toString(), concat(describe(t), ", ")

rust/ql/test/library-tests/elements/builtintypes/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
// --- tests ---
3+
4+
fn test_types() {
5+
}

0 commit comments

Comments
 (0)