new option to note where purity is req'd

This commit is contained in:
Niko Matsakis
2012-07-06 15:03:18 -07:00
parent 668285b9c8
commit 9b094c0baf
2 changed files with 11 additions and 1 deletions
+5 -1
View File
@@ -37,6 +37,7 @@ enum crate_type { bin_crate, lib_crate, unknown_crate, }
const no_rt: uint = 256u;
const coherence: uint = 512u;
const borrowck_stats: uint = 1024u;
const borrowck_note_pure: uint = 2048;
fn debugging_opts_map() -> ~[(str, str, uint)] {
~[("ppregions", "prettyprint regions with \
@@ -51,7 +52,9 @@ fn debugging_opts_map() -> ~[(str, str, uint)] {
("trace", "emit trace logs", trace),
("no-rt", "do not link to the runtime", no_rt),
("coherence", "perform coherence checking", coherence),
("borrowck-stats", "gather borrowck statistics", borrowck_stats)
("borrowck-stats", "gather borrowck statistics", borrowck_stats),
("borrowck-note-pure", "note where purity is req'd",
borrowck_note_pure)
]
}
@@ -168,6 +171,7 @@ fn no_verify() -> bool { self.debugging_opt(no_verify) }
fn trace() -> bool { self.debugging_opt(trace) }
fn coherence() -> bool { self.debugging_opt(coherence) }
fn borrowck_stats() -> bool { self.debugging_opt(borrowck_stats) }
fn borrowck_note_pure() -> bool { self.debugging_opt(borrowck_note_pure) }
}
/// Some reasonable defaults
@@ -246,6 +246,12 @@ fn guarantee_valid(cmt: cmt,
some(scope_id) {
self.req_maps.pure_map.insert(scope_id, e);
self.bccx.req_pure_paths += 1;
if self.tcx().sess.borrowck_note_pure() {
self.bccx.span_note(
cmt.span,
#fmt["purity required"]);
}
}
none {
// otherwise, fine, I give up.