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

"internal compiler error" while trying to implement the Fibbonaci function with memoziation. #5981

Closed
geekynils opened this issue Apr 20, 2013 · 3 comments

Comments

@geekynils
Copy link

fn memFib(n: int) -> int {
    let memo = [0, 1];
    let fib = |n: int| -> int { 
        match memo.len() as int { 
            0 .. n - 1 => memo[n],
            _          => memFib(n - 1) + memFib(n - 2)
        } 
    };
}

fn main() {
    io::println(fmt!("%d", memFib(7)));
}

$ RUST_LOG=rustc=1,::rt::backtrace rust run Fail.rs
rust: task failed at 'Bad operands for binary', /Users/nils/Develop/rust-0.6/src/librustc/middle/const_eval.rs:251
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/nils/Develop/rust-0.6/src/librustc/rustc.rc:357
rust: domain main @0x7fa4d900c210 root task failed

@jdm
Copy link
Contributor

jdm commented Apr 20, 2013

I suspect this occurs because we only handle literals and (maybe) constants in range patterns.

@jdm
Copy link
Contributor

jdm commented Apr 25, 2013

Likely the same issue as #6047.

@Aatch
Copy link
Contributor

Aatch commented Jun 7, 2013

This no longer even parses: unexpected token: 'n'

@Aatch Aatch closed this as completed Jun 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants