Make default_trait_impls private and add accessor
This commit is contained in:
parent
d523acb495
commit
7e382132a5
@ -1149,7 +1149,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user