Skip to content

Commit 1fb3ff1

Browse files
committed
Fix inherent_impls
1 parent 7165128 commit 1fb3ff1

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

src/librustc_typeck/coherence/inherent_impls.rs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//! `tcx.inherent_impls(def_id)`). That value, however,
88
//! is computed by selecting an idea from this table.
99
10-
use rustc::dep_graph::DepKind;
1110
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
1211
use rustc::hir;
1312
use rustc::hir::itemlikevisit::ItemLikeVisitor;
@@ -37,35 +36,11 @@ pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
3736
-> &'tcx [DefId] {
3837
assert!(ty_def_id.is_local());
3938

40-
// NB. Until we adopt the red-green dep-tracking algorithm (see
41-
// [the plan] for details on that), we do some hackery here to get
42-
// the dependencies correct. Basically, we use a `with_ignore` to
43-
// read the result we want. If we didn't have the `with_ignore`,
44-
// we would wind up with a dependency on the entire crate, which
45-
// we don't want. Then we go and add dependencies on all the impls
46-
// in the result (which is what we wanted).
47-
//
48-
// The result is a graph with an edge from `Hir(I)` for every impl
49-
// `I` defined on some type `T` to `CoherentInherentImpls(T)`,
50-
// thus ensuring that if any of those impls change, the set of
51-
// inherent impls is considered dirty.
52-
//
53-
// [the plan]: https://github.com/rust-lang/rust-roadmap/issues/4
54-
55-
let result = tcx.dep_graph.with_ignore(|| {
56-
let crate_map = tcx.crate_inherent_impls(ty_def_id.krate);
57-
match crate_map.inherent_impls.get(&ty_def_id) {
58-
Some(v) => &v[..],
59-
None => &[],
60-
}
61-
});
62-
63-
for &impl_def_id in &result[..] {
64-
let def_path_hash = tcx.def_path_hash(impl_def_id);
65-
tcx.dep_graph.read(def_path_hash.to_dep_node(DepKind::Hir));
39+
let crate_map = tcx.crate_inherent_impls(ty_def_id.krate);
40+
match crate_map.inherent_impls.get(&ty_def_id) {
41+
Some(v) => &v[..],
42+
None => &[],
6643
}
67-
68-
result
6944
}
7045

7146
struct InherentCollect<'a, 'tcx: 'a> {

0 commit comments

Comments
 (0)