Skip to content

Support for .rs files in kmir run#1081

Merged
mariaKt merged 6 commits into
masterfrom
mk/kmir-run-rs
May 6, 2026
Merged

Support for .rs files in kmir run#1081
mariaKt merged 6 commits into
masterfrom
mk/kmir-run-rs

Conversation

@mariaKt
Copy link
Copy Markdown
Collaborator

@mariaKt mariaKt commented May 5, 2026

This PR changes the interface of kmir run to match prove, and adds to it the ability to accept .rs files directly.

  • Positional FILE argument (mandatory): Rust file by default, SMIR JSON if --smir, cargo target if --bin
  • --smir and --bin are mutually exclusive
  • --save-smir option to keep the intermediate SMIR JSON when running from .rs
  • Updated documentation in README and exec-smir README

Finally, I renamed the test_stable_mir_ui_pass.py (which uses prove) to test_stable_mir_ui_prove.py, and provided the test_stable_mir_ui_exec.py that uses run.

@mariaKt mariaKt changed the title Mk/kmir run rs Support for .rs files in kmir run May 5, 2026
@mariaKt mariaKt marked this pull request as ready for review May 5, 2026 23:05
@mariaKt mariaKt requested a review from dkcumming May 6, 2026 02:29
Copy link
Copy Markdown
Collaborator

@dkcumming dkcumming left a comment

Choose a reason for hiding this comment

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

Nice all looks great to me. I tested it and I can't find any flaws!

Comment thread kmir/src/kmir/__main__.py
case 'run':
return RunOpts(
rs_file=ns.rs_file,
start_symbol=ns.start_symbol,
Copy link
Copy Markdown
Collaborator

@dkcumming dkcumming May 6, 2026

Choose a reason for hiding this comment

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

Originally, I was thinking a run would always invoke a Rust program from the default entry point (typically main), but I tested this on sum-to-n-functions.rs and it works with start symbol of either "main" or "test_sum_to_n" which is actually quite nice. I wasn't sure what would happen if it was pointed to "sum_to_n" (since that takes arguments which we would have to somehow instantiate) but it failed with a nice error

ValueError: Cannot create concrete call configuration for sum_to_n: function has parameters

@mariaKt mariaKt merged commit 21e0aa5 into master May 6, 2026
12 checks passed
@mariaKt mariaKt deleted the mk/kmir-run-rs branch May 6, 2026 23:22
automergerpr-permission-manager Bot pushed a commit to runtimeverification/kompass that referenced this pull request May 8, 2026
This updates KMIR to [PR
1081](runtimeverification/mir-semantics#1081)
which introduces the ability to `kmir run <RUST_FILE>` instead of
needing to manually compile the `.smir.json` first. The required change
to `_kompass_run` is propagated.

---------

Co-authored-by: devops <devops@runtimeverification.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: dkcumming <daniel.cumming@runtimeverification.com>
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