@mpdesouza So I did a kernel workaround in .config/helix/languages.toml
:
[[language]]
name = "c"
indent = { tab-width = 8, unit = "\t" }
:-) I mean I rarely use anything else than kernel convention for any C code not a big deal… Still would be nice to have editorconfig eventually for some contribution or something.
For using compile_commands.json
with kernel this the workflow I’ve ended up with:
make ARCH=x86_64 O=./.clangd x86_64_defconfig
make ARCH=x86_64 O=./.clangd menuconfig
make ARCH=x86_64 O=./.clangd -j`nproc`
scripts/clang-tools/gen_compile_commands.py -d ./.clangd
This way it does not confuse e.g. BuildRoot when I point out my BuildRoot with LINUX_OVERRIDER_SRCDIR
to my local kernel tree. Not sure if there is better way to do this but feels like a working workflow in my case.
Nice to see some real innovation with Rust in text editors instead pwning the GPU or similar features. If you editor will not work in terminal, it will end up sucking in the end, as far as I’m consdered :-) Not minding of having also GUI but first things first…
@FSMaxB Found a pattern for my current problem that compiles and works.
Creation:
let vmctx = RwLock::new(unsafe { Arc::from_raw(vmctx_mmap.as_mut_ptr().cast::<VmCtx>()) });
Example use:
Arc::get_mut(&mut self.vmctx.write().unwrap()).unwrap().regs[reg as usize] = value;
This whole topic gained my interest because I incorrectly first used Box here. In this case Arc is the solution because it does “just drop” instead of “drop + free” (Box).
@FSMaxB This actually did not work
$ cargo b
warning: /home/jarkko/work/github.com/jarkkojs/polkavm/Cargo.toml: unused manifest key: workspace.lints.rust.unexpected_cfgs.check-cfg
Compiling polkavm v0.15.0 (/home/jarkko/work/github.com/jarkkojs/polkavm/crates/polkavm)
error[E0308]: mismatched types
--> crates/polkavm/src/sandbox/linux.rs:1596:13
|
1596 | vmctx,
| ^^^^^ expected `RwLock<VmCtx>`, found `RwLock<&mut VmCtx>`
|
= note: expected struct `RwLock<VmCtx>`
found struct `RwLock<&mut VmCtx>`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `polkavm` (lib) due to previous error
I’m sure I can solve it just putting a note in order to not spread FUD ;-)