Self initialization doesn't work
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing how the transpiler handles a variable initialized with its own address, using the C and generated Rust snippets in the issue as the reproducer. Identify the translation entry point and relevant tests, then check whether the generated Rust compiles; done means this self-initialization case builds successfully.
Written by the indexing model from the issue text.
Description
struct list_head {
struct list_head *next;
};
void f() {
struct list_head list = { &list };
}
compiles to:
#[derive(Default)]
pub struct list_head {
pub next: Value<Ptr<list_head>>,
}
pub fn f_0() {
let list: Value<list_head> = Rc::new(RefCell::new(list_head {
next: Rc::new(RefCell::new((list.as_pointer()))),
}));
}
which fails to build with:
error[E0425]: cannot find value `list` in this scope
--> src/main.rs:35:37
|
35 | next: Rc::new(RefCell::new((list.as_pointer()))),
| ^^^^ not found in this scope
- Dominant language
- Rust
- Stars
- 310
- Forks
- 18
- Avg merge
- 10h 18m
- Merged PRs (30d)
- 125
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from Cpp2Rust/cpp2rust
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 56/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 56/100
Maintainers usually reply within 1 day
All issues in Cpp2Rust/cpp2rust
Similar issues
-
🐞 bug 🧩 bevy_gantz_egui
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
nannou-org/gantz#500 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
metasequoiaime/msime#10989 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
fritzprix/libr-agent#2612 ·
Maintainers usually reply within 1 day
-
crate: spate-core priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NSPG13/agent-bounties#1749 ·
Maintainers usually reply within 1 day