Rust: normalize file paths for PathResolutionConsistency.ql

This commit is contained in:
Arthur Baars
2025-05-20 22:28:55 +02:00
committed by Tom Hvitved
parent 81f0e4202a
commit f093c496d5
3 changed files with 52 additions and 1 deletions

View File

@@ -5,4 +5,25 @@
* @id rust/diagnostics/path-resolution-consistency
*/
import codeql.rust.internal.PathResolutionConsistency
private import codeql.rust.internal.PathResolutionConsistency as PathResolutionConsistency
private import codeql.rust.elements.Locatable
private import codeql.Locations
import PathResolutionConsistency
class SourceLocatable instanceof Locatable {
string toString() { result = super.toString() }
Location getLocation() {
if super.getLocation().fromSource()
then result = super.getLocation()
else result instanceof EmptyLocation
}
}
query predicate multipleMethodCallTargets(SourceLocatable a, SourceLocatable b) {
PathResolutionConsistency::multipleMethodCallTargets(a, b)
}
query predicate multiplePathResolutions(SourceLocatable a, SourceLocatable b) {
PathResolutionConsistency::multiplePathResolutions(a, b)
}

View File

@@ -0,0 +1,3 @@
multipleMethodCallTargets
| web_frameworks.rs:194:30:194:74 | ... .get(...) | file://:0:0:0:0 | fn get |
| web_frameworks.rs:194:30:194:74 | ... .get(...) | file://:0:0:0:0 | fn get |

View File

@@ -0,0 +1,27 @@
multiplePathResolutions
| test.rs:50:3:50:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:50:3:50:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:55:3:55:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:55:3:55:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:60:3:60:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:60:3:60:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:65:3:65:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:65:3:65:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:73:3:73:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:73:3:73:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:78:3:78:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:78:3:78:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:87:3:87:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:87:3:87:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:94:3:94:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:94:3:94:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:128:3:128:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:128:3:128:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:139:3:139:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:139:3:139:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:144:3:144:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:144:3:144:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:150:3:150:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:150:3:150:6 | ctor | file://:0:0:0:0 | fn ctor |
| test.rs:168:3:168:6 | ctor | file://:0:0:0:0 | Crate(ctor@0.2.9) |
| test.rs:168:3:168:6 | ctor | file://:0:0:0:0 | fn ctor |