Skip to content

Commit 09db61f

Browse files
committed
auto merge of rust-lang#10867 : sfackler/rust/unsugared-doc, r=huonw
Closes rust-lang#10853
2 parents 9f3be46 + 4d688e8 commit 09db61f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/librustc/middle/lint.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,13 @@ fn check_missing_doc_attrs(cx: &Context,
10741074
_ => ()
10751075
}
10761076

1077-
if !attrs.iter().any(|a| a.node.is_sugared_doc) {
1077+
let has_doc = attrs.iter().any(|a| {
1078+
match a.node.value.node {
1079+
ast::MetaNameValue(ref name, _) if "doc" == *name => true,
1080+
_ => false
1081+
}
1082+
});
1083+
if !has_doc {
10781084
cx.span_lint(missing_doc, sp,
10791085
format!("missing documentation for {}", desc));
10801086
}

src/test/run-pass/issue-10853.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[deny(missing_doc)];
12+
#[doc="module"];
13+
14+
#[doc="struct"]
15+
pub struct Foo;
16+
17+
pub fn foo() {
18+
#[doc="fn"];
19+
}
20+
21+
#[doc="main"]
22+
pub fn main() {}

0 commit comments

Comments
 (0)