diff options
| author | Steven Fackler <sfackler@gmail.com> | 2013-12-08 18:41:24 -0800 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2013-12-08 20:08:49 -0800 |
| commit | 4d688e8214e2589ae56aca2eb720f2eb68492ea2 (patch) | |
| tree | a2437c78b6ee857974b3c34317d958c3f6116d94 /src | |
| parent | a6310f6ad3434a03d5c257db5eae85b7b7522c29 (diff) | |
| download | rust-4d688e8214e2589ae56aca2eb720f2eb68492ea2.tar.gz rust-4d688e8214e2589ae56aca2eb720f2eb68492ea2.zip | |
Accept unsugared docs in missing-doc lint
Closes #10853
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/middle/lint.rs | 8 | ||||
| -rw-r--r-- | src/test/run-pass/issue-10853.rs | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 3e6803feadb..6d0816de433 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -1074,7 +1074,13 @@ fn check_missing_doc_attrs(cx: &Context, _ => () } - if !attrs.iter().any(|a| a.node.is_sugared_doc) { + let has_doc = attrs.iter().any(|a| { + match a.node.value.node { + ast::MetaNameValue(ref name, _) if "doc" == *name => true, + _ => false + } + }); + if !has_doc { cx.span_lint(missing_doc, sp, format!("missing documentation for {}", desc)); } diff --git a/src/test/run-pass/issue-10853.rs b/src/test/run-pass/issue-10853.rs new file mode 100644 index 00000000000..d56396e11b4 --- /dev/null +++ b/src/test/run-pass/issue-10853.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[deny(missing_doc)]; +#[doc="module"]; + +#[doc="struct"] +pub struct Foo; + +pub fn foo() { + #[doc="fn"]; +} + +#[doc="main"] +pub fn main() {} |
