Panic if leaving passed struct with impl to library! empty

Hi. I’m developing a text editor that uses Roto as its scripting language. The editor source code can be accessed in korbin. It’s barebones right now, but I will update it from time to time.
If I leave SetupToken empty (without any fields in it) and defined a impl for it I get this error while trying to compile roto code by running the editor

thread 'main' (4584) panicked at /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/roto-0.10.0/src/lir/lower.rs:501:41:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: roto::lir::lower::Lowerer::assign
   5: roto::lir::lower::Lowerer::program
   6: roto::lir::lower::lower_to_lir
   7: roto::pipeline::LoweredToMir<Ctx>::lower_to_lir
   8: roto::runtime::Runtime<Ctx>::compile
   9: korbin_core::script::run_config
  10: korbin::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

For test puposes (and when trying to replicate this error) you should clone the korbin source code, remove the __dummy_byte from SetupToken, compile it and try to run it.
My rustc version is rustc 1.92.0 (ded5c06cf 2025-12-08).
For anyone interested in executing the roto script too below is a example config.roto that should be placed in $HOME/korbin/config.roto:

fn setup(t: SetupToken) {
t.set_shell_access(true);
log(“Running privileged setup”);
}

fn main() {
bind(“normal”, “q”, “move_left”);

bind("normal", "w", "save");

bind("normal", "<space>re", "quit");

bind("normal", "h", "redo");

bind("normal", "k", "move_up");

bind("normal", "j", "move_down");

bind("normal", "h", "move_left");

bind("normal", "l", "move_right");

bind("normal", "i", "enter_insert");

bind("normal", "n", "search_next");

bind("normal", "N", "search_prev");

bind("normal", "/", "enter_search_forward");

bind("visual", "k", "move_up");

bind("visual", "j", "move_down");

bind("visual", "h", "move_left");

bind("visual", "l", "move_right");

bind_ctx("normal", "rust", "K", "move_up");


bind_shell_ctx("normal", "rust", "F", "cargo fmt", true);

bind_shell_ctx("normal", "latex", "<space>fn", "latexmk -cd -f -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf /home/user/Documents/mywork/main", true);

bind_shell_ctx("normal", "latex", "<space>vj", "zathura --synctex-forward {line}:{col}:{file} /home/user/Documents/mywork/main.pdf &", true);

bind_shell("normal", "<space>vv", "echo 'line: {line}, col: {col}, file: {file}'", false);

bind_shell_ctx("normal", "global", "S", "echo 'Hello from Roto Shell!'", false);

log("Running system check...");
let output = exec("uname -a");
log(f"System Info: {output}");

}

What a cool project! Keep me posted on how it goes!

I think I understand the issue. There is an assumption somewhere that registered types have a non-zero size. I’ll take a look at it. Thanks for reporting!

I’ve got a fix in this PR: #407 - Fix zero-sized registered types - NLnetLabs/roto - Codeberg.org

It’ll be part of 0.11 which we can hopefully tag pretty soon.