mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Rollup merge of #94529 - GuillaumeGomez:unused-doc-comments-blocks, r=estebank
Unused doc comments blocks Fixes #77030.
This commit is contained in:
commit
878a4ff90e
@ -576,12 +576,12 @@ pub enum PassKind {
|
||||
Module,
|
||||
}
|
||||
|
||||
/// LLVMRustThinLTOData
|
||||
// LLVMRustThinLTOData
|
||||
extern "C" {
|
||||
pub type ThinLTOData;
|
||||
}
|
||||
|
||||
/// LLVMRustThinLTOBuffer
|
||||
// LLVMRustThinLTOBuffer
|
||||
extern "C" {
|
||||
pub type ThinLTOBuffer;
|
||||
}
|
||||
|
@ -1086,6 +1086,16 @@ impl EarlyLintPass for UnusedDocComment {
|
||||
fn check_generic_param(&mut self, cx: &EarlyContext<'_>, param: &ast::GenericParam) {
|
||||
warn_if_doc(cx, param.ident.span, "generic parameters", ¶m.attrs);
|
||||
}
|
||||
|
||||
fn check_block(&mut self, cx: &EarlyContext<'_>, block: &ast::Block) {
|
||||
warn_if_doc(cx, block.span, "block", &block.attrs());
|
||||
}
|
||||
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &ast::Item) {
|
||||
if let ast::ItemKind::ForeignMod(_) = item.kind {
|
||||
warn_if_doc(cx, item.span, "extern block", &item.attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
|
@ -18,9 +18,10 @@
|
||||
//!
|
||||
//! Unless stated otherwise, all intrinsics for binary operations require SIMD vectors of equal types and lengths.
|
||||
|
||||
/// These intrinsics aren't linked directly from LLVM and are mostly undocumented, however they are
|
||||
/// mostly lowered to the matching LLVM instructions by the compiler in a fairly straightforward manner.
|
||||
/// The associated LLVM instruction or intrinsic is documented alongside each Rust intrinsic function.
|
||||
|
||||
// These intrinsics aren't linked directly from LLVM and are mostly undocumented, however they are
|
||||
// mostly lowered to the matching LLVM instructions by the compiler in a fairly straightforward manner.
|
||||
// The associated LLVM instruction or intrinsic is documented alongside each Rust intrinsic function.
|
||||
extern "platform-intrinsic" {
|
||||
/// add/fadd
|
||||
pub(crate) fn simd_add<T>(x: T, y: T) -> T;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit b4a0e07552cf90ef8f1a5b775bf70e4db94b3d63
|
||||
Subproject commit bcbe010614f398ec86f3a9274d22e33e5f2ee60b
|
@ -29,4 +29,18 @@ fn doc_comment_on_expr(num: u8) -> bool {
|
||||
fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
|
||||
//~^ ERROR: unused doc comment
|
||||
|
||||
fn doc_comment_on_block() {
|
||||
/// unused doc comment
|
||||
//~^ ERROR: unused doc comment
|
||||
{
|
||||
let x = 12;
|
||||
}
|
||||
}
|
||||
|
||||
/// unused doc comment
|
||||
//~^ ERROR: unused doc comment
|
||||
extern "C" {
|
||||
fn foo();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -49,6 +49,32 @@ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
|
||||
|
|
||||
= help: use `//` for a plain comment
|
||||
|
||||
error: unused doc comment
|
||||
--> $DIR/unused-doc-comments-edge-cases.rs:33:5
|
||||
|
|
||||
LL | /// unused doc comment
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL |
|
||||
LL | / {
|
||||
LL | | let x = 12;
|
||||
LL | | }
|
||||
| |_____- rustdoc does not generate documentation for expressions
|
||||
|
|
||||
= help: use `//` for a plain comment
|
||||
|
||||
error: unused doc comment
|
||||
--> $DIR/unused-doc-comments-edge-cases.rs:40:1
|
||||
|
|
||||
LL | /// unused doc comment
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL |
|
||||
LL | / extern "C" {
|
||||
LL | | fn foo();
|
||||
LL | | }
|
||||
| |_- rustdoc does not generate documentation for extern block
|
||||
|
|
||||
= help: use `//` for a plain comment
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/unused-doc-comments-edge-cases.rs:14:9
|
||||
|
|
||||
@ -63,7 +89,7 @@ help: you might have meant to return this value
|
||||
LL | return true;
|
||||
| ++++++ +
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0658.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
Loading…
Reference in New Issue
Block a user