Update missing-docs lint to check associated type declarations

[breaking-change]

Fixes #20648
This commit is contained in:
Ivan Petkov 2015-02-23 11:07:37 -08:00
parent dab394c2db
commit 717a91d665
2 changed files with 21 additions and 0 deletions

View File

@ -1577,6 +1577,14 @@ impl LintPass for MissingDoc {
tm.span, "a type method");
}
fn check_trait_method(&mut self, cx: &Context, it: &ast::TraitItem) {
if let ast::TraitItem::TypeTraitItem(ref ty) = *it {
let assoc_ty = &ty.ty_param;
self.check_missing_docs_attrs(cx, Some(assoc_ty.id), &ty.attrs,
assoc_ty.span, "an associated type");
}
}
fn check_struct_field(&mut self, cx: &Context, sf: &ast::StructField) {
if let ast::NamedField(_, vis) = sf.node.kind {
if vis == ast::Public || self.in_variant {

View File

@ -68,6 +68,19 @@ pub trait D {
fn dummy(&self) { }
}
/// dox
pub trait E {
type AssociatedType; //~ ERROR: missing documentation
type AssociatedTypeDef = Self; //~ ERROR: missing documentation
/// dox
type DocumentedType;
/// dox
type DocumentedTypeDef = Self;
/// dox
fn dummy(&self) {}
}
impl Foo {
pub fn foo() {}
fn bar() {}