Skip to content

Commit

Permalink
Rollup merge of rust-lang#53559 - Dylan-DPC:fix/missing-doc-lint, r=k…
Browse files Browse the repository at this point in the history
…ennytm

add macro check for lint

Fixes rust-lang#53537
  • Loading branch information
kennytm authored Aug 24, 2018
2 parents 973428d + 747722e commit 7f396ba
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode {
declare_lint! {
pub MISSING_DOCS,
Allow,
"detects missing documentation for public members"
"detects missing documentation for public members",
report_in_external_macro: true
}

pub struct MissingDoc {
Expand Down
5 changes: 4 additions & 1 deletion src/test/ui/lint/lints-in-foreign-macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
// aux-build:lints-in-foreign-macros.rs
// compile-pass

#![warn(unused_imports)]
#![warn(unused_imports)] //~ missing documentation for crate [missing_docs]
#![warn(missing_docs)]

#[macro_use]
extern crate lints_in_foreign_macros;
Expand All @@ -24,5 +25,7 @@ mod a { foo!(); }
mod b { bar!(); }
mod c { baz!(use std::string::ToString;); } //~ WARN: unused import
mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import
baz!(pub fn undocumented() {}); //~ WARN: missing documentation for a function
baz2!(pub fn undocumented2() {}); //~ WARN: missing documentation for a function

fn main() {}
38 changes: 34 additions & 4 deletions src/test/ui/lint/lints-in-foreign-macros.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:20:16
--> $DIR/lints-in-foreign-macros.rs:21:16
|
LL | () => {use std::string::ToString;} //~ WARN: unused import
| ^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -10,18 +10,48 @@ LL | mod a { foo!(); }
note: lint level defined here
--> $DIR/lints-in-foreign-macros.rs:14:9
|
LL | #![warn(unused_imports)]
LL | #![warn(unused_imports)] //~ missing documentation for crate [missing_docs]
| ^^^^^^^^^^^^^^

warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:25:18
--> $DIR/lints-in-foreign-macros.rs:26:18
|
LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import
| ^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:26:19
--> $DIR/lints-in-foreign-macros.rs:27:19
|
LL | mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import
| ^^^^^^^^^^^^^^^^^^^^^

warning: missing documentation for crate
--> $DIR/lints-in-foreign-macros.rs:14:1
|
LL | / #![warn(unused_imports)] //~ missing documentation for crate [missing_docs]
LL | | #![warn(missing_docs)]
LL | |
LL | | #[macro_use]
... |
LL | |
LL | | fn main() {}
| |____________^
|
note: lint level defined here
--> $DIR/lints-in-foreign-macros.rs:15:9
|
LL | #![warn(missing_docs)]
| ^^^^^^^^^^^^

warning: missing documentation for a function
--> $DIR/lints-in-foreign-macros.rs:28:6
|
LL | baz!(pub fn undocumented() {}); //~ WARN: missing documentation for a function
| ^^^^^^^^^^^^^^^^^^^^^

warning: missing documentation for a function
--> $DIR/lints-in-foreign-macros.rs:29:7
|
LL | baz2!(pub fn undocumented2() {}); //~ WARN: missing documentation for a function
| ^^^^^^^^^^^^^^^^^^^^^^

0 comments on commit 7f396ba

Please sign in to comment.