lambdaclass / concrete

Concrete is a simple programming language specifically crafted for creating highly scalable systems that are reliable, efficient, and easy to maintain.
Apache License 2.0
123 stars 11 forks source link

concrete code which should build but panics #143

Open kenarab opened 2 months ago

kenarab commented 2 months ago

Running in linear-checker branch

git checkout linear-checker
 cargo r build examples/linearExample01fail.con --check 

Included in examples but not in tests, as it is not working

mod LinearExampleStub {

    struct Linear {
        x: i32,
        y: i32,
    }

    fn main() -> i32 {
        let mut xy: Linear = 
                    Linear {
                        x: 1,
                        y: 0,
                    };
        if true { //if true because current stage of the AST does not support an anonymous block
            // xy is "consumed". _consume has Linear type and goes out of scope
            let _consume: Linear = xy;
            //FIXME this code is not compiling in concrete seems to be because a problem in lowering with variables defined inside a block
        }
        return xy.x;
    }               
}
2024-06-19T19:05:48.106908Z DEBUG concrete_driver: Output file: "/Users/kenarab/git/concrete-ab/linearExample01fail.o"
2024-06-19T19:05:48.106914Z DEBUG concrete_driver: Is library: false
2024-06-19T19:05:48.106917Z DEBUG concrete_driver: Optlevel: None
2024-06-19T19:05:48.106919Z DEBUG concrete_driver: Debug Info: Full
2024-06-19T19:05:48.107155Z DEBUG concrete_ir::lowering::prepass: running ir prepass on module DefId { program_id: 0, id: 1 }
thread 'main' panicked at crates/concrete_ir/src/lowering.rs:800:76:
no local_idx
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace