Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Program creating nested Box panics during compilation #5967

Closed
bmmoore opened this issue Jul 4, 2024 · 0 comments · Fixed by #5968
Closed

bug: Program creating nested Box panics during compilation #5967

bmmoore opened this issue Jul 4, 2024 · 0 comments · Fixed by #5968
Labels
bug Something isn't working

Comments

@bmmoore
Copy link

bmmoore commented Jul 4, 2024

Bug Report

Cairo version: 2.7.0-rc.0

Current behavior:
Compiling the code below panics:

thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-sierra-generator-2.7.0-rc.0/src/utils.rs:220:21:
internal error: entered unreachable code: Should be handled by `const_libfunc_id_by_type`.

Expected behavior:

Steps to reproduce:

Compile the code below. I was using scarb build with it as src/lib.cairo.

Related code:

pub enum Pattern { Leaf, Boxed: Box<Pattern> }
pub fn boxed(pat: Pattern) -> Pattern {
    return Pattern::Boxed(BoxTrait::new(pat));
}
pub fn a() -> Pattern { return boxed(Pattern::Leaf); }
pub fn b() -> Pattern { return boxed(a()); }

Other information:

This is quite similar to #5411 and the compile-time example I posted there. The difference is just that the code is split across more functions, and it wasn't fixed by PR #5416.
The workaround described there works, or also just tagging a with #[inline(never)].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant