Rust: Skip model generation for functions with semicolon in canonical path

This commit is contained in:
Simon Friis Vindum
2025-05-15 15:22:32 +02:00
parent d66c12b7a9
commit fb8b79edbf

View File

@@ -15,9 +15,15 @@ private predicate relevant(Function api) {
// Only include functions that have a resolved path.
api.hasCrateOrigin() and
api.hasExtendedCanonicalPath() and
// A canonical path can contain `;` as the syntax for array types use `;`. For
// instance `<[Foo; 1] as Bar>::baz`. This does not work with the shared model
// generator and it is not clear if this will also be the case when we move to
// QL created canoonical paths, so for now we just exclude functions with
// `;`s.
not exists(api.getExtendedCanonicalPath().indexOf(";")) and
(
// This excludes closures (these are not exported API endpoints) and
// functions without a `pub` visiblity. A function can be `pub` without
// functions without a `pub` visibility. A function can be `pub` without
// ultimately being exported by a crate, so this is an overapproximation.
api.hasVisibility()
or