// misc. metadata
fn item_body<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, def: DefId)
-> &'tcx hir::Body;
- fn const_is_rvalue_promotable_to_static(&self, def: DefId) -> bool;
fn is_item_mir_available(&self, def: DefId) -> bool;
-> &'tcx hir::Body {
bug!("item_body")
}
- fn const_is_rvalue_promotable_to_static(&self, def: DefId) -> bool {
- bug!("const_is_rvalue_promotable_to_static")
- }
fn is_item_mir_available(&self, def: DefId) -> bool {
bug!("is_item_mir_available")
}
}
+impl<'tcx> QueryDescription for queries::const_is_rvalue_promotable_to_static<'tcx> {
+ fn describe(tcx: TyCtxt, def_id: DefId) -> String {
+ format!("const checking if rvalue is promotable to static `{}`",
+ tcx.item_path_str(def_id))
+ }
+}
+
macro_rules! define_maps {
(<$tcx:tt>
$($(#[$attr:meta])*
[] def_span: DefSpan(DefId) -> Span,
[] item_body_nested_bodies: metadata_dep_node(DefId) -> Rc<BTreeMap<hir::BodyId, hir::Body>>,
+ [] const_is_rvalue_promotable_to_static: metadata_dep_node(DefId) -> bool,
}
fn coherent_trait_dep_node((_, def_id): (CrateNum, DefId)) -> DepNode<DefId> {
Rc::new(map)
}
+ const_is_rvalue_promotable_to_static => {
+ cdata.entry(def_id.index).ast.expect("const item missing `ast`")
+ .decode(cdata).rvalue_promotable_to_static
+ }
}
impl CrateStore for cstore::CStore {
self.get_crate_data(def_id.krate).item_body(tcx, def_id.index)
}
- fn const_is_rvalue_promotable_to_static(&self, def: DefId) -> bool {
- self.dep_graph.read(DepNode::MetaData(def));
- self.get_crate_data(def.krate).const_is_rvalue_promotable_to_static(def.index)
- }
-
fn is_item_mir_available(&self, def: DefId) -> bool {
self.dep_graph.read(DepNode::MetaData(def));
self.get_crate_data(def.krate).is_item_mir_available(def.index)
tcx.alloc_tables(ast.tables.decode((self, tcx)))
}
- pub fn const_is_rvalue_promotable_to_static(&self, id: DefIndex) -> bool {
- self.entry(id).ast.expect("const item missing `ast`")
- .decode(self).rvalue_promotable_to_static
- }
-
pub fn is_item_mir_available(&self, id: DefIndex) -> bool {
!self.is_proc_macro(id) &&
self.maybe_entry(id).and_then(|item| item.decode(self).mir).is_some()
_ => false
}
} else {
- v.tcx.sess.cstore.const_is_rvalue_promotable_to_static(did)
+ v.tcx.const_is_rvalue_promotable_to_static(did)
};
}
_ => {