pub jobserver_from_env: Option<Client>,
/// Metadata about the allocators for the current crate being compiled
- pub has_global_allocator: Cell<bool>,
+ pub has_global_allocator: Once<bool>,
}
pub struct PerfStats {
});
(*GLOBAL_JOBSERVER).clone()
},
- has_global_allocator: Cell::new(false),
+ has_global_allocator: Once::new(),
};
sess
fn inject_allocator_crate(&mut self, krate: &ast::Crate) {
let has_global_allocator = has_global_allocator(krate);
- if has_global_allocator {
- self.sess.has_global_allocator.set(true);
- }
+ self.sess.has_global_allocator.set(has_global_allocator);
// Check to see if we actually need an allocator. This desire comes
// about through the `#![needs_allocator]` attribute and is typically
let is_proc_macro = tcx.sess.crate_types.borrow().contains(&CrateTypeProcMacro);
let has_default_lib_allocator =
attr::contains_name(tcx.hir.krate_attrs(), "default_lib_allocator");
- let has_global_allocator = tcx.sess.has_global_allocator.get();
+ let has_global_allocator = *tcx.sess.has_global_allocator.get();
let root = self.lazy(&CrateRoot {
name: tcx.crate_name(LOCAL_CRATE),
extra_filename: tcx.sess.opts.cg.extra_filename.clone(),