Skip to content

Commit 874a2f1

Browse files
author
Paolo Tranquilli
committed
Rust: tweak canonical_path test to test resolution across files
1 parent 27fc7cd commit 874a2f1

File tree

3 files changed

+192
-189
lines changed

3 files changed

+192
-189
lines changed

rust/ql/test/extractor-tests/canonical_path/canonical_paths.expected

Lines changed: 127 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -15,146 +15,148 @@ canonicalPaths
1515
| anonymous.rs:26:5:31:5 | fn usage | None |
1616
| anonymous.rs:34:1:36:1 | fn other | ...::other |
1717
| anonymous.rs:35:5:35:23 | struct OtherStruct | None |
18-
| lib.rs:1:1:1:14 | mod anonymous | ...::anonymous |
19-
| lib.rs:2:1:2:12 | mod regular | ...::regular |
18+
| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
19+
| lib.rs:2:1:2:12 | mod regular | test::regular |
20+
| lib.rs:3:1:3:10 | mod usage | test::usage |
2021
| regular.rs:1:1:2:18 | struct Struct | ...::Struct |
2122
| regular.rs:4:1:6:1 | trait Trait | ...::Trait |
2223
| regular.rs:5:5:5:16 | fn f | ...::f |
2324
| regular.rs:8:1:10:1 | impl Trait for Struct { ... } | None |
2425
| regular.rs:9:5:9:18 | fn f | <... as ...>::f |
2526
| regular.rs:12:1:14:1 | impl Struct { ... } | None |
26-
| regular.rs:13:5:13:18 | fn g | <...>::g |
27+
| regular.rs:13:5:13:22 | fn g | <...>::g |
2728
| regular.rs:16:1:18:1 | trait TraitWithBlanketImpl | ...::TraitWithBlanketImpl |
2829
| regular.rs:17:5:17:16 | fn h | ...::h |
2930
| regular.rs:20:1:22:1 | impl TraitWithBlanketImpl for T { ... } | None |
3031
| regular.rs:21:5:21:18 | fn h | <_ as ...>::h |
31-
| regular.rs:24:1:24:12 | fn free | ...::free |
32-
| regular.rs:26:1:32:1 | fn usage | ...::usage |
33-
| regular.rs:34:1:38:1 | enum MyEnum | ...::MyEnum |
34-
| regular.rs:35:5:35:12 | Variant1 | ...::Variant1 |
35-
| regular.rs:36:5:36:19 | Variant2 | ...::Variant2 |
36-
| regular.rs:37:5:37:25 | Variant3 | ...::Variant3 |
37-
| regular.rs:40:1:46:1 | fn enum_qualified_usage | ...::enum_qualified_usage |
38-
| regular.rs:48:1:55:1 | fn enum_unqualified_usage | ...::enum_unqualified_usage |
39-
| regular.rs:51:5:51:18 | Use | None |
40-
| regular.rs:57:1:63:1 | fn enum_match | ...::enum_match |
41-
| regular.rs:65:1:67:1 | trait GenericTrait | ...::GenericTrait |
42-
| regular.rs:66:5:66:35 | fn generic_method | ...::generic_method |
43-
| regular.rs:69:1:72:1 | struct GenericStruct | ...::GenericStruct |
44-
| regular.rs:74:1:74:38 | struct GenericTupleStruct | ...::GenericTupleStruct |
45-
| regular.rs:77:1:80:1 | enum GenericEnum | ...::GenericEnum |
46-
| regular.rs:78:5:78:8 | T | ...::T |
47-
| regular.rs:79:5:79:8 | U | ...::U |
48-
| regular.rs:82:1:84:1 | impl GenericTrait::<...> for GenericStruct::<...> { ... } | None |
49-
| regular.rs:83:5:83:37 | fn generic_method | <... as ...>::generic_method |
50-
| regular.rs:86:1:88:1 | impl GenericTrait::<...> for GenericStruct::<...> { ... } | None |
51-
| regular.rs:87:5:87:39 | fn generic_method | <... as ...>::generic_method |
52-
| regular.rs:90:1:92:1 | impl GenericTrait::<...> for GenericTupleStruct::<...> { ... } | None |
53-
| regular.rs:91:5:91:37 | fn generic_method | <... as ...>::generic_method |
54-
| regular.rs:94:1:96:1 | impl GenericTrait::<...> for GenericTupleStruct::<...> { ... } | None |
55-
| regular.rs:95:5:95:39 | fn generic_method | <... as ...>::generic_method |
56-
| regular.rs:98:1:100:1 | impl GenericTrait::<...> for GenericEnum::<...> { ... } | None |
57-
| regular.rs:99:5:99:37 | fn generic_method | <... as ...>::generic_method |
58-
| regular.rs:102:1:104:1 | impl GenericTrait::<...> for GenericEnum::<...> { ... } | None |
59-
| regular.rs:103:5:103:39 | fn generic_method | <... as ...>::generic_method |
60-
| regular.rs:106:1:119:1 | fn generic_usage | ...::generic_usage |
61-
| regular.rs:121:1:123:1 | impl Trait for ... { ... } | None |
62-
| regular.rs:122:5:122:18 | fn f | <... as ...>::f |
63-
| regular.rs:125:1:127:1 | impl Trait for ... { ... } | None |
64-
| regular.rs:126:5:126:18 | fn f | <... as ...>::f |
65-
| regular.rs:129:1:131:1 | impl Trait for ... { ... } | None |
66-
| regular.rs:130:5:130:18 | fn f | <... as ...>::f |
67-
| regular.rs:133:1:135:1 | impl Trait for ... { ... } | None |
68-
| regular.rs:134:5:134:18 | fn f | <... as ...>::f |
69-
| regular.rs:137:1:139:1 | impl Trait for ... { ... } | None |
70-
| regular.rs:138:5:138:18 | fn f | <... as ...>::f |
71-
| regular.rs:141:1:147:1 | fn use_trait | ...::use_trait |
72-
| regular.rs:144:5:144:17 | vec!... | None |
32+
| regular.rs:24:1:24:16 | fn free | ...::free |
33+
| regular.rs:26:1:30:1 | enum MyEnum | ...::MyEnum |
34+
| regular.rs:27:5:27:12 | Variant1 | ...::Variant1 |
35+
| regular.rs:28:5:28:19 | Variant2 | ...::Variant2 |
36+
| regular.rs:29:5:29:25 | Variant3 | ...::Variant3 |
37+
| regular.rs:32:1:34:1 | trait GenericTrait | ...::GenericTrait |
38+
| regular.rs:33:5:33:35 | fn generic_method | ...::generic_method |
39+
| regular.rs:36:1:39:1 | struct GenericStruct | ...::GenericStruct |
40+
| regular.rs:41:1:41:50 | struct GenericTupleStruct | ...::GenericTupleStruct |
41+
| regular.rs:44:1:47:1 | enum GenericEnum | ...::GenericEnum |
42+
| regular.rs:45:5:45:8 | T | ...::T |
43+
| regular.rs:46:5:46:8 | U | ...::U |
44+
| regular.rs:49:1:51:1 | impl GenericTrait::<...> for GenericStruct::<...> { ... } | None |
45+
| regular.rs:50:5:50:37 | fn generic_method | <... as ...>::generic_method |
46+
| regular.rs:53:1:55:1 | impl GenericTrait::<...> for GenericStruct::<...> { ... } | None |
47+
| regular.rs:54:5:54:39 | fn generic_method | <... as ...>::generic_method |
48+
| regular.rs:57:1:59:1 | impl GenericTrait::<...> for GenericTupleStruct::<...> { ... } | None |
49+
| regular.rs:58:5:58:37 | fn generic_method | <... as ...>::generic_method |
50+
| regular.rs:61:1:63:1 | impl GenericTrait::<...> for GenericTupleStruct::<...> { ... } | None |
51+
| regular.rs:62:5:62:39 | fn generic_method | <... as ...>::generic_method |
52+
| regular.rs:65:1:67:1 | impl GenericTrait::<...> for GenericEnum::<...> { ... } | None |
53+
| regular.rs:66:5:66:37 | fn generic_method | <... as ...>::generic_method |
54+
| regular.rs:69:1:71:1 | impl GenericTrait::<...> for GenericEnum::<...> { ... } | None |
55+
| regular.rs:70:5:70:39 | fn generic_method | <... as ...>::generic_method |
56+
| regular.rs:73:1:75:1 | impl Trait for ... { ... } | None |
57+
| regular.rs:74:5:74:18 | fn f | <... as ...>::f |
58+
| regular.rs:77:1:79:1 | impl Trait for ... { ... } | None |
59+
| regular.rs:78:5:78:18 | fn f | <... as ...>::f |
60+
| regular.rs:81:1:83:1 | impl Trait for ... { ... } | None |
61+
| regular.rs:82:5:82:18 | fn f | <... as ...>::f |
62+
| regular.rs:85:1:87:1 | impl Trait for ... { ... } | None |
63+
| regular.rs:86:5:86:18 | fn f | <... as ...>::f |
64+
| regular.rs:89:1:91:1 | impl Trait for ... { ... } | None |
65+
| regular.rs:90:5:90:18 | fn f | <... as ...>::f |
66+
| usage.rs:1:1:1:22 | Use | None |
67+
| usage.rs:3:1:9:1 | fn usage | ...::usage |
68+
| usage.rs:11:1:17:1 | fn enum_qualified_usage | ...::enum_qualified_usage |
69+
| usage.rs:19:1:26:1 | fn enum_unqualified_usage | ...::enum_unqualified_usage |
70+
| usage.rs:22:5:22:18 | Use | None |
71+
| usage.rs:28:1:34:1 | fn enum_match | ...::enum_match |
72+
| usage.rs:36:1:49:1 | fn generic_usage | ...::generic_usage |
73+
| usage.rs:51:1:57:1 | fn use_trait | ...::use_trait |
74+
| usage.rs:54:5:54:17 | vec!... | None |
7375
resolvedPaths
7476
| anonymous.rs:27:17:27:30 | OtherStruct {...} | None |
7577
| anonymous.rs:28:9:28:9 | s | None |
7678
| anonymous.rs:28:9:28:13 | ... .f(...) | None |
7779
| anonymous.rs:29:9:29:9 | s | None |
7880
| anonymous.rs:29:9:29:13 | ... .g(...) | None |
7981
| anonymous.rs:30:9:30:14 | nested | None |
80-
| regular.rs:27:13:27:21 | Struct {...} | ...::Struct |
81-
| regular.rs:28:5:28:5 | s | None |
82-
| regular.rs:28:5:28:9 | ... .f(...) | <... as ...>::f |
83-
| regular.rs:29:5:29:5 | s | None |
84-
| regular.rs:29:5:29:9 | ... .g(...) | <...>::g |
85-
| regular.rs:30:5:30:5 | s | None |
86-
| regular.rs:30:5:30:9 | ... .h(...) | <_ as ...>::h |
87-
| regular.rs:31:5:31:8 | free | ...::free |
88-
| regular.rs:41:9:41:26 | ...::None::<...> | ...::None |
89-
| regular.rs:42:9:42:20 | ...::Some | ...::Some |
90-
| regular.rs:43:9:43:24 | ...::Variant1 | ...::Variant1 |
91-
| regular.rs:44:9:44:24 | ...::Variant2 | ...::Variant2 |
92-
| regular.rs:45:9:45:33 | ...::Variant3 {...} | ...::Variant3 |
93-
| regular.rs:49:9:49:18 | None::<...> | ...::None |
94-
| regular.rs:50:9:50:12 | Some | ...::Some |
95-
| regular.rs:52:9:52:16 | Variant1 | ...::Variant1 |
96-
| regular.rs:53:9:53:16 | Variant2 | ...::Variant2 |
97-
| regular.rs:54:9:54:25 | Variant3 {...} | ...::Variant3 |
98-
| regular.rs:58:11:58:11 | e | None |
99-
| regular.rs:59:9:59:24 | ...::Variant1 | ...::Variant1 |
100-
| regular.rs:60:9:60:27 | ...::Variant2(...) | ...::Variant2 |
101-
| regular.rs:61:9:61:31 | ...::Variant3 {...} | ...::Variant3 |
102-
| regular.rs:107:13:107:41 | GenericStruct {...} | ...::GenericStruct |
103-
| regular.rs:108:5:108:5 | x | None |
104-
| regular.rs:108:5:108:26 | ... .generic_method(...) | <... as ...>::generic_method |
105-
| regular.rs:109:13:109:47 | GenericStruct {...} | ...::GenericStruct |
106-
| regular.rs:110:5:110:5 | x | None |
107-
| regular.rs:110:5:110:23 | ... .generic_method(...) | <... as ...>::generic_method |
108-
| regular.rs:111:13:111:30 | GenericTupleStruct | ...::GenericTupleStruct |
109-
| regular.rs:112:5:112:5 | x | None |
110-
| regular.rs:112:5:112:26 | ... .generic_method(...) | <... as ...>::generic_method |
111-
| regular.rs:113:13:113:30 | GenericTupleStruct | ...::GenericTupleStruct |
112-
| regular.rs:114:5:114:5 | x | None |
113-
| regular.rs:114:5:114:23 | ... .generic_method(...) | <... as ...>::generic_method |
114-
| regular.rs:115:13:115:37 | ...::T | ...::T |
115-
| regular.rs:116:5:116:5 | x | None |
116-
| regular.rs:116:5:116:27 | ... .generic_method(...) | <... as ...>::generic_method |
117-
| regular.rs:117:13:117:37 | ...::U | ...::U |
118-
| regular.rs:118:5:118:5 | x | None |
119-
| regular.rs:118:5:118:23 | ... .generic_method(...) | <... as ...>::generic_method |
120-
| regular.rs:142:5:142:10 | ... .f(...) | <... as ...>::f |
121-
| regular.rs:143:5:143:15 | ... .f(...) | <... as ...>::f |
122-
| regular.rs:144:5:144:17 | ...::into_vec | <...>::into_vec |
123-
| regular.rs:144:5:144:17 | ...::new | None |
124-
| regular.rs:144:5:144:28 | ... .as_slice(...) | <...>::as_slice |
125-
| regular.rs:144:5:144:32 | ... .f(...) | <... as ...>::f |
126-
| regular.rs:145:5:145:16 | ... .f(...) | <... as ...>::f |
127-
| regular.rs:146:5:146:20 | ... .f(...) | <... as ...>::f |
82+
| usage.rs:4:13:4:21 | Struct {...} | ...::Struct |
83+
| usage.rs:5:5:5:5 | s | None |
84+
| usage.rs:5:5:5:9 | ... .f(...) | <... as ...>::f |
85+
| usage.rs:6:5:6:5 | s | None |
86+
| usage.rs:6:5:6:9 | ... .g(...) | <...>::g |
87+
| usage.rs:7:5:7:5 | s | None |
88+
| usage.rs:7:5:7:9 | ... .h(...) | <_ as ...>::h |
89+
| usage.rs:8:5:8:8 | free | ...::free |
90+
| usage.rs:12:9:12:26 | ...::None::<...> | ...::None |
91+
| usage.rs:13:9:13:20 | ...::Some | ...::Some |
92+
| usage.rs:14:9:14:24 | ...::Variant1 | ...::Variant1 |
93+
| usage.rs:15:9:15:24 | ...::Variant2 | ...::Variant2 |
94+
| usage.rs:16:9:16:33 | ...::Variant3 {...} | ...::Variant3 |
95+
| usage.rs:20:9:20:18 | None::<...> | ...::None |
96+
| usage.rs:21:9:21:12 | Some | ...::Some |
97+
| usage.rs:23:9:23:16 | Variant1 | ...::Variant1 |
98+
| usage.rs:24:9:24:16 | Variant2 | ...::Variant2 |
99+
| usage.rs:25:9:25:25 | Variant3 {...} | ...::Variant3 |
100+
| usage.rs:29:11:29:11 | e | None |
101+
| usage.rs:30:9:30:24 | ...::Variant1 | ...::Variant1 |
102+
| usage.rs:31:9:31:27 | ...::Variant2(...) | ...::Variant2 |
103+
| usage.rs:32:9:32:31 | ...::Variant3 {...} | ...::Variant3 |
104+
| usage.rs:37:13:37:41 | GenericStruct {...} | ...::GenericStruct |
105+
| usage.rs:38:5:38:5 | x | None |
106+
| usage.rs:38:5:38:26 | ... .generic_method(...) | <... as ...>::generic_method |
107+
| usage.rs:39:13:39:47 | GenericStruct {...} | ...::GenericStruct |
108+
| usage.rs:40:5:40:5 | x | None |
109+
| usage.rs:40:5:40:23 | ... .generic_method(...) | <... as ...>::generic_method |
110+
| usage.rs:41:13:41:30 | GenericTupleStruct | ...::GenericTupleStruct |
111+
| usage.rs:42:5:42:5 | x | None |
112+
| usage.rs:42:5:42:26 | ... .generic_method(...) | <... as ...>::generic_method |
113+
| usage.rs:43:13:43:30 | GenericTupleStruct | ...::GenericTupleStruct |
114+
| usage.rs:44:5:44:5 | x | None |
115+
| usage.rs:44:5:44:23 | ... .generic_method(...) | <... as ...>::generic_method |
116+
| usage.rs:45:13:45:37 | ...::T | ...::T |
117+
| usage.rs:46:5:46:5 | x | None |
118+
| usage.rs:46:5:46:27 | ... .generic_method(...) | <... as ...>::generic_method |
119+
| usage.rs:47:13:47:37 | ...::U | ...::U |
120+
| usage.rs:48:5:48:5 | x | None |
121+
| usage.rs:48:5:48:23 | ... .generic_method(...) | <... as ...>::generic_method |
122+
| usage.rs:52:5:52:10 | ... .f(...) | <... as ...>::f |
123+
| usage.rs:53:5:53:15 | ... .f(...) | <... as ...>::f |
124+
| usage.rs:54:5:54:17 | ...::into_vec | <...>::into_vec |
125+
| usage.rs:54:5:54:17 | ...::new | None |
126+
| usage.rs:54:5:54:28 | ... .as_slice(...) | <...>::as_slice |
127+
| usage.rs:54:5:54:32 | ... .f(...) | <... as ...>::f |
128+
| usage.rs:55:5:55:16 | ... .f(...) | <... as ...>::f |
129+
| usage.rs:56:5:56:20 | ... .f(...) | <... as ...>::f |
128130
resolve
129-
| regular.rs:27:13:27:21 | Struct {...} | regular.rs:1:1:2:18 | struct Struct |
130-
| regular.rs:28:5:28:9 | ... .f(...) | regular.rs:9:5:9:18 | fn f |
131-
| regular.rs:29:5:29:9 | ... .g(...) | anonymous.rs:15:9:15:22 | fn g |
132-
| regular.rs:29:5:29:9 | ... .g(...) | regular.rs:13:5:13:18 | fn g |
133-
| regular.rs:30:5:30:9 | ... .h(...) | regular.rs:21:5:21:18 | fn h |
134-
| regular.rs:31:5:31:8 | free | regular.rs:24:1:24:12 | fn free |
135-
| regular.rs:43:9:43:24 | ...::Variant1 | regular.rs:35:5:35:12 | Variant1 |
136-
| regular.rs:44:9:44:24 | ...::Variant2 | regular.rs:36:5:36:19 | Variant2 |
137-
| regular.rs:45:9:45:33 | ...::Variant3 {...} | regular.rs:37:5:37:25 | Variant3 |
138-
| regular.rs:52:9:52:16 | Variant1 | regular.rs:35:5:35:12 | Variant1 |
139-
| regular.rs:53:9:53:16 | Variant2 | regular.rs:36:5:36:19 | Variant2 |
140-
| regular.rs:54:9:54:25 | Variant3 {...} | regular.rs:37:5:37:25 | Variant3 |
141-
| regular.rs:59:9:59:24 | ...::Variant1 | regular.rs:35:5:35:12 | Variant1 |
142-
| regular.rs:60:9:60:27 | ...::Variant2(...) | regular.rs:36:5:36:19 | Variant2 |
143-
| regular.rs:61:9:61:31 | ...::Variant3 {...} | regular.rs:37:5:37:25 | Variant3 |
144-
| regular.rs:107:13:107:41 | GenericStruct {...} | regular.rs:69:1:72:1 | struct GenericStruct |
145-
| regular.rs:108:5:108:26 | ... .generic_method(...) | regular.rs:83:5:83:37 | fn generic_method |
146-
| regular.rs:109:13:109:47 | GenericStruct {...} | regular.rs:69:1:72:1 | struct GenericStruct |
147-
| regular.rs:110:5:110:23 | ... .generic_method(...) | regular.rs:87:5:87:39 | fn generic_method |
148-
| regular.rs:111:13:111:30 | GenericTupleStruct | regular.rs:74:1:74:38 | struct GenericTupleStruct |
149-
| regular.rs:112:5:112:26 | ... .generic_method(...) | regular.rs:91:5:91:37 | fn generic_method |
150-
| regular.rs:113:13:113:30 | GenericTupleStruct | regular.rs:74:1:74:38 | struct GenericTupleStruct |
151-
| regular.rs:114:5:114:23 | ... .generic_method(...) | regular.rs:95:5:95:39 | fn generic_method |
152-
| regular.rs:115:13:115:37 | ...::T | regular.rs:78:5:78:8 | T |
153-
| regular.rs:116:5:116:27 | ... .generic_method(...) | regular.rs:99:5:99:37 | fn generic_method |
154-
| regular.rs:117:13:117:37 | ...::U | regular.rs:79:5:79:8 | U |
155-
| regular.rs:118:5:118:23 | ... .generic_method(...) | regular.rs:103:5:103:39 | fn generic_method |
156-
| regular.rs:142:5:142:10 | ... .f(...) | regular.rs:122:5:122:18 | fn f |
157-
| regular.rs:143:5:143:15 | ... .f(...) | regular.rs:126:5:126:18 | fn f |
158-
| regular.rs:144:5:144:32 | ... .f(...) | regular.rs:130:5:130:18 | fn f |
159-
| regular.rs:145:5:145:16 | ... .f(...) | regular.rs:134:5:134:18 | fn f |
160-
| regular.rs:146:5:146:20 | ... .f(...) | regular.rs:138:5:138:18 | fn f |
131+
| usage.rs:4:13:4:21 | Struct {...} | regular.rs:1:1:2:18 | struct Struct |
132+
| usage.rs:5:5:5:9 | ... .f(...) | regular.rs:9:5:9:18 | fn f |
133+
| usage.rs:6:5:6:9 | ... .g(...) | anonymous.rs:15:9:15:22 | fn g |
134+
| usage.rs:6:5:6:9 | ... .g(...) | regular.rs:13:5:13:22 | fn g |
135+
| usage.rs:7:5:7:9 | ... .h(...) | regular.rs:21:5:21:18 | fn h |
136+
| usage.rs:8:5:8:8 | free | regular.rs:24:1:24:16 | fn free |
137+
| usage.rs:14:9:14:24 | ...::Variant1 | regular.rs:27:5:27:12 | Variant1 |
138+
| usage.rs:15:9:15:24 | ...::Variant2 | regular.rs:28:5:28:19 | Variant2 |
139+
| usage.rs:16:9:16:33 | ...::Variant3 {...} | regular.rs:29:5:29:25 | Variant3 |
140+
| usage.rs:23:9:23:16 | Variant1 | regular.rs:27:5:27:12 | Variant1 |
141+
| usage.rs:24:9:24:16 | Variant2 | regular.rs:28:5:28:19 | Variant2 |
142+
| usage.rs:25:9:25:25 | Variant3 {...} | regular.rs:29:5:29:25 | Variant3 |
143+
| usage.rs:30:9:30:24 | ...::Variant1 | regular.rs:27:5:27:12 | Variant1 |
144+
| usage.rs:31:9:31:27 | ...::Variant2(...) | regular.rs:28:5:28:19 | Variant2 |
145+
| usage.rs:32:9:32:31 | ...::Variant3 {...} | regular.rs:29:5:29:25 | Variant3 |
146+
| usage.rs:37:13:37:41 | GenericStruct {...} | regular.rs:36:1:39:1 | struct GenericStruct |
147+
| usage.rs:38:5:38:26 | ... .generic_method(...) | regular.rs:50:5:50:37 | fn generic_method |
148+
| usage.rs:39:13:39:47 | GenericStruct {...} | regular.rs:36:1:39:1 | struct GenericStruct |
149+
| usage.rs:40:5:40:23 | ... .generic_method(...) | regular.rs:54:5:54:39 | fn generic_method |
150+
| usage.rs:41:13:41:30 | GenericTupleStruct | regular.rs:41:1:41:50 | struct GenericTupleStruct |
151+
| usage.rs:42:5:42:26 | ... .generic_method(...) | regular.rs:58:5:58:37 | fn generic_method |
152+
| usage.rs:43:13:43:30 | GenericTupleStruct | regular.rs:41:1:41:50 | struct GenericTupleStruct |
153+
| usage.rs:44:5:44:23 | ... .generic_method(...) | regular.rs:62:5:62:39 | fn generic_method |
154+
| usage.rs:45:13:45:37 | ...::T | regular.rs:45:5:45:8 | T |
155+
| usage.rs:46:5:46:27 | ... .generic_method(...) | regular.rs:66:5:66:37 | fn generic_method |
156+
| usage.rs:47:13:47:37 | ...::U | regular.rs:46:5:46:8 | U |
157+
| usage.rs:48:5:48:23 | ... .generic_method(...) | regular.rs:70:5:70:39 | fn generic_method |
158+
| usage.rs:52:5:52:10 | ... .f(...) | regular.rs:74:5:74:18 | fn f |
159+
| usage.rs:53:5:53:15 | ... .f(...) | regular.rs:78:5:78:18 | fn f |
160+
| usage.rs:54:5:54:32 | ... .f(...) | regular.rs:82:5:82:18 | fn f |
161+
| usage.rs:55:5:55:16 | ... .f(...) | regular.rs:86:5:86:18 | fn f |
162+
| usage.rs:56:5:56:20 | ... .f(...) | regular.rs:90:5:90:18 | fn f |

rust/ql/test/extractor-tests/canonical_path/regular.rs

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,38 @@ impl Trait for Struct {
1010
}
1111

1212
impl Struct {
13-
fn g(&self) {}
13+
pub fn g(&self) {}
1414
}
1515

16-
trait TraitWithBlanketImpl {
16+
pub trait TraitWithBlanketImpl {
1717
fn h(&self);
1818
}
1919

2020
impl<T: Eq> TraitWithBlanketImpl for T {
2121
fn h(&self) {}
2222
}
2323

24-
fn free() {}
24+
pub fn free() {}
2525

26-
fn usage() {
27-
let s = Struct {};
28-
s.f();
29-
s.g();
30-
s.h();
31-
free();
32-
}
33-
34-
enum MyEnum {
26+
pub enum MyEnum {
3527
Variant1,
3628
Variant2(usize),
3729
Variant3 { x: usize },
3830
}
3931

40-
fn enum_qualified_usage() {
41-
_ = Option::None::<()>;
42-
_ = Option::Some(0);
43-
_ = MyEnum::Variant1;
44-
_ = MyEnum::Variant2(0);
45-
_ = MyEnum::Variant3 { x: 1 };
46-
}
47-
48-
fn enum_unqualified_usage() {
49-
_ = None::<()>;
50-
_ = Some(0);
51-
use MyEnum::*;
52-
_ = Variant1;
53-
_ = Variant2(0);
54-
_ = Variant3 { x: 1 };
55-
}
56-
57-
fn enum_match(e: MyEnum) {
58-
match e {
59-
MyEnum::Variant1 => {}
60-
MyEnum::Variant2(_) => {}
61-
MyEnum::Variant3 { .. } => {}
62-
}
63-
}
64-
65-
trait GenericTrait<T> {
32+
pub trait GenericTrait<T> {
6633
fn generic_method(&self, t: T);
6734
}
6835

69-
struct GenericStruct<T, U> {
36+
pub struct GenericStruct<T, U> {
7037
pub t: T,
7138
pub u: U,
7239
}
7340

74-
struct GenericTupleStruct<T, U>(T, U);
41+
pub struct GenericTupleStruct<T, U>(pub T, pub U);
7542

7643

77-
enum GenericEnum<T, U> {
44+
pub enum GenericEnum<T, U> {
7845
T(T),
7946
U(U),
8047
}
@@ -103,21 +70,6 @@ impl GenericTrait<i32> for GenericEnum<&str, i32> {
10370
fn generic_method(&self, t: i32) {}
10471
}
10572

106-
fn generic_usage() {
107-
let x = GenericStruct { t: 0, u: "" };
108-
x.generic_method("hi");
109-
let x = GenericStruct { t: "hello", u: 42 };
110-
x.generic_method(0);
111-
let x = GenericTupleStruct(0, "");
112-
x.generic_method("hi");
113-
let x = GenericTupleStruct("hello", 42);
114-
x.generic_method(0);
115-
let x = GenericEnum::<_, &str>::T(0);
116-
x.generic_method("hey");
117-
let x = GenericEnum::<&str, _>::U(0);
118-
x.generic_method(1);
119-
}
120-
12173
impl Trait for () {
12274
fn f(&self) {}
12375
}
@@ -137,11 +89,3 @@ impl Trait for [&str; 2] {
13789
impl Trait for [&str; 3] {
13890
fn f(&self) {}
13991
}
140-
141-
fn use_trait() {
142-
().f();
143-
(0, "").f();
144-
vec![0, 1, 2].as_slice().f();
145-
["", ""].f();
146-
["", "", ""].f();
147-
}

0 commit comments

Comments
 (0)