Skip to content

Commit f285876

Browse files
committed
Logging for rustc_privacy.
1 parent 0603a73 commit f285876

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/librustc_privacy/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ path = "lib.rs"
99
crate-type = ["dylib"]
1010

1111
[dependencies]
12+
log = { version = "0.4", features = ["release_max_level_info", "std"] }
1213
rustc = { path = "../librustc" }
1314
rustc_typeck = { path = "../librustc_typeck" }
1415
syntax = { path = "../libsyntax" }

src/librustc_privacy/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#![recursion_limit="256"]
2020

21+
#[macro_use] extern crate log;
2122
#[macro_use] extern crate rustc;
2223
#[macro_use] extern crate syntax;
2324
extern crate rustc_typeck;
@@ -147,6 +148,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
147148
}
148149

149150
fn visit_item(&mut self, item: &'tcx hir::Item) {
151+
debug!("Walked item {:?}", item);
150152
let inherited_item_level = match item.node {
151153
// Impls inherit level from their types and traits
152154
hir::ItemKind::Impl(..) => {
@@ -164,13 +166,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
164166
hir::ItemKind::Trait(..) | hir::ItemKind::TraitAlias(..) |
165167
hir::ItemKind::Existential(..) |
166168
hir::ItemKind::Ty(..) | hir::ItemKind::Union(..) | hir::ItemKind::Use(..) => {
169+
if let hir::ItemKind::Fn(ref _decl, ref _header, ref _generics, ref _body) = item.node {
170+
debug!("Walked function");
171+
}
167172
if item.vis.node.is_pub() { self.prev_level } else { None }
168173
}
169174
};
170175

171176
// Update level of the item itself
172177
let item_level = self.update(item.id, inherited_item_level);
173178

179+
debug!("believed to be: {:?}", item_level);
180+
174181
// Update levels of nested things
175182
match item.node {
176183
hir::ItemKind::Enum(ref def, _) => {
@@ -1737,6 +1744,8 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
17371744
}
17381745
visitor.update(ast::CRATE_NODE_ID, Some(AccessLevel::Public));
17391746

1747+
debug!("access levels after embargo: {:?}", &visitor.access_levels);
1748+
17401749
{
17411750
let mut visitor = ObsoleteVisiblePrivateTypesVisitor {
17421751
tcx,
@@ -1766,6 +1775,8 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
17661775
krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor));
17671776
}
17681777

1778+
debug!("final access levels: {:?}", &visitor.access_levels);
1779+
17691780
Lrc::new(visitor.access_levels)
17701781
}
17711782

0 commit comments

Comments
 (0)