diff options
| author | est31 <MTest31@outlook.com> | 2023-08-05 04:54:23 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2023-08-05 05:16:44 +0200 |
| commit | 8cfa4fe6b2268385480dc4a88ce3e6fdb06a3596 (patch) | |
| tree | 802035e9fd54a8db5096a87927ac62fdb05043a3 /compiler/rustc_lint/src/ptr_nulls.rs | |
| parent | e173a8e6634d787a1529ff6ec5dc63273425ca34 (diff) | |
| download | rust-8cfa4fe6b2268385480dc4a88ce3e6fdb06a3596.tar.gz rust-8cfa4fe6b2268385480dc4a88ce3e6fdb06a3596.zip | |
Add #[rustc_never_returns_null_ptr]
And look for it in the useless_ptr_null_checks lint
Diffstat (limited to 'compiler/rustc_lint/src/ptr_nulls.rs')
| -rw-r--r-- | compiler/rustc_lint/src/ptr_nulls.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/ptr_nulls.rs b/compiler/rustc_lint/src/ptr_nulls.rs index 02aff91032f..52d8099091a 100644 --- a/compiler/rustc_lint/src/ptr_nulls.rs +++ b/compiler/rustc_lint/src/ptr_nulls.rs @@ -49,7 +49,7 @@ fn ptr_cast_chain<'a>(cx: &'a LateContext<'_>, mut e: &'a Expr<'a>) -> Option<&' } else if let ExprKind::Call(path, [arg]) = e.kind && let ExprKind::Path(ref qpath) = path.kind && let Some(def_id) = cx.qpath_res(qpath, path.hir_id).opt_def_id() - && matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::ptr_from_ref | sym::ptr_from_mut)) { + && cx.tcx.has_attr(def_id, sym::rustc_never_returns_null_ptr) { had_at_least_one_cast = true; arg } else if had_at_least_one_cast { |
