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: Compile panics with assertion failed: aq.cycle.is_none() #6524

Open
maciektr opened this issue Oct 26, 2024 · 0 comments
Open

bug: Compile panics with assertion failed: aq.cycle.is_none() #6524

maciektr opened this issue Oct 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@maciektr
Copy link
Collaborator

Bug Report

Cairo version:

v2.8.4 or current main
Tested with both Scarb and Cairo binary

Current behavior:

Panic on specific input with:

thread 'main' panicked at /Users/maciektr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rust-analyzer-salsa-0.17.0-pre.6/src/runtime.rs:341:21:
assertion failed: aq.cycle.is_none()

Expected behavior:

No panic.

Steps to reproduce:

Try to compile following snippet

Related code:

fn main() -> u32 {
    fib(16)
}

fn fib(mut n: u32) -> u32 {
    let mut a: u32 = 0;
    let mut b: u32 = 1;
    while n != 0 {
        n = n - 1;
        let temp = b;
        b = a + b;
        a = temp;
    };
    a
}

trait Trait1<T> {
    fn x(self: @T) -> u256;
}
struct Wrapped<T, +Trait1<T>> {
    s: T
}
impl Trait1Wrapped<T, +Trait1<T>> of Trait1<Wrapped<T>> {
}

#[cfg(test)]
mod tests {
    use super::fib;

    #[test]
    fn it_works() {
        assert(fib(16) == 987, 'it works!');
    }
}

Other information:

Originally reported on discord: https://discord.com/channels/793094838509764618/1270121041116794962/1299456003758231563

@maciektr maciektr added the bug Something isn't working label Oct 26, 2024
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

No branches or pull requests

1 participant