Skip to content

Commit 4355169

Browse files
committedMay 3, 2017
kill the old visit_all_item_likes infrastructure
1 parent 4824a19 commit 4355169

File tree

6 files changed

+5
-96
lines changed

6 files changed

+5
-96
lines changed
 

‎src/librustc/dep_graph/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ mod raii;
1818
mod safe;
1919
mod shadow;
2020
mod thread;
21-
mod visit;
2221

2322
pub use self::dep_tracking_map::{DepTrackingMap, DepTrackingMapConfig};
2423
pub use self::dep_node::DepNode;
@@ -28,5 +27,4 @@ pub use self::graph::WorkProduct;
2827
pub use self::query::DepGraphQuery;
2928
pub use self::safe::AssertDepGraphSafe;
3029
pub use self::safe::DepGraphSafe;
31-
pub use self::visit::visit_all_item_likes_in_krate;
3230
pub use self::raii::DepTask;

‎src/librustc/dep_graph/visit.rs

-77
This file was deleted.

‎src/librustc/hir/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub enum NestedVisitorMap<'this, 'tcx: 'this> {
8888
/// that are inside of an item-like.
8989
///
9090
/// **This is the most common choice.** A very commmon pattern is
91-
/// to use `tcx.visit_all_item_likes_in_krate()` as an outer loop,
91+
/// to use `visit_all_item_likes()` as an outer loop,
9292
/// and to have the visitor that visits the contents of each item
9393
/// using this setting.
9494
OnlyBodies(&'this Map<'tcx>),

‎src/librustc/hir/itemlikevisit.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ use super::intravisit::Visitor;
1919
///
2020
/// 1. **Shallow visit**: Get a simple callback for every item (or item-like thing) in the HIR.
2121
/// - Example: find all items with a `#[foo]` attribute on them.
22-
/// - How: Implement `ItemLikeVisitor` and call `tcx.visit_all_item_likes_in_krate()`.
22+
/// - How: Implement `ItemLikeVisitor` and call `tcx.hir.krate().visit_all_item_likes()`.
2323
/// - Pro: Efficient; just walks the lists of item-like things, not the nodes themselves.
24-
/// - Pro: Integrates well into dependency tracking.
2524
/// - Con: Don't get information about nesting
2625
/// - Con: Don't have methods for specific bits of HIR, like "on
2726
/// every expr, do this".
@@ -30,7 +29,7 @@ use super::intravisit::Visitor;
3029
/// within one another.
3130
/// - Example: Examine each expression to look for its type and do some check or other.
3231
/// - How: Implement `intravisit::Visitor` and use
33-
/// `tcx.visit_all_item_likes_in_krate(visitor.as_deep_visitor())`. Within
32+
/// `tcx.hir.krate().visit_all_item_likes(visitor.as_deep_visitor())`. Within
3433
/// your `intravisit::Visitor` impl, implement methods like
3534
/// `visit_expr()`; don't forget to invoke
3635
/// `intravisit::walk_visit_expr()` to keep walking the subparts.

‎src/librustc/ty/mod.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub use self::IntVarValue::*;
1515
pub use self::LvaluePreference::*;
1616
pub use self::fold::TypeFoldable;
1717

18-
use dep_graph::{self, DepNode};
18+
use dep_graph::DepNode;
1919
use hir::{map as hir_map, FreevarMap, TraitMap};
2020
use hir::def::{Def, CtorKind, ExportMap};
2121
use hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
@@ -58,7 +58,6 @@ use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
5858
use rustc_data_structures::transitive_relation::TransitiveRelation;
5959

6060
use hir;
61-
use hir::itemlikevisit::ItemLikeVisitor;
6261

6362
pub use self::sty::{Binder, DebruijnIndex};
6463
pub use self::sty::{FnSig, PolyFnSig};
@@ -2565,14 +2564,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
25652564
self.mk_region(ty::ReScope(self.node_extent(id)))
25662565
}
25672566

2568-
pub fn visit_all_item_likes_in_krate<V,F>(self,
2569-
dep_node_fn: F,
2570-
visitor: &mut V)
2571-
where F: FnMut(DefId) -> DepNode<DefId>, V: ItemLikeVisitor<'gcx>
2572-
{
2573-
dep_graph::visit_all_item_likes_in_krate(self.global_tcx(), dep_node_fn, visitor);
2574-
}
2575-
25762567
/// Looks up the span of `impl_did` if the impl is local; otherwise returns `Err`
25772568
/// with the name of the crate containing the impl.
25782569
pub fn span_of_impl(self, impl_did: DefId) -> Result<Span, Symbol> {

‎src/librustc_typeck/variance/terms.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ use self::VarianceTerm::*;
3232

3333
pub type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
3434

35-
use dep_graph::DepNode::ItemSignature as VarianceDepNode;
36-
3735
#[derive(Copy, Clone, Debug)]
3836
pub struct InferredIndex(pub usize);
3937

@@ -109,7 +107,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>
109107
};
110108

111109
// See README.md for a discussion on dep-graph management.
112-
tcx.visit_all_item_likes_in_krate(|def_id| VarianceDepNode(def_id), &mut terms_cx);
110+
tcx.hir.krate().visit_all_item_likes(&mut terms_cx);
113111

114112
terms_cx
115113
}

0 commit comments

Comments
 (0)
Please sign in to comment.