Skip to content

Commit ffd0f1b

Browse files
committed
fix: don't lint null as UB for volatile
Also remove a now-unneeded `allow` line.
1 parent 96e3b63 commit ffd0f1b

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

compiler/rustc_lint/src/ptr_nulls.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ impl<'tcx> LateLintPass<'tcx> for PtrNullChecks {
160160
let (arg_indices, are_zsts_allowed): (&[_], _) = match diag_name {
161161
sym::ptr_read
162162
| sym::ptr_read_unaligned
163-
| sym::ptr_read_volatile
164163
| sym::ptr_replace
165164
| sym::ptr_write
166165
| sym::ptr_write_bytes
167-
| sym::ptr_write_unaligned
168-
| sym::ptr_write_volatile => (&[0], true),
166+
| sym::ptr_write_unaligned => (&[0], true),
169167
sym::slice_from_raw_parts | sym::slice_from_raw_parts_mut => (&[0], false),
170168
sym::ptr_copy
171169
| sym::ptr_copy_nonoverlapping

tests/ui/precondition-checks/read_volatile.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
//@ error-pattern: unsafe precondition(s) violated: ptr::read_volatile requires
44
//@ revisions: misaligned
55

6-
#![allow(invalid_null_arguments)]
7-
86
use std::ptr;
97

108
fn main() {

0 commit comments

Comments
 (0)