Skip to content

Commit 9ca1c61

Browse files
committed
Instrumentation in effort to understand treatment of allow_internal_unstable.
It is all `debug!` instrumentation so it should not impose a cost on non-debug builds.
1 parent 07afe91 commit 9ca1c61

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/librustc/middle/stability.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,19 @@ pub fn check_pat(tcx: &ty::ctxt, pat: &ast::Pat,
543543

544544
fn maybe_do_stability_check(tcx: &ty::ctxt, id: ast::DefId, span: Span,
545545
cb: &mut FnMut(ast::DefId, Span, &Option<&Stability>)) {
546-
if !is_staged_api(tcx, id) { return }
547-
if is_internal(tcx, span) { return }
546+
if !is_staged_api(tcx, id) {
547+
debug!("maybe_do_stability_check: \
548+
skipping id={:?} since it is not staged_api", id);
549+
return;
550+
}
551+
if is_internal(tcx, span) {
552+
debug!("maybe_do_stability_check: \
553+
skipping span={:?} since it is internal", span);
554+
return;
555+
}
548556
let ref stability = lookup(tcx, id);
557+
debug!("maybe_do_stability_check: \
558+
inspecting id={:?} span={:?} of stability={:?}", id, span, stability);
549559
cb(id, span, stability);
550560
}
551561

src/libsyntax/codemap.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,10 @@ impl CodeMap {
980980
mac_span.lo <= span.lo && span.hi <= mac_span.hi
981981
});
982982

983+
debug!("span_allows_unstable: span: {:?} call_site: {:?} callee: {:?}",
984+
(span.lo, span.hi),
985+
(info.call_site.lo, info.call_site.hi),
986+
info.callee.span.map(|x| (x.lo, x.hi)));
983987
debug!("span_allows_unstable: from this expansion? {}, allows unstable? {}",
984988
span_comes_from_this_expansion,
985989
info.callee.allow_internal_unstable);

0 commit comments

Comments
 (0)