提交 7e382132 编写于 作者: F Flavio Percoco

Make default_trait_impls private and add accessor

上级 d523acb4
......@@ -1149,7 +1149,7 @@ fn assemble_candidates_from_impls(&mut self,
});
}
if self.tcx().default_trait_impls.borrow().contains(&def_id) {
if ty::trait_has_default_impl(self.tcx(), def_id) {
candidates.vec.push(DefaultTraitCandidate(def_id.clone()))
}
......
......@@ -758,7 +758,7 @@ pub struct ctxt<'tcx> {
pub trait_impls: RefCell<DefIdMap<Rc<RefCell<Vec<ast::DefId>>>>>,
/// Maps a trait onto a list of *default* trait implementations
pub default_trait_impls: RefCell<DefIdSet>,
default_trait_impls: RefCell<DefIdSet>,
/// Maps a DefId of a type to a list of its inherent impls.
/// Contains implementations of methods that are inherent to a type.
......@@ -5999,6 +5999,10 @@ pub fn item_variances(tcx: &ctxt, item_id: ast::DefId) -> Rc<ItemVariances> {
|| Rc::new(csearch::get_item_variances(&tcx.sess.cstore, item_id)))
}
pub fn trait_has_default_impl(tcx: &ctxt, trait_def_id: DefId) -> bool {
tcx.default_trait_impls.borrow().contains(&trait_def_id)
}
/// Records a trait-to-implementation mapping.
pub fn record_default_trait_implementation(tcx: &ctxt, trait_def_id: DefId) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册