File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ mod non_threading {
5656 $( $( #[ $attr] ) *
5757 $vis static $name: $crate:: static_cell:: StaticCell <$t> = {
5858 :: 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+ } ;
6062 }
6163 $crate:: static_cell:: StaticCell :: _from_local_key( & $name)
6264 } ; ) +
Original file line number Diff line number Diff line change @@ -486,7 +486,10 @@ pub mod levenshtein {
486486
487487 pub fn levenshtein_distance ( a : & str , b : & str , max_cost : usize ) -> usize {
488488 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+ } ;
490493 }
491494
492495 if a == b {
Original file line number Diff line number Diff line change @@ -355,7 +355,9 @@ pub(crate) mod _thread {
355355 Err ( vm. new_exception_empty ( vm. ctx . exceptions . system_exit . to_owned ( ) ) )
356356 }
357357
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+ }
359361
360362 #[ pyfunction]
361363 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)) {
8686// https://rustwasm.github.io/2018/10/24/multithreading-rust-and-wasm.html#atomic-instructions
8787thread_local ! {
8888 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+ } ;
9092}
9193
9294pub fn get_vm_id ( vm : & VirtualMachine ) -> & str {
You can’t perform that action at this time.
0 commit comments