Skip to content

Commit b2ad98a

Browse files
authored
Merge pull request github#18755 from hvitved/rust/type-param-to-string
Rust: Implement `TypeParam.to(Abbreviated)String`
2 parents 98c755d + 498828e commit b2ad98a

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

rust/ql/.generated.list

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/.gitattributes

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/internal/TypeParamImpl.qll

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// generated by codegen, remove this comment if you wish to edit this file
21
/**
32
* This module provides a hand-modifiable wrapper around the generated class `TypeParam`.
43
*
@@ -12,11 +11,16 @@ private import codeql.rust.elements.internal.generated.TypeParam
1211
* be referenced directly.
1312
*/
1413
module Impl {
14+
// the following QLdoc is generated: if you need to edit it, do it in the schema file
1515
/**
1616
* A TypeParam. For example:
1717
* ```rust
1818
* todo!()
1919
* ```
2020
*/
21-
class TypeParam extends Generated::TypeParam { }
21+
class TypeParam extends Generated::TypeParam {
22+
override string toAbbreviatedString() { result = this.getName().getText() }
23+
24+
override string toString() { result = this.getName().getText() }
25+
}
2226
}

rust/ql/test/extractor-tests/utf8/ast.expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| utf8_identifiers.rs:1:7:4:1 | GenericParamList |
88
| utf8_identifiers.rs:2:5:2:6 | ''\u03b2 |
99
| utf8_identifiers.rs:2:5:2:6 | LifetimeParam |
10-
| utf8_identifiers.rs:3:5:3:5 | TypeParam |
10+
| utf8_identifiers.rs:3:5:3:5 | \u03b3 |
1111
| utf8_identifiers.rs:3:5:3:5 | \u03b3 |
1212
| utf8_identifiers.rs:4:2:4:3 | ParamList |
1313
| utf8_identifiers.rs:4:5:4:6 | StmtList |

rust/ql/test/library-tests/path-resolution/path-resolution.expected

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ resolvePath
9999
| main.rs:188:19:188:32 | ...::MyStruct | main.rs:185:5:185:26 | struct MyStruct |
100100
| main.rs:190:9:190:12 | self | main.rs:184:1:192:1 | mod m9 |
101101
| main.rs:190:9:190:22 | ...::MyStruct | main.rs:185:5:185:26 | struct MyStruct |
102-
| main.rs:200:12:200:12 | T | main.rs:197:7:197:7 | TypeParam |
103-
| main.rs:205:12:205:12 | T | main.rs:204:14:204:14 | TypeParam |
102+
| main.rs:200:12:200:12 | T | main.rs:197:7:197:7 | T |
103+
| main.rs:205:12:205:12 | T | main.rs:204:14:204:14 | T |
104104
| main.rs:207:7:209:7 | MyStruct::<...> | main.rs:195:5:201:5 | struct MyStruct |
105-
| main.rs:208:9:208:9 | T | main.rs:204:14:204:14 | TypeParam |
105+
| main.rs:208:9:208:9 | T | main.rs:204:14:204:14 | T |
106106
| main.rs:211:9:211:16 | MyStruct | main.rs:195:5:201:5 | struct MyStruct |
107107
| main.rs:221:17:221:19 | Foo | main.rs:216:5:216:21 | struct Foo |
108108
| main.rs:222:9:222:11 | Foo | main.rs:218:5:218:15 | fn Foo |
@@ -115,7 +115,7 @@ resolvePath
115115
| main.rs:246:9:246:12 | ...::C | main.rs:243:9:243:9 | C |
116116
| main.rs:249:17:249:17 | S | main.rs:241:5:241:13 | struct S |
117117
| main.rs:250:17:250:17 | C | main.rs:243:9:243:9 | C |
118-
| main.rs:263:16:263:16 | T | main.rs:257:7:257:7 | TypeParam |
118+
| main.rs:263:16:263:16 | T | main.rs:257:7:257:7 | T |
119119
| main.rs:264:14:264:17 | Self | main.rs:255:5:265:5 | trait MyParamTrait |
120120
| main.rs:264:14:264:33 | ...::AssociatedType | main.rs:259:9:259:28 | TypeAlias |
121121
| main.rs:273:13:273:17 | crate | main.rs:1:1:302:2 | SourceFile |

0 commit comments

Comments
 (0)