Skip to content

Commit aa35e82

Browse files
committed
Rust: Add a test exposing the function scope limitation.
1 parent 3d0e44e commit aa35e82

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

rust/ql/test/query-tests/unusedentities/UnusedValue.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
| main.rs:284:13:284:17 | total | Variable $@ is assigned a value that is never used. | main.rs:252:13:252:17 | total | total |
1515
| main.rs:377:9:377:9 | x | Variable $@ is assigned a value that is never used. | main.rs:377:9:377:9 | x | x |
1616
| main.rs:385:17:385:17 | x | Variable $@ is assigned a value that is never used. | main.rs:385:17:385:17 | x | x |
17-
| main.rs:550:9:550:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:550:9:550:20 | var_in_macro | var_in_macro |
18-
| main.rs:559:9:559:9 | c | Variable $@ is assigned a value that is never used. | main.rs:559:9:559:9 | c | c |
17+
| main.rs:556:9:556:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:556:9:556:20 | var_in_macro | var_in_macro |
18+
| main.rs:565:9:565:9 | c | Variable $@ is assigned a value that is never used. | main.rs:565:9:565:9 | c | c |
1919
| more.rs:44:9:44:14 | a_ptr4 | Variable $@ is assigned a value that is never used. | more.rs:44:9:44:14 | a_ptr4 | a_ptr4 |
2020
| more.rs:59:9:59:13 | d_ptr | Variable $@ is assigned a value that is never used. | more.rs:59:9:59:13 | d_ptr | d_ptr |
2121
| more.rs:65:13:65:17 | f_ptr | Variable $@ is assigned a value that is never used. | more.rs:65:13:65:17 | f_ptr | f_ptr |

rust/ql/test/query-tests/unusedentities/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,13 @@ fn macros3() {
513513
}
514514

515515
fn macros4() {
516+
{
517+
let a: u16 = 6; // $ MISSING: Alert[rust/unused-variable]
518+
}
519+
516520
undefined_macro_call!(5);
521+
522+
let b: u16 = 6; // $ MISSING: Alert[rust/unused-variable]
517523
}
518524

519525
fn macros5() {

0 commit comments

Comments
 (0)