Skip to content

Commit

Permalink
remove some unused types from the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 25, 2020
1 parent b27e649 commit c79535e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 25 deletions.
11 changes: 1 addition & 10 deletions src/test/ui/issues/issue-27060-rpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/test/ui/issues/issue-27060.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/issues/issue-27060.stderr
Original file line number Diff line number Diff line change
@@ -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)]
| ^^^^^^^^^^^^^^^^^^^
Expand All @@ -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];
| ^^^^^^^^^^^^^^
Expand Down
5 changes: 0 additions & 5 deletions src/test/ui/lint/packed_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] };
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/lint/packed_reference.stderr
Original file line number Diff line number Diff line change
@@ -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;
| ^^^^^^^^^^
Expand All @@ -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];
| ^^^^^^^^^^^^^^
Expand Down

0 comments on commit c79535e

Please sign in to comment.