File tree Expand file tree Collapse file tree 8 files changed +24
-4
lines changed Expand file tree Collapse file tree 8 files changed +24
-4
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 5
5
private import rust
6
6
private import codeql.rust.elements.internal.generated.ParentChild
7
7
private import codeql.rust.internal.CachedStages
8
- private import codeql.rust.frameworks.stdlib.Bultins as Builtins
8
+ private import codeql.rust.frameworks.stdlib.Builtins as Builtins
9
9
10
10
private newtype TNamespace =
11
11
TTypeNamespace ( ) or
@@ -374,6 +374,9 @@ class CrateItemNode extends ItemNode instanceof Crate {
374
374
not file = child .( SourceFileItemNode ) .getSuper ( ) and
375
375
file = super .getSourceFile ( )
376
376
)
377
+ or
378
+ this .getName ( ) = "core" and
379
+ child instanceof Builtins:: BuiltinType
377
380
}
378
381
379
382
override string getCanonicalPath ( Crate c ) { c = this and result = Crate .super .getName ( ) }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ private import Type as T
7
7
private import TypeMention
8
8
private import codeql.typeinference.internal.TypeInference
9
9
private import codeql.rust.frameworks.stdlib.Stdlib
10
- private import codeql.rust.frameworks.stdlib.Bultins as Builtins
10
+ private import codeql.rust.frameworks.stdlib.Builtins as Builtins
11
11
12
12
class Type = T:: Type ;
13
13
Original file line number Diff line number Diff line change 1
1
canonicalPath
2
2
| anonymous.rs:3:1:32:1 | fn canonicals | test::anonymous::canonicals |
3
3
| anonymous.rs:34:1:36:1 | fn other | test::anonymous::other |
4
+ | {EXTERNAL LOCATION} | fn trim | <core::str>::trim |
4
5
| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
5
6
| lib.rs:2:1:2:12 | mod regular | test::regular |
6
7
| regular.rs:1:1:2:18 | struct Struct | test::regular::Struct |
Original file line number Diff line number Diff line change 1
1
import rust
2
2
import TestUtils
3
+ private import codeql.rust.internal.PathResolution
4
+ private import codeql.rust.frameworks.stdlib.Builtins
3
5
4
6
query predicate canonicalPath ( Addressable a , string path ) {
5
- toBeTested ( a ) and
7
+ (
8
+ toBeTested ( a )
9
+ or
10
+ // test that we also generate canonical paths for builtins
11
+ a =
12
+ any ( ImplItemNode i |
13
+ i .resolveSelfTy ( ) instanceof Str and
14
+ not i .( Impl ) .hasTrait ( )
15
+ ) .getAnAssocItem ( ) and
16
+ a .( Function ) .getName ( ) .getText ( ) = "trim"
17
+ ) and
6
18
path = a .getCanonicalPath ( _)
7
19
}
8
20
Original file line number Diff line number Diff line change
1
+ query: canonical_paths.ql
2
+ postprocess: utils/test/ExternalLocationPostProcessing.ql
Original file line number Diff line number Diff line change 1
1
canonicalPath
2
2
| anonymous.rs:6:1:35:1 | fn canonicals | test::anonymous::canonicals |
3
3
| anonymous.rs:37:1:39:1 | fn other | test::anonymous::other |
4
+ | {EXTERNAL LOCATION} | fn trim | <core::str>::trim |
4
5
| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
5
6
| lib.rs:2:1:2:12 | mod regular | test::regular |
6
7
| regular.rs:4:1:5:18 | struct Struct | test::regular::Struct |
Original file line number Diff line number Diff line change 1
- extractor-tests/canonical_path/canonical_paths.ql
1
+ query: extractor-tests/canonical_path/canonical_paths.ql
2
+ postprocess: utils/test/ExternalLocationPostProcessing.ql
You can’t perform that action at this time.
0 commit comments