edit icon indicating copy to clipboard operation
edit copied to clipboard

Redox OS Port: Refcell already borrowed

Open willnode opened this issue 2 months ago • 1 comments

Hello! I tried to port edit into Redox, and it's compiling well! Interestingly, I got edit crashed at startup.

I look deeper and stumble upon cell.rs, I went to comment out all release scope in that and now it shown this:

thread 'main' (1) panicked at src/tui.rs:773:33:
Refcell already borrowed

Given the same code runs well on Linux I think this is a problem into rust compiler on Redox itself. But I unable to isolate the problem into a simple test.

The code crashed around src/tui.rs:773 and it crashed the first time it hit this code, and I also unable to work around it.

I would like either having a minimal reproducible code around it, or maybe some insight into this problem. I think actually trying to solve this will be hard (I don't know who borrows it?) and I understand the OS is not in your supported target at this time.

willnode avatar Oct 09 '25 04:10 willnode

That's curious... Since most code is platform-independent, and the TUI code certainly is, it makes this issue highly suspicious. Could this perhaps be some sort of UB? I think it's somewhat likely.

You could add a .cargo/config.toml with the following contents (untested - off the top of my head):

[unstable]
build-std = ["std"]
build-std-features = ["default", "debug_refcell"]

This should build the stdlib with debug_refcell and tell us which place is holding the RefCell.

lhecker avatar Oct 13 '25 13:10 lhecker