use const

This commit is contained in:
Folkert 2021-01-14 16:56:15 +01:00
parent c1b5a42273
commit b3d0c0194d

View file

@ -2,14 +2,15 @@ use std::fs::File;
use std::io::prelude::Read; use std::io::prelude::Read;
use std::vec::Vec; use std::vec::Vec;
pub fn get_bytes() -> Vec<u8> { const PATH: &str = env!(
// In the build script for the builtins module, we compile the builtins bitcode and set
// BUILTINS_BC to the path to the compiled output.
let path: &'static str = env!(
"BUILTINS_BC", "BUILTINS_BC",
"Env var BUILTINS_BC not found. Is there a problem with the build script?" "Env var BUILTINS_BC not found. Is there a problem with the build script?"
); );
let mut builtins_bitcode = File::open(path).expect("Unable to find builtins bitcode source");
pub fn get_bytes() -> Vec<u8> {
// In the build script for the builtins module, we compile the builtins bitcode and set
// BUILTINS_BC to the path to the compiled output.
let mut builtins_bitcode = File::open(PATH).expect("Unable to find builtins bitcode source");
let mut buffer = Vec::new(); let mut buffer = Vec::new();
builtins_bitcode builtins_bitcode
.read_to_end(&mut buffer) .read_to_end(&mut buffer)