runtimeverification / runtimeverification/stable-mir-json
Getting wrong type ID `0` for allocs used as fields of single-variant enum
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 11
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
This surfaced in a test of mir-semantics. Originally posted by @jberthold in https://github.com/runtimeverification/mir-semantics/issues/729#issuecomment-3383544004
enum-two-refs-fail.rs
#[derive(PartialEq, Debug)]
enum Thing<'a> {
Thing( &'a i16, &'a u16)
}
#[derive(PartialEq, Debug)]
struct Another<'a>(&'a i32, &'a u32);
fn main() {
assert_eq!(Thing::Thing(&1, &2), Thing::Thing(&1, &2));
assert_eq!(Another(&1, &2), Another(&1, &2));
println!("All assertions passed");
}
the file enum-two-refs-fail.smir.json features ty(0) as the (data) type of four allocations, but also uses 0 as the ID for function lang_start_internal.
From inspecting the data: these allocs 10-13 are referenced from other allocs (1 references 10 and 11, 2 references 12 and 13), and 1 and 2 are of type Thing<'_> , so 10 and 12 should actually just be i16, 11 and 13 should be u16, but they aren't for some reason.
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 with kmir/src/tests/integration/data/exec-smir/allocs/enum-two-refs-fail.smir.json, especially allocations 10–13 and the lang_start_internal entry. Trace how the referenced allocations receive their type IDs and how function ID 0 is represented. Done means the allocations have the expected i16 and u16 types without conflicting with the function ID, with the integration data test passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100