Skip to content

Commit dd897da

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 121427 b: refs/heads/snap-stage3 c: 6fede93 h: refs/heads/master i: 121425: 07893fb 121423: 67fe9ef v: v3
1 parent 0f7eee4 commit dd897da

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 7a93beef7f692b34168ad69633f56483d38ad8fc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a813a3779be2266cf936ee87907595c356f3afbc
4+
refs/heads/snap-stage3: 6fede93475013a5a8bef1678dfd04fef3118836e
55
refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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)