runtimeverification / runtimeverification/mir-semantics
Add support for `from_utf8` and string handling
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 52
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
The from_utf8 function from Rust's stdlib is currently not included in our SMIR JSON because it is not polymorphic. This function is essential for UTF-8 string conversion and will be needed for proper string support in the system.
Current Situation
from_utf8is a non-polymorphic stdlib function (source)- The function internally uses
transmute(visible in the_uncheckedversion) - String support is currently not implemented in the system
- Functions like
amount_to_ui_amountandui_amount_to_amountwill require string support
Technical Details
The from_utf8 function performs UTF-8 validation and conversion from byte arrays to strings. Since it ultimately calls transmute for the unsafe conversion, special handling may be required when implementing this in SMIR.
Tasks
- Analyze the special handling needed for
transmuteoperations infrom_utf8 - Implement string type support in SMIR
- Add
from_utf8function support - Update
amount_to_ui_amountandui_amount_to_amountto handle strings - Add appropriate test cases for string conversions
Priority
Low/Medium - Marked as non-urgent task, but will be required for full functionality
Related Components
- SMIR JSON serialization
- Standard library function support
- String type handling
- Functions:
amount_to_ui_amount,ui_amount_to_amount
References
- Rust stdlib
from_utf8source: https://doc.rust-lang.org/src/core/str/converts.rs.html#89
Labels
enhancement, stdlib-support, type-system, non-urgent
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing SMIR JSON serialization and standard library function support, then compare the Rust stdlib from_utf8 source with the handling of transmute. Review the related amount_to_ui_amount and ui_amount_to_amount functions. Done means string types, from_utf8 support, and string-conversion tests are implemented across the listed tasks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100