File tree 3 files changed +50
-2
lines changed
3 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -613,6 +613,19 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
613
613
) ;
614
614
}
615
615
616
+ fn check_foreign_item ( & mut self , cx : & LateContext < ' _ > , foreign_item : & hir:: ForeignItem < ' _ > ) {
617
+ let def_id = cx. tcx . hir ( ) . local_def_id ( foreign_item. hir_id ) ;
618
+ let ( article, desc) = cx. tcx . article_and_description ( def_id. to_def_id ( ) ) ;
619
+ self . check_missing_docs_attrs (
620
+ cx,
621
+ Some ( foreign_item. hir_id ) ,
622
+ & foreign_item. attrs ,
623
+ foreign_item. span ,
624
+ article,
625
+ desc,
626
+ ) ;
627
+ }
628
+
616
629
fn check_struct_field ( & mut self , cx : & LateContext < ' _ > , sf : & hir:: StructField < ' _ > ) {
617
630
if !sf. is_positional ( ) {
618
631
self . check_missing_docs_attrs (
Original file line number Diff line number Diff line change 2
2
// injected intrinsics by the compiler.
3
3
#![ deny( missing_docs) ]
4
4
#![ allow( dead_code) ]
5
- #![ feature( associated_type_defaults) ]
5
+ #![ feature( associated_type_defaults, extern_types ) ]
6
6
7
7
//! Some garbage docs for the crate here
8
8
#![ doc="More garbage" ]
@@ -183,4 +183,21 @@ pub mod public_interface {
183
183
pub use internal_impl:: globbed:: * ;
184
184
}
185
185
186
+ extern "C" {
187
+ /// dox
188
+ pub fn extern_fn_documented ( f : f32 ) -> f32 ;
189
+ pub fn extern_fn_undocumented ( f : f32 ) -> f32 ;
190
+ //~^ ERROR: missing documentation for a function
191
+
192
+ /// dox
193
+ pub static EXTERN_STATIC_DOCUMENTED : u8 ;
194
+ pub static EXTERN_STATIC_UNDOCUMENTED : u8 ;
195
+ //~^ ERROR: missing documentation for a static
196
+
197
+ /// dox
198
+ pub type ExternTyDocumented ;
199
+ pub type ExternTyUndocumented ;
200
+ //~^ ERROR: missing documentation for a foreign type
201
+ }
202
+
186
203
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -118,5 +118,23 @@ error: missing documentation for a function
118
118
LL | pub fn also_undocumented1() {}
119
119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
120
120
121
- error: aborting due to 19 previous errors
121
+ error: missing documentation for a function
122
+ --> $DIR/lint-missing-doc.rs:189:5
123
+ |
124
+ LL | pub fn extern_fn_undocumented(f: f32) -> f32;
125
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126
+
127
+ error: missing documentation for a static
128
+ --> $DIR/lint-missing-doc.rs:194:5
129
+ |
130
+ LL | pub static EXTERN_STATIC_UNDOCUMENTED: u8;
131
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132
+
133
+ error: missing documentation for a foreign type
134
+ --> $DIR/lint-missing-doc.rs:199:5
135
+ |
136
+ LL | pub type ExternTyUndocumented;
137
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138
+
139
+ error: aborting due to 22 previous errors
122
140
You can’t perform that action at this time.
0 commit comments