make missing_doc lint respect the visibility rules
Previously, the `exported_items` set created by the privacy pass was incomplete. Specifically, it did not include items that had been defined at a private path but then `pub use`d at a public path. This commit finds all crate exports during the privacy pass. Consequently, some code in the reachable pass and in rustdoc is no longer necessary. This commit then removes the separate `MissingDocLintVisitor` lint pass, opting to check missing_doc lint in the same pass as the other lint checkers using the visibility result computed by the privacy pass. Fixes #9777.
This commit is contained in:
parent
4d9b95fada
commit
1f7eb4f9aa
8 changed files with 252 additions and 243 deletions
|
|
@ -11,6 +11,7 @@
|
|||
// When denying at the crate level, be sure to not get random warnings from the
|
||||
// injected intrinsics by the compiler.
|
||||
#[feature(struct_variant)];
|
||||
#[feature(globs)];
|
||||
#[deny(missing_doc)];
|
||||
|
||||
struct Foo {
|
||||
|
|
@ -39,16 +40,21 @@ fn foo3() {}
|
|||
#[allow(missing_doc)] pub fn foo4() {}
|
||||
|
||||
/// dox
|
||||
pub trait A {}
|
||||
trait B {}
|
||||
pub trait C {} //~ ERROR: missing documentation
|
||||
#[allow(missing_doc)] pub trait D {}
|
||||
|
||||
trait Bar {
|
||||
pub trait A {
|
||||
/// dox
|
||||
fn foo();
|
||||
fn foo_with_impl() {
|
||||
}
|
||||
/// dox
|
||||
fn foo_with_impl() {}
|
||||
}
|
||||
trait B {
|
||||
fn foo();
|
||||
fn foo_with_impl() {}
|
||||
}
|
||||
pub trait C { //~ ERROR: missing documentation
|
||||
fn foo(); //~ ERROR: missing documentation
|
||||
fn foo_with_impl() {} //~ ERROR: missing documentation
|
||||
}
|
||||
#[allow(missing_doc)] pub trait D {}
|
||||
|
||||
impl Foo {
|
||||
pub fn foo() {} //~ ERROR: missing documentation
|
||||
|
|
@ -120,4 +126,26 @@ pub enum PubBaz3 {
|
|||
#[doc(hidden)]
|
||||
pub fn baz() {}
|
||||
|
||||
mod internal_impl {
|
||||
/// dox
|
||||
pub fn documented() {}
|
||||
pub fn undocumented1() {} //~ ERROR: missing documentation
|
||||
pub fn undocumented2() {} //~ ERROR: missing documentation
|
||||
fn undocumented3() {}
|
||||
/// dox
|
||||
pub mod globbed {
|
||||
/// dox
|
||||
pub fn also_documented() {}
|
||||
pub fn also_undocumented1() {} //~ ERROR: missing documentation
|
||||
fn also_undocumented2() {}
|
||||
}
|
||||
}
|
||||
/// dox
|
||||
pub mod public_interface {
|
||||
pub use foo = internal_impl::documented;
|
||||
pub use bar = internal_impl::undocumented1;
|
||||
pub use internal_impl::{documented, undocumented2};
|
||||
pub use internal_impl::globbed::*;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue