Skip to content
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

Add line number in comments for some functions (to support Mariposa's Verus integration features) #710

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

jetline0
Copy link
Contributor

@jetline0 jetline0 commented Jul 25, 2023

This feature is intended to make it easier for Mariposa to determine the original location of unstable Verus queries from their corresponding SMT2 files.

Specifically, the additional comment is for queries labeled as Function-Defs, Function-Decl-Check-Recommends, and Function-Terminations.
Ex:

;; Function-Def main::impl_u::l1::Directory::lemma_resolve_structure_assertions
;; /home/gelatin/verified-nrkernel/page-table/impl_u/l1.rs:744:5: 744:80 (#0)

A similar comment is already present in some SMT2 files generated by Verus, but the comment only appears in queries that use the spinoff prover:
Ex:

;; MODULE 'impl_u::l2_impl'
;; /home/gelatin/verified-nrkernel/page-table/impl_u/l2_impl.rs:358:9: 358:15 (#0)

Copy link
Collaborator

@utaal utaal left a comment

Choose a reason for hiding this comment

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

This looks fine to me, modulo one hopefully minor change. Thanks!

@@ -591,7 +591,7 @@ impl Verifier {
qid_map: &HashMap<String, vir::sst::BndInfo>,
module: &vir::ast::Path,
function_name: Option<&Fun>,
comment: &str,
comment: (&str, &str),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you take the span as a new parameter instead, and stringify it here instead? This way we cannot forget to add it if we add new calls to run_commands_queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the commit below should fix this problem! Turns out commands_with_context contains the span information I needed, so no span information needs to be passed into run_commands_queries.

turns out i didn't need to take span in as a parameter; there is a span variable in the function that i can use
also prevents the "forgetting to put &span.as_string" issue
@utaal
Copy link
Collaborator

utaal commented Jul 26, 2023

Can you please run vargo fmt?

@utaal utaal merged commit a76746c into verus-lang:main Jul 27, 2023
4 checks passed
@utaal
Copy link
Collaborator

utaal commented Jul 27, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants