mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
use const
This commit is contained in:
parent
c1b5a42273
commit
b3d0c0194d
1 changed files with 6 additions and 5 deletions
|
@ -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;
|
||||||
|
|
||||||
|
const PATH: &str = env!(
|
||||||
|
"BUILTINS_BC",
|
||||||
|
"Env var BUILTINS_BC not found. Is there a problem with the build script?"
|
||||||
|
);
|
||||||
|
|
||||||
pub fn get_bytes() -> Vec<u8> {
|
pub fn get_bytes() -> Vec<u8> {
|
||||||
// In the build script for the builtins module, we compile the builtins bitcode and set
|
// In the build script for the builtins module, we compile the builtins bitcode and set
|
||||||
// BUILTINS_BC to the path to the compiled output.
|
// BUILTINS_BC to the path to the compiled output.
|
||||||
let path: &'static str = env!(
|
let mut builtins_bitcode = File::open(PATH).expect("Unable to find builtins bitcode source");
|
||||||
"BUILTINS_BC",
|
|
||||||
"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");
|
|
||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
builtins_bitcode
|
builtins_bitcode
|
||||||
.read_to_end(&mut buffer)
|
.read_to_end(&mut buffer)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue