Skip to content

Commit 7d623f7

Browse files
committed
do not use 'let _', it is strange
1 parent 6f9ee8b commit 7d623f7

24 files changed

+28
-28
lines changed

tests/compile-fail-fullmir/ptr_offset_overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
fn main() {
33
let v = [1i8, 2];
44
let x = &v[1] as *const i8;
5-
let _ = unsafe { x.offset(isize::min_value()) };
5+
let _val = unsafe { x.offset(isize::min_value()) };
66
}

tests/compile-fail/invalid_enum_discriminant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ pub enum Foo {
1212

1313
fn main() {
1414
let f = unsafe { std::mem::transmute::<i32, Foo>(42) };
15-
let _ = mem::discriminant(&f);
15+
let _val = mem::discriminant(&f);
1616
}

tests/compile-fail/pointer_byte_read_1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ fn main() {
33
let y = &x;
44
let z = &y as *const &i32 as *const usize;
55
let ptr_bytes = unsafe { *z }; // the actual deref is fine, because we read the entire pointer at once
6-
let _ = ptr_bytes / 432; //~ ERROR invalid arithmetic on pointers that would leak base addresses
6+
let _val = ptr_bytes / 432; //~ ERROR invalid arithmetic on pointers that would leak base addresses
77
}

tests/compile-fail/pointer_byte_read_2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ fn main() {
33
let y = &x;
44
let z = &y as *const &i32 as *const u8;
55
// the deref fails, because we are reading only a part of the pointer
6-
let _ = unsafe { *z }; //~ ERROR tried to access part of a pointer value as raw bytes
6+
let _val = unsafe { *z }; //~ ERROR tried to access part of a pointer value as raw bytes
77
}

tests/compile-fail/ptr_bitops2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
let val = 13usize;
33
let addr = &val as *const _ as usize;
4-
let _ = addr & 13; //~ ERROR access part of a pointer value as raw bytes
4+
let _val = addr & 13; //~ ERROR access part of a pointer value as raw bytes
55
}

tests/compile-fail/ptr_int_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ fn main() {
44
let x = x as *const i32;
55
let x = x as u8; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes
66
let x = x as *const i32;
7-
let _ = unsafe { *x };
7+
let _val = unsafe { *x };
88
}

tests/compile-fail/ptr_offset_int_plus_int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
fn main() {
44
// Can't offset an integer pointer by non-zero offset.
55
unsafe {
6-
let _ = (1 as *mut u8).offset(1);
6+
let _val = (1 as *mut u8).offset(1);
77
}
88
}

tests/compile-fail/ptr_offset_int_plus_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ fn main() {
44
let ptr = Box::into_raw(Box::new(0u32));
55
// Can't start with an integer pointer and get to something usable
66
unsafe {
7-
let _ = (1 as *mut u8).offset(ptr as isize);
7+
let _val = (1 as *mut u8).offset(ptr as isize);
88
}
99
}

tests/compile-fail/ptr_rem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
let val = 13usize;
33
let addr = &val as *const _ as usize;
4-
let _ = addr % 16; //~ ERROR access part of a pointer value as raw bytes
4+
let _val = addr % 16; //~ ERROR access part of a pointer value as raw bytes
55
}

tests/compile-fail/ptr_wrapping_offset_int_plus_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ fn main() {
44
let ptr = Box::into_raw(Box::new(0u32));
55
// Can't start with an integer pointer and get to something usable
66
let ptr = (1 as *mut u8).wrapping_offset(ptr as isize);
7-
let _ = unsafe { *ptr };
7+
let _val = unsafe { *ptr };
88
}

0 commit comments

Comments
 (0)