diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 3e6803feadbf..6d0816de433e 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 000000000000..d56396e11b4b --- /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 or the MIT license +// , 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() {}