Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
lint missing docs for extern items fixes #76991
This commit is contained in:
commit
0863f9a965
3 changed files with 50 additions and 2 deletions
|
@ -613,6 +613,19 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn check_foreign_item(&mut self, cx: &LateContext<'_>, foreign_item: &hir::ForeignItem<'_>) {
|
||||||
|
let def_id = cx.tcx.hir().local_def_id(foreign_item.hir_id);
|
||||||
|
let (article, desc) = cx.tcx.article_and_description(def_id.to_def_id());
|
||||||
|
self.check_missing_docs_attrs(
|
||||||
|
cx,
|
||||||
|
Some(foreign_item.hir_id),
|
||||||
|
&foreign_item.attrs,
|
||||||
|
foreign_item.span,
|
||||||
|
article,
|
||||||
|
desc,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn check_struct_field(&mut self, cx: &LateContext<'_>, sf: &hir::StructField<'_>) {
|
fn check_struct_field(&mut self, cx: &LateContext<'_>, sf: &hir::StructField<'_>) {
|
||||||
if !sf.is_positional() {
|
if !sf.is_positional() {
|
||||||
self.check_missing_docs_attrs(
|
self.check_missing_docs_attrs(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// injected intrinsics by the compiler.
|
// injected intrinsics by the compiler.
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![feature(associated_type_defaults)]
|
#![feature(associated_type_defaults, extern_types)]
|
||||||
|
|
||||||
//! Some garbage docs for the crate here
|
//! Some garbage docs for the crate here
|
||||||
#![doc="More garbage"]
|
#![doc="More garbage"]
|
||||||
|
@ -183,4 +183,21 @@ pub mod public_interface {
|
||||||
pub use internal_impl::globbed::*;
|
pub use internal_impl::globbed::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
/// dox
|
||||||
|
pub fn extern_fn_documented(f: f32) -> f32;
|
||||||
|
pub fn extern_fn_undocumented(f: f32) -> f32;
|
||||||
|
//~^ ERROR: missing documentation for a function
|
||||||
|
|
||||||
|
/// dox
|
||||||
|
pub static EXTERN_STATIC_DOCUMENTED: u8;
|
||||||
|
pub static EXTERN_STATIC_UNDOCUMENTED: u8;
|
||||||
|
//~^ ERROR: missing documentation for a static
|
||||||
|
|
||||||
|
/// dox
|
||||||
|
pub type ExternTyDocumented;
|
||||||
|
pub type ExternTyUndocumented;
|
||||||
|
//~^ ERROR: missing documentation for a foreign type
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -118,5 +118,23 @@ error: missing documentation for a function
|
||||||
LL | pub fn also_undocumented1() {}
|
LL | pub fn also_undocumented1() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 19 previous errors
|
error: missing documentation for a function
|
||||||
|
--> $DIR/lint-missing-doc.rs:189:5
|
||||||
|
|
|
||||||
|
LL | pub fn extern_fn_undocumented(f: f32) -> f32;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: missing documentation for a static
|
||||||
|
--> $DIR/lint-missing-doc.rs:194:5
|
||||||
|
|
|
||||||
|
LL | pub static EXTERN_STATIC_UNDOCUMENTED: u8;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: missing documentation for a foreign type
|
||||||
|
--> $DIR/lint-missing-doc.rs:199:5
|
||||||
|
|
|
||||||
|
LL | pub type ExternTyUndocumented;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 22 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue