Skip to content

Commit fd5dbe4

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 152792 b: refs/heads/try2 c: 6fede93 h: refs/heads/master v: v3
1 parent ae09941 commit fd5dbe4

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a813a3779be2266cf936ee87907595c356f3afbc
8+
refs/heads/try2: 6fede93475013a5a8bef1678dfd04fef3118836e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/lint/builtin.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,9 +1238,6 @@ declare_lint!(MISSING_DOC, Allow,
12381238
"detects missing documentation for public members")
12391239

12401240
pub struct MissingDoc {
1241-
/// Set of nodes exported from this module.
1242-
exported_items: Option<ExportedItems>,
1243-
12441241
/// Stack of IDs of struct definitions.
12451242
struct_def_stack: Vec<ast::NodeId>,
12461243

@@ -1252,7 +1249,6 @@ pub struct MissingDoc {
12521249
impl MissingDoc {
12531250
pub fn new() -> MissingDoc {
12541251
MissingDoc {
1255-
exported_items: None,
12561252
struct_def_stack: vec!(),
12571253
doc_hidden_stack: vec!(false),
12581254
}
@@ -1278,9 +1274,8 @@ impl MissingDoc {
12781274
// Only check publicly-visible items, using the result from the privacy pass.
12791275
// It's an option so the crate root can also use this function (it doesn't
12801276
// have a NodeId).
1281-
let exported = self.exported_items.as_ref().expect("exported_items not set");
12821277
match id {
1283-
Some(ref id) if !exported.contains(id) => return,
1278+
Some(ref id) if !cx.exported_items.contains(id) => return,
12841279
_ => ()
12851280
}
12861281

@@ -1327,10 +1322,7 @@ impl LintPass for MissingDoc {
13271322
assert!(popped == id);
13281323
}
13291324

1330-
fn check_crate(&mut self, cx: &Context, exported: &ExportedItems, krate: &ast::Crate) {
1331-
// FIXME: clone to avoid lifetime trickiness
1332-
self.exported_items = Some(exported.clone());
1333-
1325+
fn check_crate(&mut self, cx: &Context, _: &ExportedItems, krate: &ast::Crate) {
13341326
self.check_missing_doc_attrs(cx, None, krate.attrs.as_slice(),
13351327
krate.span, "crate");
13361328
}

branches/try2/src/librustc/lint/context.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ pub struct Context<'a> {
170170
/// Type context we're checking in.
171171
pub tcx: &'a ty::ctxt,
172172

173+
/// The crate being checked.
174+
pub krate: &'a ast::Crate,
175+
176+
/// Items exported from the crate being checked.
177+
pub exported_items: &'a ExportedItems,
178+
173179
/// The store of registered lints.
174180
lints: LintStore,
175181

@@ -275,14 +281,18 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
275281
}
276282

277283
impl<'a> Context<'a> {
278-
fn new(tcx: &'a ty::ctxt) -> Context<'a> {
284+
fn new(tcx: &'a ty::ctxt,
285+
krate: &'a ast::Crate,
286+
exported_items: &'a ExportedItems) -> Context<'a> {
279287
// We want to own the lint store, so move it out of the session.
280288
let lint_store = mem::replace(&mut *tcx.sess.lint_store.borrow_mut(),
281289
LintStore::new());
282290

283291
Context {
284-
lints: lint_store,
285292
tcx: tcx,
293+
krate: krate,
294+
exported_items: exported_items,
295+
lints: lint_store,
286296
level_stack: vec!(),
287297
node_levels: RefCell::new(HashMap::new()),
288298
}
@@ -619,7 +629,7 @@ impl LintPass for GatherNodeLevels {
619629
pub fn check_crate(tcx: &ty::ctxt,
620630
krate: &ast::Crate,
621631
exported_items: &ExportedItems) {
622-
let mut cx = Context::new(tcx);
632+
let mut cx = Context::new(tcx, krate, exported_items);
623633

624634
// Visit the whole crate.
625635
cx.with_lint_attrs(krate.attrs.as_slice(), |cx| {

0 commit comments

Comments
 (0)