File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " cssparser"
3
- version = " 0.25.7 "
3
+ version = " 0.25.8 "
4
4
authors = [ " Simon Sapin <simon.sapin@exyr.org>" ]
5
5
6
6
description = " Rust implementation of CSS Syntax Level 3"
@@ -30,6 +30,7 @@ serde = {version = "1.0", optional = true}
30
30
smallvec = " 0.6"
31
31
32
32
[build-dependencies ]
33
+ autocfg = " 0.1.4"
33
34
syn = { version = " 0.15.12" , features = [" extra-traits" , " fold" , " full" ] }
34
35
quote = " 0.6"
35
36
proc-macro2 = " 0.4"
Original file line number Diff line number Diff line change 2
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
4
5
+ extern crate autocfg;
5
6
#[ macro_use]
6
7
extern crate quote;
7
8
#[ macro_use]
@@ -49,5 +50,7 @@ fn main() {
49
50
println ! ( "cargo:rustc-cfg=rustc_has_pr45225" )
50
51
}
51
52
53
+ autocfg:: new ( ) . emit_has_path ( "std::mem::MaybeUninit" ) ;
54
+
52
55
codegen:: main ( ) ;
53
56
}
Original file line number Diff line number Diff line change @@ -110,13 +110,26 @@ macro_rules! ascii_case_insensitive_phf_map {
110
110
#[ doc( hidden) ]
111
111
macro_rules! cssparser_internal__to_lowercase {
112
112
( $input: expr, $BUFFER_SIZE: expr => $output: ident) => {
113
- // mem::uninitialized() is ok because `buffer` is only used in `_internal__to_lowercase`,
113
+ let mut buffer;
114
+ // Safety: `buffer` is only used in `_internal__to_lowercase`,
114
115
// which initializes with `copy_from_slice` the part of the buffer it uses,
115
116
// before it uses it.
116
117
#[ allow( unsafe_code) ]
117
- let mut buffer: [ u8 ; $BUFFER_SIZE] = unsafe { :: std:: mem:: uninitialized( ) } ;
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
131
let input: & str = $input;
119
- let $output = $crate:: _internal__to_lowercase( & mut buffer, input) ;
132
+ let $output = $crate:: _internal__to_lowercase( buffer, input) ;
120
133
} ;
121
134
}
122
135
You can’t perform that action at this time.
0 commit comments