mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Eliminate warning about unsafe references to extern static variables.
MozReview-Commit-ID: 7UJNBaEWnH7
This commit is contained in:
parent
cad5a4e326
commit
8abc1bd275
3 changed files with 4936 additions and 2466 deletions
|
@ -109,8 +109,8 @@ ATOM_TEMPLATE = (" #[link_name = \"{link_name}\"]\n"
|
||||||
" pub static {name}: *mut {type};")
|
" pub static {name}: *mut {type};")
|
||||||
|
|
||||||
UNSAFE_STATIC = ("#[inline(always)]\n"
|
UNSAFE_STATIC = ("#[inline(always)]\n"
|
||||||
"pub fn unsafe_atom_from_static(ptr: *mut nsIAtom) -> Atom {\n"
|
"pub unsafe fn atom_from_static(ptr: *mut nsIAtom) -> Atom {\n"
|
||||||
" unsafe { Atom::from_static(ptr) }\n"
|
" Atom::from_static(ptr)\n"
|
||||||
"}\n\n")
|
"}\n\n")
|
||||||
|
|
||||||
CFG_IF = '''
|
CFG_IF = '''
|
||||||
|
@ -131,9 +131,14 @@ cfg_if! {{
|
||||||
}}
|
}}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RULE_TEMPLATE = ('("{atom}") => '
|
RULE_TEMPLATE = ('("{atom}") =>\n '
|
||||||
'{{ $crate::string_cache::atom_macro::unsafe_atom_from_static'
|
'{{ '
|
||||||
'($crate::string_cache::atom_macro::{name} as *mut _) }};')
|
# FIXME(bholley): Uncomment this when rust 1.14 is released.
|
||||||
|
# See the comment in components/style/lib.rs.
|
||||||
|
# ' #[allow(unsafe_code)] #[allow(unused_unsafe)] '
|
||||||
|
'unsafe {{ $crate::string_cache::atom_macro::atom_from_static'
|
||||||
|
'($crate::string_cache::atom_macro::{name} as *mut _) }}'
|
||||||
|
' }};')
|
||||||
|
|
||||||
MACRO = '''
|
MACRO = '''
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,14 @@
|
||||||
#![cfg_attr(feature = "servo", plugin(heapsize_plugin))]
|
#![cfg_attr(feature = "servo", plugin(heapsize_plugin))]
|
||||||
#![cfg_attr(feature = "servo", plugin(plugins))]
|
#![cfg_attr(feature = "servo", plugin(plugins))]
|
||||||
|
|
||||||
#![deny(unsafe_code)]
|
// FIXME(bholley): We need to blanket-allow unsafe code in order to make the
|
||||||
|
// gecko atom!() macro work. When Rust 1.14 is released [1], we can uncomment
|
||||||
|
// the commented-out attributes in regen_atoms.py and go back to denying unsafe
|
||||||
|
// code by default.
|
||||||
|
//
|
||||||
|
// [1] https://github.com/rust-lang/rust/issues/15701#issuecomment-251900615
|
||||||
|
//#![deny(unsafe_code)]
|
||||||
|
#![allow(unused_unsafe)]
|
||||||
|
|
||||||
#![recursion_limit = "500"] // For match_ignore_ascii_case in PropertyDeclaration::parse
|
#![recursion_limit = "500"] // For match_ignore_ascii_case in PropertyDeclaration::parse
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue