Skip to content

Commit

Permalink
Auto merge of rust-lang#3657 - roblabla:bugfix-missing-docs-global-as…
Browse files Browse the repository at this point in the history
…m, r=phansch

Missing docs: don't require documenting Global Asm items.

global_asm! items cannot be documented, the lint still gets triggered after adding documentation to the macro invocation. Furthermore, even if we could add documentation to the AST node, rustdoc doesn't render it anyways.

Playground example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=5182df182f0ffbbab4c3107e43368ac3
  • Loading branch information
bors committed Jan 14, 2019
2 parents 11ba624 + 7920365 commit 19553ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/missing_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
hir::ItemKind::Struct(..) => "a struct",
hir::ItemKind::Trait(..) => "a trait",
hir::ItemKind::TraitAlias(..) => "a trait alias",
hir::ItemKind::GlobalAsm(..) => "an assembly blob",
hir::ItemKind::Ty(..) => "a type alias",
hir::ItemKind::Union(..) => "a union",
hir::ItemKind::Existential(..) => "an existential type",
hir::ItemKind::ExternCrate(..)
| hir::ItemKind::ForeignMod(..)
| hir::ItemKind::GlobalAsm(..)
| hir::ItemKind::Impl(..)
| hir::ItemKind::Use(..) => return,
};
Expand Down
5 changes: 4 additions & 1 deletion tests/ui/missing-doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// When denying at the crate level, be sure to not get random warnings from the
// injected intrinsics by the compiler.
#![allow(dead_code)]
#![feature(associated_type_defaults)]
#![feature(associated_type_defaults, global_asm)]

//! Some garbage docs for the crate here
#![doc = "More garbage"]
Expand Down Expand Up @@ -176,3 +176,6 @@ pub mod public_interface {
}

fn main() {}

// Ensure global asm doesn't require documentation.
global_asm! { "" }

0 comments on commit 19553ae

Please sign in to comment.