Stream: compiler development

Topic: glue generation error


view this post on Zulip Luke Boswell (Aug 03 2024 at 00:36):

Just poking at the issue Anton referenced in basic-cli with the debug build of the compiler.

I'm wondering how do we make progress debugging this kind of issue? these things in Mono seems a bit like black magic to me sometimes.

$ ../roc/target/debug/roc glue glue.roc crates ./platform/main.roc
thread 'main' panicked at crates/glue/src/types.rs:2225:5:
assertion `left == right` failed: glue_procs_by_layout for Layout { repr: Direct(Struct([InLayout(33), InLayout(37)])), semantic: None } was None, but the layout cache said its has_varying_stack_size was true
  left: false
 right: true
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Anton (Aug 03 2024 at 09:22):

Thanks for helping out with that Luke :)
I remember @Richard Feldman wrote that assert, so he may be able to provide the best guidance

view this post on Zulip Richard Feldman (Aug 03 2024 at 11:07):

it's been a couple years, but I think the idea here was that at this point we expect an earlier stage in the process to have added an entry in glue_procs_by_layout for this layout, but it wasn't there

view this post on Zulip Richard Feldman (Aug 03 2024 at 11:11):

poking around a bit, it looks like this is specifically for the getter/setter stuff that Folkert and I were doing to try to fix passing closures to/from the host

view this post on Zulip Richard Feldman (Aug 03 2024 at 11:14):

the current approach that we've been working on instead is to:

view this post on Zulip Richard Feldman (Aug 03 2024 at 11:14):

that eliminates the need for the whole getter/setter thing, which had lots of problems

view this post on Zulip Anton (Aug 03 2024 at 11:41):

Is there any chance that failing this assertion can lead to a segmentation fault down the line?

view this post on Zulip Richard Feldman (Aug 03 2024 at 11:52):

I think in this particular case it's more like you might get a crash in RustGlue.roc because you're trying to look something up but it's not there

view this post on Zulip Anton (Aug 13 2024 at 13:28):

just linking to this issue


Last updated: Jul 06 2025 at 12:14 UTC