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