Skip to content

Commit ed6f868

Browse files
committed
rustc: Move impl_defaultness to a query
1 parent dff0c07 commit ed6f868

File tree

5 files changed

+4
-14
lines changed

5 files changed

+4
-14
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ define_dep_nodes!( <'tcx>
534534
[] IsProfilerRuntime(CrateNum),
535535
[] GetPanicStrategy(CrateNum),
536536
[] IsNoBuiltins(CrateNum),
537+
[] ImplDefaultness(DefId),
537538
);
538539

539540
trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {

src/librustc/middle/cstore.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ pub trait CrateStore {
236236
// trait info
237237
fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId>;
238238

239-
// impl info
240-
fn impl_defaultness(&self, def: DefId) -> hir::Defaultness;
241-
242239
// trait/impl-item info
243240
fn associated_item_cloned(&self, def: DefId) -> ty::AssociatedItem;
244241

@@ -342,9 +339,6 @@ impl CrateStore for DummyCrateStore {
342339
// trait info
343340
fn implementations_of_trait(&self, filter: Option<DefId>) -> Vec<DefId> { vec![] }
344341

345-
// impl info
346-
fn impl_defaultness(&self, def: DefId) -> hir::Defaultness { bug!("impl_defaultness") }
347-
348342
// trait/impl-item info
349343
fn associated_item_cloned(&self, def: DefId) -> ty::AssociatedItem
350344
{ bug!("associated_item_cloned") }

src/librustc/traits/util.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
538538
}
539539
None => {
540540
self.global_tcx()
541-
.sess
542-
.cstore
543541
.impl_defaultness(node_item_def_id)
544542
.is_default()
545543
}

src/librustc/ty/maps.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,8 @@ define_maps! { <'tcx>
11611161
[] fn in_scope_traits: InScopeTraits(HirId) -> Option<Rc<Vec<TraitCandidate>>>,
11621162
[] fn module_exports: ModuleExports(HirId) -> Option<Rc<Vec<Export>>>,
11631163
[] fn lint_levels: lint_levels_node(CrateNum) -> Rc<lint::LintLevelMap>,
1164+
1165+
[] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
11641166
}
11651167

11661168
fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {

src/librustc_metadata/cstore_impl.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ provide! { <'tcx> tcx, def_id, cdata,
162162
panic_strategy => { cdata.panic_strategy(&tcx.dep_graph) }
163163
extern_crate => { Rc::new(cdata.extern_crate.get()) }
164164
is_no_builtins => { cdata.is_no_builtins(&tcx.dep_graph) }
165+
impl_defaultness => { cdata.get_impl_defaultness(def_id.index) }
165166
}
166167

167168
pub fn provide_local<'tcx>(providers: &mut Providers<'tcx>) {
@@ -211,12 +212,6 @@ impl CrateStore for cstore::CStore {
211212
result
212213
}
213214

214-
fn impl_defaultness(&self, def: DefId) -> hir::Defaultness
215-
{
216-
self.read_dep_node(def);
217-
self.get_crate_data(def.krate).get_impl_defaultness(def.index)
218-
}
219-
220215
fn associated_item_cloned(&self, def: DefId) -> ty::AssociatedItem
221216
{
222217
self.read_dep_node(def);

0 commit comments

Comments
 (0)