File tree 4 files changed +13
-4
lines changed
Filter options
4 files changed +13
-4
lines changed
Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ mod non_threading {
56
56
$( $( #[ $attr] ) *
57
57
$vis static $name: $crate:: static_cell:: StaticCell <$t> = {
58
58
:: std:: thread_local! {
59
- $vis static $name: $crate:: lock:: OnceCell <& ' static $t> = $crate:: lock:: OnceCell :: new( ) ;
59
+ $vis static $name: $crate:: lock:: OnceCell <& ' static $t> = const {
60
+ $crate:: lock:: OnceCell :: new( )
61
+ } ;
60
62
}
61
63
$crate:: static_cell:: StaticCell :: _from_local_key( & $name)
62
64
} ; ) +
Original file line number Diff line number Diff line change @@ -486,7 +486,10 @@ pub mod levenshtein {
486
486
487
487
pub fn levenshtein_distance ( a : & str , b : & str , max_cost : usize ) -> usize {
488
488
thread_local ! {
489
- static BUFFER : RefCell <[ usize ; MAX_STRING_SIZE ] > = const { RefCell :: new( [ 0usize ; MAX_STRING_SIZE ] ) } ;
489
+ #[ allow( clippy:: declare_interior_mutable_const) ]
490
+ static BUFFER : RefCell <[ usize ; MAX_STRING_SIZE ] > = const {
491
+ RefCell :: new( [ 0usize ; MAX_STRING_SIZE ] )
492
+ } ;
490
493
}
491
494
492
495
if a == b {
Original file line number Diff line number Diff line change @@ -355,7 +355,9 @@ pub(crate) mod _thread {
355
355
Err ( vm. new_exception_empty ( vm. ctx . exceptions . system_exit . to_owned ( ) ) )
356
356
}
357
357
358
- thread_local ! ( static SENTINELS : RefCell <Vec <PyRef <Lock >>> = RefCell :: default ( ) ) ;
358
+ thread_local ! {
359
+ static SENTINELS : RefCell <Vec <PyRef <Lock >>> = const { RefCell :: new( Vec :: new( ) ) } ;
360
+ }
359
361
360
362
#[ pyfunction]
361
363
fn _set_sentinel ( vm : & VirtualMachine ) -> PyRef < Lock > {
Original file line number Diff line number Diff line change @@ -86,7 +86,9 @@ pub fn add_init_func(f: fn(&mut VirtualMachine)) {
86
86
// https://rustwasm.github.io/2018/10/24/multithreading-rust-and-wasm.html#atomic-instructions
87
87
thread_local ! {
88
88
static STORED_VMS : RefCell <HashMap <String , Rc <StoredVirtualMachine >>> = RefCell :: default ( ) ;
89
- static VM_INIT_FUNCS : RefCell <Vec <fn ( & mut VirtualMachine ) >> = RefCell :: default ( ) ;
89
+ static VM_INIT_FUNCS : RefCell <Vec <fn ( & mut VirtualMachine ) >> = const {
90
+ RefCell :: new( Vec :: new( ) )
91
+ } ;
90
92
}
91
93
92
94
pub fn get_vm_id ( vm : & VirtualMachine ) -> & str {
You can’t perform that action at this time.
0 commit comments