-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[compiler] New macros using abort with message #18412
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 tasks
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
22 tasks
6e4ed8d to
a43331c
Compare
7c56a57 to
bfd3c95
Compare
cee2eb9 to
3eae191
Compare
calintat
commented
Jan 9, 2026
calintat
commented
Jan 9, 2026
830781c to
3a838c7
Compare
vineethk
reviewed
Jan 22, 2026
vineethk
reviewed
Jan 22, 2026
42b63b9 to
0dcd5e2
Compare
vineethk
approved these changes
Jan 27, 2026
Contributor
vineethk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work! Couple of minor comments, then good to go.
third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp
Show resolved
Hide resolved
b0e96be to
c420102
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
✅ Forge suite
|
Contributor
✅ Forge suite
|
Contributor
✅ Forge suite
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Description
This PR introduces new assertion macros built on top of the overloaded abort added in an earlier PR.
New
assert!formThis now supports formatted messages with arguments:
Example:
which aborts with message:
New
assert_eq!andassert_ne!macrosThese macros mirror the behaviour and ergonomics of Rust’s
assert_eq!andassert_ne!, including structured evaluation and rich error messages. There are three forms depending on the number of arguments.Two arguments
Three arguments (custom message)
More than three arguments (formatted message)
Assertion failed message format
The assertion failure message format is inspired by Rust and shows both evaluated values:
It can also include a custom message:
Updated test files
Updated 15 existing test files with reordered items, adjusted function indices, and error message changes.
Item reordering
Functions, enums, and structs repositioned in module definitions, with corresponding function index adjustments:
move-compiler-v2/tests/bytecode-generator/matching_ok.expmove-compiler-v2/tests/checking/abilities/v1/ability_constraints.expmove-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.expmove-compiler-v2/tests/checking/typing/vector_basic_cases.expmove-compiler-v2/tests/file-format-generator/struct_variants.expmove-compiler-v2/tests/file-format-generator/struct_variants.opt.expmove-compiler-v2/tests/file-format-generator/unpack_generic_struct.expmove-compiler-v2/tests/file-format-generator/unpack_generic_struct.opt.expmove-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.expmove-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.opt.expmove-compiler-v2/tests/live-var/mut_ref.expmove-compiler-v2/transactional-tests/tests/misc/round-trip/drop_ref_in_branch.decompiledmove-compiler-v2/transactional-tests/tests/misc/round-trip/drop_ref_in_branch.decompiled.baseline.expmove-compiler-v2/transactional-tests/tests/no-v1-comparison/enum/round-trip/enum_matching.decompiledError message updates
Updated assert macro error message:
move-compiler-v2/tests/checking/naming/other_builtins_invalid.expHow Has This Been Tested?
Added unit tests for all possible forms of
assert!,assert_eq!, andassert_ne!.Key Areas to Review
Type of Change
Which Components or Systems Does This Change Impact?
Checklist
Note
Introduces built-in macros expanded pre-typecheck:
assert!,assert_eq!, andassert_ne!, including formatted messages (viastring_utils::formatN) and rich failure text. Adds version gates (Move ≥2.0/2.4) and structured evaluation to avoid double evaluation.move-model/src/builder/macros.rs, including helpers to callstd::string::{utf8, into_bytes}andstd::string_utils::formatNvector,cmp,string, andstring_utils; refactors closure collectionstring::into_bytesto stdlibassert!Written by Cursor Bugbot for commit c420102. This will update automatically on new commits. Configure here.