Skip to content

Commit ee06364

Browse files
committed
Rust: Add jump-to-def tests for operations and indexing
1 parent 43111b8 commit ee06364

File tree

2 files changed

+104
-48
lines changed

2 files changed

+104
-48
lines changed
Lines changed: 74 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,74 @@
1-
| main.rs:3:5:3:7 | lib | lib.rs:1:1:1:1 | SourceFile | file |
2-
| main.rs:9:14:9:14 | S | main.rs:7:9:7:21 | struct S | path |
3-
| main.rs:10:36:10:39 | Self | main.rs:7:9:7:21 | struct S | path |
4-
| main.rs:11:17:11:17 | S | main.rs:7:9:7:21 | struct S | path |
5-
| main.rs:16:22:16:22 | T | main.rs:16:19:16:19 | T | path |
6-
| main.rs:18:13:18:14 | S2 | main.rs:16:5:16:24 | struct S2 | path |
7-
| main.rs:18:16:18:16 | T | main.rs:18:10:18:10 | T | path |
8-
| main.rs:19:23:19:23 | T | main.rs:18:10:18:10 | T | path |
9-
| main.rs:19:29:19:32 | Self | main.rs:16:5:16:24 | struct S2 | path |
10-
| main.rs:20:13:20:14 | S2 | main.rs:16:5:16:24 | struct S2 | path |
11-
| main.rs:20:16:20:16 | x | main.rs:19:20:19:20 | x | local variable |
12-
| main.rs:29:5:29:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
13-
| main.rs:29:22:29:26 | value | main.rs:29:50:29:54 | value | format argument |
14-
| main.rs:29:29:29:33 | width | main.rs:26:9:26:13 | width | local variable |
15-
| main.rs:29:36:29:44 | precision | main.rs:27:9:27:17 | precision | local variable |
16-
| main.rs:30:5:30:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
17-
| main.rs:30:22:30:22 | 0 | main.rs:30:34:30:38 | value | format argument |
18-
| main.rs:30:25:30:25 | 1 | main.rs:30:41:30:45 | width | format argument |
19-
| main.rs:30:28:30:28 | 2 | main.rs:30:48:30:56 | precision | format argument |
20-
| main.rs:30:34:30:38 | value | main.rs:28:9:28:13 | value | local variable |
21-
| main.rs:30:41:30:45 | width | main.rs:26:9:26:13 | width | local variable |
22-
| main.rs:30:48:30:56 | precision | main.rs:27:9:27:17 | precision | local variable |
23-
| main.rs:31:5:31:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
24-
| main.rs:31:21:31:22 | {} | main.rs:31:29:31:33 | value | format argument |
25-
| main.rs:31:24:31:25 | {} | main.rs:31:36:31:40 | width | format argument |
26-
| main.rs:31:29:31:33 | value | main.rs:28:9:28:13 | value | local variable |
27-
| main.rs:31:36:31:40 | width | main.rs:26:9:26:13 | width | local variable |
28-
| main.rs:33:5:33:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
29-
| main.rs:33:22:33:27 | people | main.rs:32:9:32:14 | people | local variable |
30-
| main.rs:34:5:34:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
31-
| main.rs:34:16:34:16 | 1 | main.rs:34:34:34:34 | 2 | format argument |
32-
| main.rs:34:19:34:20 | {} | main.rs:34:31:34:31 | 1 | format argument |
33-
| main.rs:34:23:34:23 | 0 | main.rs:34:31:34:31 | 1 | format argument |
34-
| main.rs:34:26:34:27 | {} | main.rs:34:34:34:34 | 2 | format argument |
35-
| main.rs:35:5:35:13 | assert_eq | {EXTERNAL LOCATION} | MacroRules | path |
36-
| main.rs:35:16:35:21 | format | {EXTERNAL LOCATION} | MacroRules | path |
37-
| main.rs:35:31:35:35 | {:<5} | main.rs:35:40:35:42 | "x" | format argument |
38-
| main.rs:36:13:36:13 | S | main.rs:1:1:1:9 | struct S | path |
39-
| main.rs:37:13:37:14 | M1 | main.rs:5:1:23:1 | mod M1 | path |
40-
| main.rs:37:17:37:18 | M2 | main.rs:6:5:14:5 | mod M2 | path |
41-
| main.rs:37:21:37:21 | S | main.rs:7:9:7:21 | struct S | path |
42-
| main.rs:38:5:38:5 | s | main.rs:37:9:37:9 | s | local variable |
43-
| main.rs:38:7:38:12 | method | main.rs:10:13:12:13 | fn method | method |
44-
| main.rs:39:5:39:6 | M1 | main.rs:5:1:23:1 | mod M1 | path |
45-
| main.rs:39:9:39:10 | S2 | main.rs:16:5:16:24 | struct S2 | path |
46-
| main.rs:39:14:39:14 | S | main.rs:1:1:1:9 | struct S | path |
47-
| main.rs:39:18:39:20 | new | main.rs:19:9:21:9 | fn new | path |
48-
| main.rs:39:22:39:22 | S | main.rs:1:1:1:9 | struct S | path |
1+
| main.rs:1:5:1:7 | std | {EXTERNAL LOCATION} | Crate([email protected]) | path |
2+
| main.rs:1:10:1:12 | ops | {EXTERNAL LOCATION} | mod ops | path |
3+
| main.rs:3:3:3:8 | derive | {EXTERNAL LOCATION} | MacroDef | path |
4+
| main.rs:6:5:6:7 | lib | lib.rs:1:1:1:1 | SourceFile | file |
5+
| main.rs:8:6:8:8 | Neg | {EXTERNAL LOCATION} | trait Neg | path |
6+
| main.rs:8:14:8:14 | S | main.rs:3:1:4:9 | struct S | path |
7+
| main.rs:9:19:9:22 | Self | main.rs:3:1:4:9 | struct S | path |
8+
| main.rs:11:21:11:24 | Self | main.rs:3:1:4:9 | struct S | path |
9+
| main.rs:12:9:12:9 | S | main.rs:3:1:4:9 | struct S | path |
10+
| main.rs:16:6:16:8 | Add | {EXTERNAL LOCATION} | trait Add | path |
11+
| main.rs:16:14:16:14 | S | main.rs:3:1:4:9 | struct S | path |
12+
| main.rs:17:19:17:22 | Self | main.rs:3:1:4:9 | struct S | path |
13+
| main.rs:19:23:19:26 | Self | main.rs:3:1:4:9 | struct S | path |
14+
| main.rs:19:32:19:35 | Self | main.rs:3:1:4:9 | struct S | path |
15+
| main.rs:20:9:20:9 | S | main.rs:3:1:4:9 | struct S | path |
16+
| main.rs:24:6:24:10 | Index | {EXTERNAL LOCATION} | trait Index | path |
17+
| main.rs:24:12:24:16 | usize | {EXTERNAL LOCATION} | struct usize | path |
18+
| main.rs:24:23:24:23 | S | main.rs:3:1:4:9 | struct S | path |
19+
| main.rs:25:19:25:19 | S | main.rs:3:1:4:9 | struct S | path |
20+
| main.rs:27:28:27:32 | usize | {EXTERNAL LOCATION} | struct usize | path |
21+
| main.rs:27:39:27:42 | Self | main.rs:24:1:30:1 | impl Index::<...> for S { ... } | path |
22+
| main.rs:27:45:27:50 | Output | main.rs:25:5:25:20 | type Output | path |
23+
| main.rs:28:10:28:10 | S | main.rs:3:1:4:9 | struct S | path |
24+
| main.rs:36:14:36:14 | S | main.rs:34:9:34:21 | struct S | path |
25+
| main.rs:37:36:37:39 | Self | main.rs:34:9:34:21 | struct S | path |
26+
| main.rs:38:17:38:17 | S | main.rs:34:9:34:21 | struct S | path |
27+
| main.rs:43:22:43:22 | T | main.rs:43:19:43:19 | T | path |
28+
| main.rs:45:13:45:14 | S2 | main.rs:43:5:43:24 | struct S2 | path |
29+
| main.rs:45:16:45:16 | T | main.rs:45:10:45:10 | T | path |
30+
| main.rs:46:23:46:23 | T | main.rs:45:10:45:10 | T | path |
31+
| main.rs:46:29:46:32 | Self | main.rs:43:5:43:24 | struct S2 | path |
32+
| main.rs:47:13:47:14 | S2 | main.rs:43:5:43:24 | struct S2 | path |
33+
| main.rs:47:16:47:16 | x | main.rs:46:20:46:20 | x | local variable |
34+
| main.rs:56:5:56:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
35+
| main.rs:56:22:56:26 | value | main.rs:56:50:56:54 | value | format argument |
36+
| main.rs:56:29:56:33 | width | main.rs:53:9:53:13 | width | local variable |
37+
| main.rs:56:36:56:44 | precision | main.rs:54:9:54:17 | precision | local variable |
38+
| main.rs:57:5:57:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
39+
| main.rs:57:22:57:22 | 0 | main.rs:57:34:57:38 | value | format argument |
40+
| main.rs:57:25:57:25 | 1 | main.rs:57:41:57:45 | width | format argument |
41+
| main.rs:57:28:57:28 | 2 | main.rs:57:48:57:56 | precision | format argument |
42+
| main.rs:57:34:57:38 | value | main.rs:55:9:55:13 | value | local variable |
43+
| main.rs:57:41:57:45 | width | main.rs:53:9:53:13 | width | local variable |
44+
| main.rs:57:48:57:56 | precision | main.rs:54:9:54:17 | precision | local variable |
45+
| main.rs:58:5:58:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
46+
| main.rs:58:21:58:22 | {} | main.rs:58:29:58:33 | value | format argument |
47+
| main.rs:58:24:58:25 | {} | main.rs:58:36:58:40 | width | format argument |
48+
| main.rs:58:29:58:33 | value | main.rs:55:9:55:13 | value | local variable |
49+
| main.rs:58:36:58:40 | width | main.rs:53:9:53:13 | width | local variable |
50+
| main.rs:60:5:60:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
51+
| main.rs:60:22:60:27 | people | main.rs:59:9:59:14 | people | local variable |
52+
| main.rs:61:5:61:11 | println | {EXTERNAL LOCATION} | MacroRules | path |
53+
| main.rs:61:16:61:16 | 1 | main.rs:61:34:61:34 | 2 | format argument |
54+
| main.rs:61:19:61:20 | {} | main.rs:61:31:61:31 | 1 | format argument |
55+
| main.rs:61:23:61:23 | 0 | main.rs:61:31:61:31 | 1 | format argument |
56+
| main.rs:61:26:61:27 | {} | main.rs:61:34:61:34 | 2 | format argument |
57+
| main.rs:62:5:62:13 | assert_eq | {EXTERNAL LOCATION} | MacroRules | path |
58+
| main.rs:62:16:62:21 | format | {EXTERNAL LOCATION} | MacroRules | path |
59+
| main.rs:62:31:62:35 | {:<5} | main.rs:62:40:62:42 | "x" | format argument |
60+
| main.rs:63:13:63:13 | S | main.rs:3:1:4:9 | struct S | path |
61+
| main.rs:64:13:64:14 | M1 | main.rs:32:1:50:1 | mod M1 | path |
62+
| main.rs:64:17:64:18 | M2 | main.rs:33:5:41:5 | mod M2 | path |
63+
| main.rs:64:21:64:21 | S | main.rs:34:9:34:21 | struct S | path |
64+
| main.rs:65:5:65:5 | s | main.rs:64:9:64:9 | s | local variable |
65+
| main.rs:65:7:65:12 | method | main.rs:37:13:39:13 | fn method | method |
66+
| main.rs:66:5:66:6 | M1 | main.rs:32:1:50:1 | mod M1 | path |
67+
| main.rs:66:9:66:10 | S2 | main.rs:43:5:43:24 | struct S2 | path |
68+
| main.rs:66:14:66:14 | S | main.rs:3:1:4:9 | struct S | path |
69+
| main.rs:66:18:66:20 | new | main.rs:46:9:48:9 | fn new | path |
70+
| main.rs:66:22:66:22 | S | main.rs:3:1:4:9 | struct S | path |
71+
| main.rs:67:6:67:6 | S | main.rs:3:1:4:9 | struct S | path |
72+
| main.rs:68:5:68:5 | S | main.rs:3:1:4:9 | struct S | path |
73+
| main.rs:68:9:68:9 | S | main.rs:3:1:4:9 | struct S | path |
74+
| main.rs:69:5:69:5 | S | main.rs:3:1:4:9 | struct S | path |

rust/ql/test/library-tests/definitions/main.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1+
use std::ops::*;
2+
3+
#[derive(Debug, Copy, Clone)]
14
struct S;
25

36
mod lib;
47

8+
impl Neg for S {
9+
type Output = Self;
10+
11+
fn neg(self) -> Self {
12+
S
13+
}
14+
}
15+
16+
impl Add for S {
17+
type Output = Self;
18+
19+
fn add(self, rhs: Self) -> Self {
20+
S
21+
}
22+
}
23+
24+
impl Index<usize> for S {
25+
type Output = S;
26+
27+
fn index(&self, index: usize) -> &Self::Output {
28+
&S
29+
}
30+
}
31+
532
mod M1 {
633
pub mod M2 {
734
pub struct S;
@@ -37,4 +64,7 @@ fn main() {
3764
let s = M1::M2::S;
3865
s.method();
3966
M1::S2::<S>::new(S);
67+
-S;
68+
S + S;
69+
S[0];
4070
}

0 commit comments

Comments
 (0)