This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,10 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
166166/// ```
167167/// use std::cell::Cell;
168168/// thread_local! {
169- /// pub static FOO: Cell<u32> = const { Cell::new(1) };
169+ /// pub static FOO: Cell<u32> = const {
170+ /// let value = 1;
171+ /// Cell::new(value)
172+ /// };
170173/// }
171174///
172175/// assert_eq!(FOO.get(), 1);
@@ -186,12 +189,12 @@ macro_rules! thread_local {
186189 // empty (base case for the recursion)
187190 ( ) => { } ;
188191
189- ( $( #[ $attr: meta] ) * $vis: vis static $name: ident: $t: ty = const { $init: expr } ; $( $rest: tt) * ) => (
192+ ( $( #[ $attr: meta] ) * $vis: vis static $name: ident: $t: ty = const $init: block ; $( $rest: tt) * ) => (
190193 $crate:: thread:: local_impl:: thread_local_inner!( $( #[ $attr] ) * $vis $name, $t, const $init) ;
191194 $crate:: thread_local!( $( $rest) * ) ;
192195 ) ;
193196
194- ( $( #[ $attr: meta] ) * $vis: vis static $name: ident: $t: ty = const { $init: expr } ) => (
197+ ( $( #[ $attr: meta] ) * $vis: vis static $name: ident: $t: ty = const $init: block ) => (
195198 $crate:: thread:: local_impl:: thread_local_inner!( $( #[ $attr] ) * $vis $name, $t, const $init) ;
196199 ) ;
197200
You can’t perform that action at this time.
0 commit comments