Introduce missing ABI lint on extern blocks
This commit is contained in:
@@ -2917,6 +2917,7 @@ declare_lint_pass! {
|
||||
FUNCTION_ITEM_REFERENCES,
|
||||
USELESS_DEPRECATED,
|
||||
UNSUPPORTED_NAKED_FUNCTIONS,
|
||||
MISSING_ABI,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2944,3 +2945,28 @@ declare_lint! {
|
||||
}
|
||||
|
||||
declare_lint_pass!(UnusedDocComment => [UNUSED_DOC_COMMENTS]);
|
||||
|
||||
declare_lint! {
|
||||
/// The `missing_abi` lint detects cases where the ABI is omitted from
|
||||
/// extern declarations.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// #![deny(missing_abi)]
|
||||
///
|
||||
/// extern fn foo() {}
|
||||
/// ```
|
||||
///
|
||||
/// {{produces}}
|
||||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
/// Historically, Rust implicitly selected C as the ABI for extern
|
||||
/// declarations. We expect to add new ABIs, like `C-unwind`, in the future,
|
||||
/// though this has not yet happened, and especially with their addition
|
||||
/// seeing the ABI easily will make code review easier.
|
||||
pub MISSING_ABI,
|
||||
Allow,
|
||||
"No declared ABI for extern declaration"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user