aeneas icon indicating copy to clipboard operation
aeneas copied to clipboard

Unreachable List Loop

Open Thanhson89 opened this issue 1 year ago • 0 comments

use std::borrow::Borrow;

pub enum List<T> {
    Cons(T, Box<List<T>>),
    Nil,
}

fn foo(v: &List<List<u8>>) -> Option<List<u8>> {
    if let List::Cons(h, t) = v {
        let mut t = t.borrow();
        let mut last = h;
        while let List::Cons(ht, tt) = t
        {
            last = ht;
            t = tt.borrow();
        }
        None
    }
    else {
        None
    }
}

Trigger

$ aeneas -backend lean list_cons.llbc [Info ] Imported: list_cons.llbc [Info ] Generated the partial file (because of errors): ./ListCons.lean [Error] Unreachable Source: 'src/main.rs', lines 11:8-18:5

Thanhson89 avatar Jun 27 '24 23:06 Thanhson89