mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
make borrow_stdlib threadsafe
This commit is contained in:
parent
01b810266b
commit
11da96b286
1 changed files with 10 additions and 0 deletions
|
@ -13,6 +13,16 @@ use roc_types::subs::VarId;
|
||||||
use roc_types::types::RecordField;
|
use roc_types::types::RecordField;
|
||||||
use std::collections::HashMap;
|
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:
|
/// Example:
|
||||||
///
|
///
|
||||||
/// let_tvars! { a, b, c }
|
/// let_tvars! { a, b, c }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue