]> git.lizzy.rs Git - rust.git/commitdiff
Instrumentation in effort to understand treatment of `allow_internal_unstable`.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 5 Jun 2015 16:53:17 +0000 (18:53 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 22 Jul 2015 13:34:00 +0000 (15:34 +0200)
It is all `debug!` instrumentation so it should not impose a cost on
non-debug builds.

src/librustc/middle/stability.rs
src/libsyntax/codemap.rs

index 30553d62719bfbf8b96a4535965e7ea4d75539e3..6d3bc7fb68c1418ca20b6775212eecb3b056bb9d 100644 (file)
@@ -543,9 +543,19 @@ pub fn check_pat(tcx: &ty::ctxt, pat: &ast::Pat,
 
 fn maybe_do_stability_check(tcx: &ty::ctxt, id: ast::DefId, span: Span,
                             cb: &mut FnMut(ast::DefId, Span, &Option<&Stability>)) {
-    if !is_staged_api(tcx, id) { return  }
-    if is_internal(tcx, span) { return }
+    if !is_staged_api(tcx, id) {
+        debug!("maybe_do_stability_check: \
+                skipping id={:?} since it is not staged_api", id);
+        return;
+    }
+    if is_internal(tcx, span) {
+        debug!("maybe_do_stability_check: \
+                skipping span={:?} since it is internal", span);
+        return;
+    }
     let ref stability = lookup(tcx, id);
+    debug!("maybe_do_stability_check: \
+            inspecting id={:?} span={:?} of stability={:?}", id, span, stability);
     cb(id, span, stability);
 }
 
index e6bc3218897d91f3ec907c86cc256a81a1504343..17e6b2c2e12df69fc03d79c0793281d380e528bc 100644 (file)
@@ -980,6 +980,10 @@ pub fn span_allows_unstable(&self, span: Span) -> bool {
                             mac_span.lo <= span.lo && span.hi <= mac_span.hi
                         });
 
+                    debug!("span_allows_unstable: span: {:?} call_site: {:?} callee: {:?}",
+                           (span.lo, span.hi),
+                           (info.call_site.lo, info.call_site.hi),
+                           info.callee.span.map(|x| (x.lo, x.hi)));
                     debug!("span_allows_unstable: from this expansion? {}, allows unstable? {}",
                            span_comes_from_this_expansion,
                            info.callee.allow_internal_unstable);