File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree File renamed without changes.
Original file line number Diff line number Diff line change 55private import rust
66private import codeql.rust.elements.internal.generated.ParentChild
77private 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
99
1010private newtype TNamespace =
1111 TTypeNamespace ( ) or
@@ -374,6 +374,9 @@ class CrateItemNode extends ItemNode instanceof Crate {
374374 not file = child .( SourceFileItemNode ) .getSuper ( ) and
375375 file = super .getSourceFile ( )
376376 )
377+ or
378+ this .getName ( ) = "core" and
379+ child instanceof Builtins:: BuiltinType
377380 }
378381
379382 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
77private import TypeMention
88private import codeql.typeinference.internal.TypeInference
99private 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
1111
1212class Type = T:: Type ;
1313
Original file line number Diff line number Diff line change 11canonicalPath
22| anonymous.rs:3:1:32:1 | fn canonicals | test::anonymous::canonicals |
33| anonymous.rs:34:1:36:1 | fn other | test::anonymous::other |
4+ | {EXTERNAL LOCATION} | fn trim | <core::str>::trim |
45| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
56| lib.rs:2:1:2:12 | mod regular | test::regular |
67| regular.rs:1:1:2:18 | struct Struct | test::regular::Struct |
Original file line number Diff line number Diff line change 11import rust
22import TestUtils
3+ private import codeql.rust.internal.PathResolution
4+ private import codeql.rust.frameworks.stdlib.Builtins
35
46query 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
618 path = a .getCanonicalPath ( _)
719}
820
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 11canonicalPath
22| anonymous.rs:6:1:35:1 | fn canonicals | test::anonymous::canonicals |
33| anonymous.rs:37:1:39:1 | fn other | test::anonymous::other |
4+ | {EXTERNAL LOCATION} | fn trim | <core::str>::trim |
45| lib.rs:1:1:1:14 | mod anonymous | test::anonymous |
56| lib.rs:2:1:2:12 | mod regular | test::regular |
67| 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