Auto merge of #119220 - Urgau:uplift-invalid_null_ptr_usage, r=fee1-dead
Uplift `clippy::invalid_null_ptr_usage` lint as `invalid_null_arguments` This PR aims at uplifting the `clippy::invalid_null_ptr_usage` lint into rustc, this is similar to the [`clippy::invalid_utf8_in_unchecked` uplift](https://github.com/rust-lang/rust/pull/111543) a few months ago, in the sense that those two lints lint on invalid parameter(s), here a null pointer where it is unexpected and UB to pass one. *For context: GitHub Search reveals that just for `slice::from_raw_parts{_mut}` [~20 invalid usages](hhttps://github.com/search?q=lang%3Arust+%2Fslice%3A%3Afrom_raw_parts%28_mut%29%3F%5C%28ptr%3A%3Anull%2F+NOT+path%3A%2F%5Eclippy_lints%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Erust%5C%2Fsrc%5C%2Ftools%5C%2Fclippy%5C%2Fclippy_lints%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Esrc%5C%2Ftools%5C%2Fclippy%5C%2Fclippy_lints%5C%2Fsrc%5C%2F%2F&type=code) with `ptr::null` and an additional [4 invalid usages](https://github.com/search?q=lang%3Arust+%2Fslice%3A%3Afrom_raw_parts%5C%280%28%5C%29%7C+as%29%2F+NOT+path%3A%2F%5Eclippy_lints%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Erust%5C%2Fsrc%5C%2Ftools%5C%2Fclippy%5C%2Fclippy_lints%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Esrc%5C%2Ftools%5C%2Fclippy%5C%2Fclippy_lints%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Eutils%5C%2Ftinystr%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Eutils%5C%2Fzerovec%5C%2Fsrc%5C%2F%2F+NOT+path%3A%2F%5Eprovider%5C%2Fcore%5C%2Fsrc%5C%2F%2F&type=code) with `0 as *const ...`-ish casts.* ----- ## `invalid_null_arguments` (deny-by-default) The `invalid_null_arguments` lint checks for invalid usage of null pointers. ### Example ```rust // Undefined behavior unsafe { std::slice::from_raw_parts(ptr::null(), 1); } ``` Produces: ``` error: calling this function with a null pointer is Undefined Behavior, even if the result of the function is unused --> $DIR/invalid_null_args.rs:21:23 | LL | let _: &[usize] = std::slice::from_raw_parts(ptr::null_mut(), 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^ | | | null pointer originates from here | = help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html> ``` ### Explanation Calling methods whose safety invariants requires non-null pointer with a null pointer is undefined behavior. ----- The lint use a list of functions to know which functions and arguments to checks, this could be improved in the future with a rustc attribute, or maybe even with a `#[diagnostic]` attribute. This PR also includes some small refactoring to avoid some ambiguities in naming, those can be done in another PR is desired. `@rustbot` label: +I-lang-nominated r? compiler
This commit is contained in:
commit
7bfd9529be
30 changed files with 713 additions and 719 deletions
|
|
@ -638,7 +638,6 @@ pub static LINTS: &[&crate::LintInfo] = &[
|
|||
crate::precedence::PRECEDENCE_INFO,
|
||||
crate::precedence::PRECEDENCE_BITS_INFO,
|
||||
crate::ptr::CMP_NULL_INFO,
|
||||
crate::ptr::INVALID_NULL_PTR_USAGE_INFO,
|
||||
crate::ptr::MUT_FROM_REF_INFO,
|
||||
crate::ptr::PTR_ARG_INFO,
|
||||
crate::ptr::PTR_EQ_INFO,
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ declare_with_version! { RENAMED(RENAMED_VERSION): &[(&str, &str)] = &[
|
|||
("clippy::clone_double_ref", "suspicious_double_ref_op"),
|
||||
#[clippy::version = ""]
|
||||
("clippy::cmp_nan", "invalid_nan_comparisons"),
|
||||
#[clippy::version = "CURRENT_RUSTC_VERSION"]
|
||||
("clippy::invalid_null_ptr_usage", "invalid_null_arguments"),
|
||||
#[clippy::version = "1.86.0"]
|
||||
("clippy::double_neg", "double_negations"),
|
||||
#[clippy::version = ""]
|
||||
|
|
|
|||
|
|
@ -125,29 +125,6 @@ declare_clippy_lint! {
|
|||
"fns that create mutable refs from immutable ref args"
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// This lint checks for invalid usages of `ptr::null`.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// This causes undefined behavior.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```ignore
|
||||
/// // Undefined behavior
|
||||
/// unsafe { std::slice::from_raw_parts(ptr::null(), 0); }
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```ignore
|
||||
/// unsafe { std::slice::from_raw_parts(NonNull::dangling().as_ptr(), 0); }
|
||||
/// ```
|
||||
#[clippy::version = "1.53.0"]
|
||||
pub INVALID_NULL_PTR_USAGE,
|
||||
correctness,
|
||||
"invalid usage of a null pointer, suggesting `NonNull::dangling()` instead"
|
||||
}
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Use `std::ptr::eq` when applicable
|
||||
|
|
@ -177,7 +154,7 @@ declare_clippy_lint! {
|
|||
"use `std::ptr::eq` when comparing raw pointers"
|
||||
}
|
||||
|
||||
declare_lint_pass!(Ptr => [PTR_ARG, CMP_NULL, MUT_FROM_REF, INVALID_NULL_PTR_USAGE, PTR_EQ]);
|
||||
declare_lint_pass!(Ptr => [PTR_ARG, CMP_NULL, MUT_FROM_REF, PTR_EQ]);
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for Ptr {
|
||||
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'_>) {
|
||||
|
|
@ -301,54 +278,6 @@ impl<'tcx> LateLintPass<'tcx> for Ptr {
|
|||
format!("{non_null_path_snippet}.is_null()"),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else {
|
||||
check_invalid_ptr_usage(cx, expr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_invalid_ptr_usage<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
if let ExprKind::Call(fun, args) = expr.kind
|
||||
&& let ExprKind::Path(ref qpath) = fun.kind
|
||||
&& let Some(fun_def_id) = cx.qpath_res(qpath, fun.hir_id).opt_def_id()
|
||||
&& let Some(name) = cx.tcx.get_diagnostic_name(fun_def_id)
|
||||
{
|
||||
// TODO: `ptr_slice_from_raw_parts` and its mutable variant should probably still be linted
|
||||
// conditionally based on how the return value is used, but not universally like the other
|
||||
// functions since there are valid uses for null slice pointers.
|
||||
//
|
||||
// See: https://github.com/rust-lang/rust-clippy/pull/13452/files#r1773772034
|
||||
|
||||
// `arg` positions where null would cause U.B.
|
||||
let arg_indices: &[_] = match name {
|
||||
sym::ptr_read
|
||||
| sym::ptr_read_unaligned
|
||||
| sym::ptr_read_volatile
|
||||
| sym::ptr_replace
|
||||
| sym::ptr_write
|
||||
| sym::ptr_write_bytes
|
||||
| sym::ptr_write_unaligned
|
||||
| sym::ptr_write_volatile
|
||||
| sym::slice_from_raw_parts
|
||||
| sym::slice_from_raw_parts_mut => &[0],
|
||||
sym::ptr_copy | sym::ptr_copy_nonoverlapping | sym::ptr_swap | sym::ptr_swap_nonoverlapping => &[0, 1],
|
||||
_ => return,
|
||||
};
|
||||
|
||||
for &arg_idx in arg_indices {
|
||||
if let Some(arg) = args.get(arg_idx).filter(|arg| is_null_path(cx, arg))
|
||||
&& let Some(std_or_core) = std_or_core(cx)
|
||||
{
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
INVALID_NULL_PTR_USAGE,
|
||||
arg.span,
|
||||
"pointer must be non-null",
|
||||
"change this to",
|
||||
format!("{std_or_core}::ptr::NonNull::dangling().as_ptr()"),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//@ check-pass
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
#![allow(dead_code, unused_variables, invalid_null_arguments)]
|
||||
#![allow(clippy::unnecessary_cast, clippy::missing_transmute_annotations)]
|
||||
|
||||
/// Should not trigger an ICE in `SpanlessEq` / `consts::constant`
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
fn main() {
|
||||
unsafe {
|
||||
let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _slice: &[usize] = std::slice::from_raw_parts_mut(std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::copy::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::copy::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::copy_nonoverlapping::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::copy_nonoverlapping::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
struct A; // zero sized struct
|
||||
assert_eq!(std::mem::size_of::<A>(), 0);
|
||||
|
||||
let _a: A = std::ptr::read(std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = std::ptr::read(std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = std::ptr::read_unaligned(std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = std::ptr::read_unaligned(std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = std::ptr::read_volatile(std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = std::ptr::read_volatile(std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = std::ptr::replace(std::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null_mut(), 0); // shouldn't lint
|
||||
let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(std::ptr::null_mut(), 0);
|
||||
|
||||
std::ptr::swap::<A>(std::ptr::NonNull::dangling().as_ptr(), &mut A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::swap::<A>(&mut A, std::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::swap_nonoverlapping::<A>(std::ptr::NonNull::dangling().as_ptr(), &mut A, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::swap_nonoverlapping::<A>(&mut A, std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write(std::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write_unaligned(std::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write_volatile(std::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write_bytes::<usize>(std::ptr::NonNull::dangling().as_ptr(), 42, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
fn main() {
|
||||
unsafe {
|
||||
let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _slice: &[usize] = std::slice::from_raw_parts_mut(std::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::copy::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::copy::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::copy_nonoverlapping::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::copy_nonoverlapping::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
struct A; // zero sized struct
|
||||
assert_eq!(std::mem::size_of::<A>(), 0);
|
||||
|
||||
let _a: A = std::ptr::read(std::ptr::null());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = std::ptr::read(std::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = std::ptr::read_unaligned(std::ptr::null());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = std::ptr::read_unaligned(std::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = std::ptr::read_volatile(std::ptr::null());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = std::ptr::read_volatile(std::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = std::ptr::replace(std::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null_mut(), 0); // shouldn't lint
|
||||
let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(std::ptr::null_mut(), 0);
|
||||
|
||||
std::ptr::swap::<A>(std::ptr::null_mut(), &mut A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::swap::<A>(&mut A, std::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::swap_nonoverlapping::<A>(std::ptr::null_mut(), &mut A, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
std::ptr::swap_nonoverlapping::<A>(&mut A, std::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write(std::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write_unaligned(std::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write_volatile(std::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
std::ptr::write_bytes::<usize>(std::ptr::null_mut(), 42, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
}
|
||||
}
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:3:59
|
||||
|
|
||||
LL | let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null(), 0);
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
|
||||
= note: `#[deny(clippy::invalid_null_ptr_usage)]` on by default
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:5:59
|
||||
|
|
||||
LL | let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:8:63
|
||||
|
|
||||
LL | let _slice: &[usize] = std::slice::from_raw_parts_mut(std::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:11:33
|
||||
|
|
||||
LL | std::ptr::copy::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:13:73
|
||||
|
|
||||
LL | std::ptr::copy::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:16:48
|
||||
|
|
||||
LL | std::ptr::copy_nonoverlapping::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:18:88
|
||||
|
|
||||
LL | std::ptr::copy_nonoverlapping::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:24:36
|
||||
|
|
||||
LL | let _a: A = std::ptr::read(std::ptr::null());
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:26:36
|
||||
|
|
||||
LL | let _a: A = std::ptr::read(std::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:29:46
|
||||
|
|
||||
LL | let _a: A = std::ptr::read_unaligned(std::ptr::null());
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:31:46
|
||||
|
|
||||
LL | let _a: A = std::ptr::read_unaligned(std::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:34:45
|
||||
|
|
||||
LL | let _a: A = std::ptr::read_volatile(std::ptr::null());
|
||||
| ^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:36:45
|
||||
|
|
||||
LL | let _a: A = std::ptr::read_volatile(std::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:39:39
|
||||
|
|
||||
LL | let _a: A = std::ptr::replace(std::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:44:29
|
||||
|
|
||||
LL | std::ptr::swap::<A>(std::ptr::null_mut(), &mut A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:46:37
|
||||
|
|
||||
LL | std::ptr::swap::<A>(&mut A, std::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:49:44
|
||||
|
|
||||
LL | std::ptr::swap_nonoverlapping::<A>(std::ptr::null_mut(), &mut A, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:51:52
|
||||
|
|
||||
LL | std::ptr::swap_nonoverlapping::<A>(&mut A, std::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:54:25
|
||||
|
|
||||
LL | std::ptr::write(std::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:57:35
|
||||
|
|
||||
LL | std::ptr::write_unaligned(std::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:60:34
|
||||
|
|
||||
LL | std::ptr::write_volatile(std::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage.rs:63:40
|
||||
|
|
||||
LL | std::ptr::write_bytes::<usize>(std::ptr::null_mut(), 42, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `std::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: aborting due to 22 previous errors
|
||||
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
#![no_std]
|
||||
#![feature(lang_items)]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
extern "C" fn eh_personality() {}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let _slice: &[usize] = core::slice::from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: &[usize] = core::slice::from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _slice: &[usize] = core::slice::from_raw_parts_mut(core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::copy::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::copy::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::copy_nonoverlapping::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::copy_nonoverlapping::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
struct A; // zero sized struct
|
||||
assert_eq!(core::mem::size_of::<A>(), 0);
|
||||
|
||||
let _a: A = core::ptr::read(core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = core::ptr::read(core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = core::ptr::read_unaligned(core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = core::ptr::read_unaligned(core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = core::ptr::read_volatile(core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = core::ptr::read_volatile(core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = core::ptr::replace(core::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: *const [usize] = core::ptr::slice_from_raw_parts(core::ptr::null_mut(), 0); // shouldn't lint
|
||||
let _slice: *const [usize] = core::ptr::slice_from_raw_parts_mut(core::ptr::null_mut(), 0);
|
||||
|
||||
core::ptr::swap::<A>(core::ptr::NonNull::dangling().as_ptr(), &mut A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::swap::<A>(&mut A, core::ptr::NonNull::dangling().as_ptr());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::swap_nonoverlapping::<A>(core::ptr::NonNull::dangling().as_ptr(), &mut A, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::swap_nonoverlapping::<A>(&mut A, core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write(core::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write_unaligned(core::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write_volatile(core::ptr::NonNull::dangling().as_ptr(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write_bytes::<usize>(core::ptr::NonNull::dangling().as_ptr(), 42, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
#![no_std]
|
||||
#![feature(lang_items)]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
extern "C" fn eh_personality() {}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
let _slice: &[usize] = core::slice::from_raw_parts(core::ptr::null(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: &[usize] = core::slice::from_raw_parts(core::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _slice: &[usize] = core::slice::from_raw_parts_mut(core::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::copy::<usize>(core::ptr::null(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::copy::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::copy_nonoverlapping::<usize>(core::ptr::null(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::copy_nonoverlapping::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
struct A; // zero sized struct
|
||||
assert_eq!(core::mem::size_of::<A>(), 0);
|
||||
|
||||
let _a: A = core::ptr::read(core::ptr::null());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = core::ptr::read(core::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = core::ptr::read_unaligned(core::ptr::null());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = core::ptr::read_unaligned(core::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = core::ptr::read_volatile(core::ptr::null());
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _a: A = core::ptr::read_volatile(core::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
let _a: A = core::ptr::replace(core::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
let _slice: *const [usize] = core::ptr::slice_from_raw_parts(core::ptr::null_mut(), 0); // shouldn't lint
|
||||
let _slice: *const [usize] = core::ptr::slice_from_raw_parts_mut(core::ptr::null_mut(), 0);
|
||||
|
||||
core::ptr::swap::<A>(core::ptr::null_mut(), &mut A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::swap::<A>(&mut A, core::ptr::null_mut());
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::swap_nonoverlapping::<A>(core::ptr::null_mut(), &mut A, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
core::ptr::swap_nonoverlapping::<A>(&mut A, core::ptr::null_mut(), 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write(core::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write_unaligned(core::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write_volatile(core::ptr::null_mut(), A);
|
||||
//~^ invalid_null_ptr_usage
|
||||
|
||||
core::ptr::write_bytes::<usize>(core::ptr::null_mut(), 42, 0);
|
||||
//~^ invalid_null_ptr_usage
|
||||
}
|
||||
}
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:16:60
|
||||
|
|
||||
LL | let _slice: &[usize] = core::slice::from_raw_parts(core::ptr::null(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
|
||||
= note: `#[deny(clippy::invalid_null_ptr_usage)]` on by default
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:18:60
|
||||
|
|
||||
LL | let _slice: &[usize] = core::slice::from_raw_parts(core::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:21:64
|
||||
|
|
||||
LL | let _slice: &[usize] = core::slice::from_raw_parts_mut(core::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:24:34
|
||||
|
|
||||
LL | core::ptr::copy::<usize>(core::ptr::null(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:26:75
|
||||
|
|
||||
LL | core::ptr::copy::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:29:49
|
||||
|
|
||||
LL | core::ptr::copy_nonoverlapping::<usize>(core::ptr::null(), core::ptr::NonNull::dangling().as_ptr(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:31:90
|
||||
|
|
||||
LL | core::ptr::copy_nonoverlapping::<usize>(core::ptr::NonNull::dangling().as_ptr(), core::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:37:37
|
||||
|
|
||||
LL | let _a: A = core::ptr::read(core::ptr::null());
|
||||
| ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:39:37
|
||||
|
|
||||
LL | let _a: A = core::ptr::read(core::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:42:47
|
||||
|
|
||||
LL | let _a: A = core::ptr::read_unaligned(core::ptr::null());
|
||||
| ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:44:47
|
||||
|
|
||||
LL | let _a: A = core::ptr::read_unaligned(core::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:47:46
|
||||
|
|
||||
LL | let _a: A = core::ptr::read_volatile(core::ptr::null());
|
||||
| ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:49:46
|
||||
|
|
||||
LL | let _a: A = core::ptr::read_volatile(core::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:52:40
|
||||
|
|
||||
LL | let _a: A = core::ptr::replace(core::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:57:30
|
||||
|
|
||||
LL | core::ptr::swap::<A>(core::ptr::null_mut(), &mut A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:59:38
|
||||
|
|
||||
LL | core::ptr::swap::<A>(&mut A, core::ptr::null_mut());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:62:45
|
||||
|
|
||||
LL | core::ptr::swap_nonoverlapping::<A>(core::ptr::null_mut(), &mut A, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:64:53
|
||||
|
|
||||
LL | core::ptr::swap_nonoverlapping::<A>(&mut A, core::ptr::null_mut(), 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:67:26
|
||||
|
|
||||
LL | core::ptr::write(core::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:70:36
|
||||
|
|
||||
LL | core::ptr::write_unaligned(core::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:73:35
|
||||
|
|
||||
LL | core::ptr::write_volatile(core::ptr::null_mut(), A);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: pointer must be non-null
|
||||
--> tests/ui/invalid_null_ptr_usage_no_std.rs:76:41
|
||||
|
|
||||
LL | core::ptr::write_bytes::<usize>(core::ptr::null_mut(), 42, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
|
||||
|
||||
error: aborting due to 22 previous errors
|
||||
|
||||
|
|
@ -119,6 +119,7 @@
|
|||
#![warn(invalid_atomic_ordering)] //~ ERROR: lint `clippy::invalid_atomic_ordering`
|
||||
#![warn(invalid_value)] //~ ERROR: lint `clippy::invalid_ref`
|
||||
#![warn(invalid_from_utf8_unchecked)] //~ ERROR: lint `clippy::invalid_utf8_in_unchecked`
|
||||
#![warn(invalid_null_arguments)] //~ ERROR: lint `clippy::invalid_null_ptr_usage`
|
||||
#![warn(let_underscore_drop)] //~ ERROR: lint `clippy::let_underscore_drop`
|
||||
#![warn(unexpected_cfgs)] //~ ERROR: lint `clippy::maybe_misused_cfg`
|
||||
#![warn(enum_intrinsics_non_enums)] //~ ERROR: lint `clippy::mem_discriminant_non_enum`
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@
|
|||
#![warn(clippy::invalid_atomic_ordering)] //~ ERROR: lint `clippy::invalid_atomic_ordering`
|
||||
#![warn(clippy::invalid_ref)] //~ ERROR: lint `clippy::invalid_ref`
|
||||
#![warn(clippy::invalid_utf8_in_unchecked)] //~ ERROR: lint `clippy::invalid_utf8_in_unchecked`
|
||||
#![warn(clippy::invalid_null_ptr_usage)] //~ ERROR: lint `clippy::invalid_null_ptr_usage`
|
||||
#![warn(clippy::let_underscore_drop)] //~ ERROR: lint `clippy::let_underscore_drop`
|
||||
#![warn(clippy::maybe_misused_cfg)] //~ ERROR: lint `clippy::maybe_misused_cfg`
|
||||
#![warn(clippy::mem_discriminant_non_enum)] //~ ERROR: lint `clippy::mem_discriminant_non_enum`
|
||||
|
|
|
|||
|
|
@ -343,71 +343,77 @@ error: lint `clippy::invalid_utf8_in_unchecked` has been renamed to `invalid_fro
|
|||
LL | #![warn(clippy::invalid_utf8_in_unchecked)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_from_utf8_unchecked`
|
||||
|
||||
error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
|
||||
error: lint `clippy::invalid_null_ptr_usage` has been renamed to `invalid_null_arguments`
|
||||
--> tests/ui/rename.rs:122:9
|
||||
|
|
||||
LL | #![warn(clippy::invalid_null_ptr_usage)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_null_arguments`
|
||||
|
||||
error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop`
|
||||
--> tests/ui/rename.rs:123:9
|
||||
|
|
||||
LL | #![warn(clippy::let_underscore_drop)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop`
|
||||
|
||||
error: lint `clippy::maybe_misused_cfg` has been renamed to `unexpected_cfgs`
|
||||
--> tests/ui/rename.rs:123:9
|
||||
--> tests/ui/rename.rs:124:9
|
||||
|
|
||||
LL | #![warn(clippy::maybe_misused_cfg)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unexpected_cfgs`
|
||||
|
||||
error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums`
|
||||
--> tests/ui/rename.rs:124:9
|
||||
--> tests/ui/rename.rs:125:9
|
||||
|
|
||||
LL | #![warn(clippy::mem_discriminant_non_enum)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums`
|
||||
|
||||
error: lint `clippy::mismatched_target_os` has been renamed to `unexpected_cfgs`
|
||||
--> tests/ui/rename.rs:125:9
|
||||
--> tests/ui/rename.rs:126:9
|
||||
|
|
||||
LL | #![warn(clippy::mismatched_target_os)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unexpected_cfgs`
|
||||
|
||||
error: lint `clippy::panic_params` has been renamed to `non_fmt_panics`
|
||||
--> tests/ui/rename.rs:126:9
|
||||
--> tests/ui/rename.rs:127:9
|
||||
|
|
||||
LL | #![warn(clippy::panic_params)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics`
|
||||
|
||||
error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally`
|
||||
--> tests/ui/rename.rs:127:9
|
||||
--> tests/ui/rename.rs:128:9
|
||||
|
|
||||
LL | #![warn(clippy::positional_named_format_parameters)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally`
|
||||
|
||||
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries`
|
||||
--> tests/ui/rename.rs:128:9
|
||||
--> tests/ui/rename.rs:129:9
|
||||
|
|
||||
LL | #![warn(clippy::temporary_cstring_as_ptr)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `dangling_pointers_from_temporaries`
|
||||
|
||||
error: lint `clippy::undropped_manually_drops` has been renamed to `undropped_manually_drops`
|
||||
--> tests/ui/rename.rs:129:9
|
||||
--> tests/ui/rename.rs:130:9
|
||||
|
|
||||
LL | #![warn(clippy::undropped_manually_drops)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `undropped_manually_drops`
|
||||
|
||||
error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
|
||||
--> tests/ui/rename.rs:130:9
|
||||
--> tests/ui/rename.rs:131:9
|
||||
|
|
||||
LL | #![warn(clippy::unknown_clippy_lints)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
|
||||
|
||||
error: lint `clippy::unused_label` has been renamed to `unused_labels`
|
||||
--> tests/ui/rename.rs:131:9
|
||||
--> tests/ui/rename.rs:132:9
|
||||
|
|
||||
LL | #![warn(clippy::unused_label)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels`
|
||||
|
||||
error: lint `clippy::vtable_address_comparisons` has been renamed to `ambiguous_wide_pointer_comparisons`
|
||||
--> tests/ui/rename.rs:132:9
|
||||
--> tests/ui/rename.rs:133:9
|
||||
|
|
||||
LL | #![warn(clippy::vtable_address_comparisons)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `ambiguous_wide_pointer_comparisons`
|
||||
|
||||
error: aborting due to 68 previous errors
|
||||
error: aborting due to 69 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue