|
7 | 7 | //! `tcx.inherent_impls(def_id)`). That value, however,
|
8 | 8 | //! is computed by selecting an idea from this table.
|
9 | 9 |
|
10 |
| -use rustc::dep_graph::DepKind; |
11 | 10 | use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
12 | 11 | use rustc::hir;
|
13 | 12 | use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
@@ -37,35 +36,11 @@ pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
37 | 36 | -> &'tcx [DefId] {
|
38 | 37 | assert!(ty_def_id.is_local());
|
39 | 38 |
|
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 => &[], |
66 | 43 | }
|
67 |
| - |
68 |
| - result |
69 | 44 | }
|
70 | 45 |
|
71 | 46 | struct InherentCollect<'a, 'tcx: 'a> {
|
|
0 commit comments