Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c5975e9
Reduce duplicate in liballoc reserve error handling
pickfire Aug 4, 2020
28db521
More implementations of Write for immutable refs
Sep 2, 2020
ec7f9b9
Deduplicates io::Write implementations
Sep 11, 2020
8f27e3c
Make some methods of `Pin` unstable const
CDirkx Sep 12, 2020
eede953
Only get ImplKind::Impl once
tesuji Sep 10, 2020
ed6c7ef
Use enum for status of non-const ops
ecstatic-morse Sep 2, 2020
c3607bd
Use helper function for searching `allow_internal_unstable`
ecstatic-morse Sep 2, 2020
e4edc16
Give name to extra `Span` in `LiveDrop` error
ecstatic-morse Sep 2, 2020
81b3b66
Error if an unstable const eval feature is used in a stable const fn
ecstatic-morse Sep 3, 2020
1e1257b
Bless `miri-unleashed` tests
ecstatic-morse Sep 16, 2020
abc7167
Test that `const_precise_live_drops` can't be depended upon stably
ecstatic-morse Sep 16, 2020
e3c6e46
Make some methods of `Pin<&mut T>` unstable const
CDirkx Sep 18, 2020
f7d5080
don't take `TyCtxt` by reference
lcnr Sep 18, 2020
a219ad6
extend `is_ty_or_ty_ctxt` to self types
lcnr Sep 19, 2020
67f319c
take `TyCtxt` by value
lcnr Sep 19, 2020
2a00dda
miri: correctly deal with `ConstKind::Bound`
lcnr Sep 10, 2020
6734230
do not ICE on `ty::Bound` in Layout::compute
lcnr Sep 11, 2020
65b3419
update stderr file
lcnr Sep 20, 2020
c690c82
use if let instead of single match arm expressions to compact code an…
matthiaskrgr Sep 18, 2020
88a29e6
Updates stability attributes to the current nightly version
Sep 21, 2020
0acb0ed
Update library/std/src/process.rs
FedericoPonzi Sep 21, 2020
60b102d
Don't recommend ManuallyDrop to customize drop order
matklad Aug 31, 2020
b4b4a2f
Reduce boilerplate for BytePos and CharPos
Juici Sep 21, 2020
8fc782a
add test
lcnr Sep 21, 2020
9a1f177
Remove cast to usize for BytePos and CharPos
Juici Sep 21, 2020
63195ec
Add explanation for E0756
GuillaumeGomez Sep 8, 2020
f5d71a9
Don't use `zip` to compare iterators during pretty-print hack
Aaron1011 Aug 30, 2020
d452744
lint missing docs for extern items
lcnr Sep 21, 2020
11f7bfa
Rollup merge of #72734 - pickfire:liballoc, r=KodrAus
ecstatic-morse Sep 22, 2020
dc42aa8
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
ecstatic-morse Sep 22, 2020
4f3697b
Rollup merge of #76150 - matklad:droporder, r=withoutboats
ecstatic-morse Sep 22, 2020
65bdf79
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=…
ecstatic-morse Sep 22, 2020
ef6c3a7
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
ecstatic-morse Sep 22, 2020
30f1bab
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
ecstatic-morse Sep 22, 2020
537ede4
Rollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse
ecstatic-morse Sep 22, 2020
b3433c7
Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez
ecstatic-morse Sep 22, 2020
60b9901
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=…
ecstatic-morse Sep 22, 2020
dcf4d1f
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
ecstatic-morse Sep 22, 2020
50d4aeb
Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse
ecstatic-morse Sep 22, 2020
359615b
Rollup merge of #77022 - Juici:master, r=lcnr
ecstatic-morse Sep 22, 2020
0863f9a
Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
ecstatic-morse Sep 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint missing docs for extern items
  • Loading branch information
lcnr committed Sep 21, 2020
commit d452744100203c9f75202079ce7c8ad8aa1bdf02
13 changes: 13 additions & 0 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<'_>) {
if !sf.is_positional() {
self.check_missing_docs_attrs(
Expand Down
19 changes: 18 additions & 1 deletion src/test/ui/lint/lint-missing-doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// injected intrinsics by the compiler.
#![deny(missing_docs)]
#![allow(dead_code)]
#![feature(associated_type_defaults)]
#![feature(associated_type_defaults, extern_types)]

//! Some garbage docs for the crate here
#![doc="More garbage"]
Expand Down Expand Up @@ -183,4 +183,21 @@ pub mod public_interface {
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() {}
20 changes: 19 additions & 1 deletion src/test/ui/lint/lint-missing-doc.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,23 @@ error: missing documentation for a function
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