mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 07:10:29 +00:00
Exhaustively handle fields in Drop for Cfg
This way it's no longer possible to forget to update this code when adding new configuration fields into CFG.
This commit is contained in:
parent
5b39d5eb25
commit
f908cfa123
@ -391,12 +391,19 @@ mod r#impl {
|
||||
|
||||
impl<'a> Drop for Cfg<'a> {
|
||||
fn drop(&mut self) {
|
||||
if let Cfg::Mut(cfg) = self {
|
||||
if let Cfg::Mut(super::Cfg {
|
||||
include_prefix,
|
||||
exported_header_dirs,
|
||||
exported_header_prefixes,
|
||||
exported_header_links,
|
||||
marker: _,
|
||||
}) = self
|
||||
{
|
||||
let mut current = CURRENT.write().unwrap_or_else(PoisonError::into_inner);
|
||||
current.include_prefix = intern(cfg.include_prefix);
|
||||
current.exported_header_dirs = vec::intern(&cfg.exported_header_dirs);
|
||||
current.exported_header_prefixes = vec::intern(&cfg.exported_header_prefixes);
|
||||
current.exported_header_links = vec::intern(&cfg.exported_header_links);
|
||||
current.include_prefix = intern(include_prefix);
|
||||
current.exported_header_dirs = vec::intern(exported_header_dirs);
|
||||
current.exported_header_prefixes = vec::intern(exported_header_prefixes);
|
||||
current.exported_header_links = vec::intern(exported_header_links);
|
||||
} else {
|
||||
CONST_DEREFS.with(|derefs| derefs.borrow_mut().remove(&self.handle()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user