Skip to content

Rust: SSA inconsistency counts #19235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 8, 2025
Merged

Rust: SSA inconsistency counts #19235

merged 4 commits into from
Apr 8, 2025

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Apr 7, 2025

Provide SSA inconsistency counts:

  • precise data through existing query rust/diagnostics/ssa-consistency (which has been given metadata).
  • totals per inconsistency type through new query rust/diagnostics/ssa-consistency-counts.
  • overall totals through rust/summary/summary-statistics (via changes in Stats.qll). This data will be used by the DCA report.

This required adding a predicate getInconsistencyCounts to the shared SSA.qll, similar to the one we already have for data flow. This shouldn't be controversial as no existing shared behaviour is changed, but I'm open to suggestions / comments representing all interests of course.

@geoffw0 geoffw0 added no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code labels Apr 7, 2025
@Copilot Copilot AI review requested due to automatic review settings April 7, 2025 16:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (10)
  • rust/ql/consistency-queries/SsaConsistency.ql: Language not supported
  • rust/ql/integration-tests/hello-project/summary.expected: Language not supported
  • rust/ql/integration-tests/hello-workspace/summary.cargo.expected: Language not supported
  • rust/ql/integration-tests/hello-workspace/summary.rust-project.expected: Language not supported
  • rust/ql/src/queries/diagnostics/SsaConsistencyCounts.ql: Language not supported
  • rust/ql/src/queries/summary/Stats.qll: Language not supported
  • rust/ql/test/query-tests/diagnostics/SsaConsistencyCounts.expected: Language not supported
  • rust/ql/test/query-tests/diagnostics/SsaConsistencyCounts.qlref: Language not supported
  • rust/ql/test/query-tests/diagnostics/SummaryStatsReduced.expected: Language not supported
  • shared/ssa/codeql/ssa/Ssa.qll: Language not supported

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@@ -0,0 +1 @@
queries/diagnostics/SsaConsistencyCounts.ql

Check warning

Code scanning / CodeQL

Query test without inline test expectations Warning test

Query test does not use inline test expectations.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a diagnostic query.

hvitved
hvitved previously approved these changes Apr 7, 2025
* @id rust/diagnostics/ssa-consistency-counts
*/

private import codeql.rust.dataflow.internal.SsaImpl as SsaImpl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps just private import codeql.rust.dataflow.internal.SsaImpl::Consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That exact import causes all the query predicates in SsaImpl::Consistency to apply, breaking this query - but private import codeql.rust.dataflow.internal.SsaImpl::Consistency as SsaConsistency works and is more precise.
I've updated the query.

@geoffw0 geoffw0 merged commit 866fc6b into github:main Apr 8, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants