Skip to content

Commit

Permalink
Update missing-docs lint to check associated type declarations
Browse files Browse the repository at this point in the history
[breaking-change]

Fixes #20648
  • Loading branch information
ipetkov committed Feb 23, 2015
1 parent dab394c commit 717a91d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustc/lint/builtin.rs
Expand Up @@ -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 {
Expand Down
13 changes: 13 additions & 0 deletions src/test/compile-fail/lint-missing-doc.rs
Expand Up @@ -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() {}
Expand Down

0 comments on commit 717a91d

Please sign in to comment.