File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed
rust/ql/test/query-tests/unusedentities Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 14
14
| main.rs:284:13:284:17 | total | Variable $@ is assigned a value that is never used. | main.rs:252:13:252:17 | total | total |
15
15
| main.rs:377:9:377:9 | x | Variable $@ is assigned a value that is never used. | main.rs:377:9:377:9 | x | x |
16
16
| 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:486 :9:486:9 | c | Variable $@ is assigned a value that is never used. | main.rs:486 :9:486:9 | c | c |
18
- | main.rs:519 :9:519:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:519 :9:519:20 | var_in_macro | var_in_macro |
17
+ | main.rs:493 :9:493:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:493 :9:493:20 | var_in_macro | var_in_macro |
18
+ | main.rs:502 :9:502:9 | c | Variable $@ is assigned a value that is never used. | main.rs:502 :9:502:9 | c | c |
19
19
| 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 |
20
20
| 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 |
21
21
| 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 |
Original file line number Diff line number Diff line change @@ -478,6 +478,22 @@ fn macros() {
478
478
} )
479
479
)
480
480
}
481
+
482
+ macro_rules! let_in_macro {
483
+ ( $e: expr) => { {
484
+ let var_in_macro = 0 ;
485
+ $e
486
+ } } ;
487
+ }
488
+
489
+ // Our analysis does not currently respect the hygiene rules of Rust macros
490
+ // (https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html), because
491
+ // all we have access to is the expanded AST
492
+ fn hygiene_mismatch ( ) {
493
+ let var_in_macro = 0 ; // $ SPURIOUS: Alert[rust/unused-value]
494
+ let_in_macro ! ( var_in_macro) ;
495
+ }
496
+
481
497
// --- references ---
482
498
483
499
fn references ( ) {
@@ -505,21 +521,6 @@ trait MyTrait {
505
521
fn my_func2 ( & self , x : i32 ) -> i32 ;
506
522
}
507
523
508
- macro_rules! let_in_macro {
509
- ( $e: expr) => { {
510
- let var_in_macro = 0 ;
511
- $e
512
- } } ;
513
- }
514
-
515
- // Our analysis does not currently respect the hygiene rules of Rust macros
516
- // (https://veykril.github.io/tlborm/decl-macros/minutiae/hygiene.html), because
517
- // all we have access to is the expanded AST
518
- fn hygiene_mismatch ( ) {
519
- let var_in_macro = 0 ; // $ SPURIOUS: Alert[rust/unused-value]
520
- let_in_macro ! ( var_in_macro) ;
521
- }
522
-
523
524
// --- main ---
524
525
525
526
fn main ( ) {
@@ -535,6 +536,7 @@ fn main() {
535
536
func_ptrs ( ) ;
536
537
folds_and_closures ( ) ;
537
538
macros ( ) ;
539
+ hygiene_mismatch ( ) ;
538
540
references ( ) ;
539
541
540
542
generics ( ) ;
You can’t perform that action at this time.
0 commit comments