@@ -115,24 +115,37 @@ macro_rules! cssparser_internal__to_lowercase {
115115 // which initializes with `copy_from_slice` the part of the buffer it uses,
116116 // before it uses it.
117117 #[ allow( unsafe_code) ]
118- let buffer = unsafe {
119- // FIXME: remove this when we require Rust 1.36
120- #[ cfg( not( has_std__mem__MaybeUninit) ) ]
121- {
122- buffer = :: std:: mem:: uninitialized:: <[ u8 ; $BUFFER_SIZE] >( ) ;
123- & mut buffer
124- }
125- #[ cfg( has_std__mem__MaybeUninit) ]
126- {
127- buffer = :: std:: mem:: MaybeUninit :: <[ u8 ; $BUFFER_SIZE] >:: uninit( ) ;
128- & mut * ( buffer. as_mut_ptr( ) )
129- }
130- } ;
118+ let buffer = unsafe { cssparser_internal__uninit!( buffer, $BUFFER_SIZE) } ;
131119 let input: & str = $input;
132120 let $output = $crate:: _internal__to_lowercase( buffer, input) ;
133121 } ;
134122}
135123
124+ #[ cfg( has_std__mem__MaybeUninit) ]
125+ #[ macro_export]
126+ #[ doc( hidden) ]
127+ macro_rules! cssparser_internal__uninit {
128+ ( $buffer: ident, $BUFFER_SIZE: expr) => {
129+ {
130+ $buffer = :: std:: mem:: MaybeUninit :: <[ u8 ; $BUFFER_SIZE] >:: uninit( ) ;
131+ & mut * ( $buffer. as_mut_ptr( ) )
132+ }
133+ }
134+ }
135+
136+ // FIXME: remove this when we require Rust 1.36
137+ #[ cfg( not( has_std__mem__MaybeUninit) ) ]
138+ #[ macro_export]
139+ #[ doc( hidden) ]
140+ macro_rules! cssparser_internal__uninit {
141+ ( $buffer: ident, $BUFFER_SIZE: expr) => {
142+ {
143+ $buffer = :: std:: mem:: uninitialized:: <[ u8 ; $BUFFER_SIZE] >( ) ;
144+ & mut $buffer
145+ }
146+ }
147+ }
148+
136149/// Implementation detail of match_ignore_ascii_case! and ascii_case_insensitive_phf_map! macros.
137150///
138151/// **This function is not part of the public API. It can change or be removed between any verisons.**
0 commit comments