make borrow_stdlib threadsafe

This commit is contained in:
Folkert 2022-03-11 22:49:29 +01:00
parent 01b810266b
commit 11da96b286
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -13,6 +13,16 @@ use roc_types::subs::VarId;
use roc_types::types::RecordField;
use std::collections::HashMap;
thread_local! {
static STDLIB: StdLib = standard_stdlib();
}
pub fn borrow_stdlib() -> &'static StdLib {
let ptr = STDLIB.with(|x| x as *const StdLib);
unsafe { &*ptr }
}
/// Example:
///
/// let_tvars! { a, b, c }