File tree 1 file changed +6
-3
lines changed
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> {
166
166
/// ```
167
167
/// use std::cell::Cell;
168
168
/// 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
+ /// };
170
173
/// }
171
174
///
172
175
/// assert_eq!(FOO.get(), 1);
@@ -186,12 +189,12 @@ macro_rules! thread_local {
186
189
// empty (base case for the recursion)
187
190
( ) => { } ;
188
191
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) * ) => (
190
193
$crate:: thread:: local_impl:: thread_local_inner!( $( #[ $attr] ) * $vis $name, $t, const $init) ;
191
194
$crate:: thread_local!( $( $rest) * ) ;
192
195
) ;
193
196
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 ) => (
195
198
$crate:: thread:: local_impl:: thread_local_inner!( $( #[ $attr] ) * $vis $name, $t, const $init) ;
196
199
) ;
197
200
You can’t perform that action at this time.
0 commit comments