remove some unused types from the tests

This commit is contained in:
Ralf Jung 2020-05-16 16:29:27 +02:00
parent b27e649537
commit c79535eab9
5 changed files with 6 additions and 25 deletions

View file

@ -7,19 +7,10 @@ pub struct Good {
aligned: [u8; 32],
}
#[repr(packed)]
pub struct JustArray {
array: [u32]
}
// kill this test when that turns to a hard error
#[allow(safe_packed_borrows)]
fn main() {
let good = Good {
data: &0,
data2: [&0, &0],
aligned: [0; 32]
};
let good = Good { data: &0, data2: [&0, &0], aligned: [0; 32] };
unsafe {
let _ = &good.data; // ok

View file

@ -5,11 +5,6 @@ pub struct Good {
aligned: [u8; 32],
}
#[repr(packed)]
pub struct JustArray {
array: [u32]
}
#[deny(safe_packed_borrows)]
fn main() {
let good = Good {

View file

@ -1,11 +1,11 @@
error: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
--> $DIR/issue-27060.rs:26:13
--> $DIR/issue-27060.rs:21:13
|
LL | let _ = &good.data;
| ^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/issue-27060.rs:13:8
--> $DIR/issue-27060.rs:8:8
|
LL | #[deny(safe_packed_borrows)]
| ^^^^^^^^^^^^^^^^^^^
@ -14,7 +14,7 @@ LL | #[deny(safe_packed_borrows)]
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
error: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
--> $DIR/issue-27060.rs:28:13
--> $DIR/issue-27060.rs:23:13
|
LL | let _ = &good.data2[0];
| ^^^^^^^^^^^^^^

View file

@ -7,11 +7,6 @@ pub struct Good {
aligned: [u8; 32],
}
#[repr(packed)]
pub struct JustArray {
array: [u32],
}
fn main() {
unsafe {
let good = Good { data: &0, data2: [&0, &0], aligned: [0; 32] };

View file

@ -1,5 +1,5 @@
error: reference to packed field is not allowed
--> $DIR/packed_reference.rs:19:17
--> $DIR/packed_reference.rs:14:17
|
LL | let _ = &good.data;
| ^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #![deny(packed_references)]
= note: fields of packed structs might be misaligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
error: reference to packed field is not allowed
--> $DIR/packed_reference.rs:20:17
--> $DIR/packed_reference.rs:15:17
|
LL | let _ = &good.data2[0];
| ^^^^^^^^^^^^^^