summaryrefslogtreecommitdiff
path: root/tests/ui/binding
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-09-06 18:41:01 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2023-03-09 17:45:13 +0000
commit4462bb54e3bbff7eecae1816836f306fcc309e05 (patch)
treeaac24138a84068a1ca3a60247704bbcddc241bd4 /tests/ui/binding
parentbe758ef5ab570b7685c9a5eecacab65911da9e6f (diff)
Introduce a no-op PlaceMention statement for `let _ =`.
Diffstat (limited to 'tests/ui/binding')
-rw-r--r--tests/ui/binding/issue-53114-safety-checks.rs3
-rw-r--r--tests/ui/binding/issue-53114-safety-checks.stderr38
2 files changed, 29 insertions, 12 deletions
diff --git a/tests/ui/binding/issue-53114-safety-checks.rs b/tests/ui/binding/issue-53114-safety-checks.rs
index e646dfba3e0..0bffab32782 100644
--- a/tests/ui/binding/issue-53114-safety-checks.rs
+++ b/tests/ui/binding/issue-53114-safety-checks.rs
@@ -21,7 +21,7 @@ fn let_wild_gets_unsafe_field() {
let u2 = U { a: I(1) };
let p = P { a: &2, b: &3 };
let _ = &p.b; //~ ERROR reference to packed field
- let _ = u1.a; // #53114: should eventually signal error as well
+ let _ = u1.a; //~ ERROR [E0133]
let _ = &u2.a; //~ ERROR [E0133]
// variation on above with `_` in substructure
@@ -36,6 +36,7 @@ fn let_ascribe_gets_unsafe_field() {
let p = P { a: &2, b: &3 };
let _: _ = &p.b; //~ ERROR reference to packed field
let _: _ = u1.a; //~ ERROR [E0133]
+ //~^ ERROR [E0133]
let _: _ = &u2.a; //~ ERROR [E0133]
// variation on above with `_` in substructure
diff --git a/tests/ui/binding/issue-53114-safety-checks.stderr b/tests/ui/binding/issue-53114-safety-checks.stderr
index 0760e04490c..67902ac7b54 100644
--- a/tests/ui/binding/issue-53114-safety-checks.stderr
+++ b/tests/ui/binding/issue-53114-safety-checks.stderr
@@ -26,7 +26,7 @@ LL | let _: _ = &p.b;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/issue-53114-safety-checks.rs:42:20
+ --> $DIR/issue-53114-safety-checks.rs:43:20
|
LL | let (_,): _ = (&p.b,);
| ^^^^
@@ -35,7 +35,7 @@ LL | let (_,): _ = (&p.b,);
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/issue-53114-safety-checks.rs:51:11
+ --> $DIR/issue-53114-safety-checks.rs:52:11
|
LL | match &p.b { _ => { } }
| ^^^^
@@ -44,7 +44,7 @@ LL | match &p.b { _ => { } }
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/issue-53114-safety-checks.rs:56:12
+ --> $DIR/issue-53114-safety-checks.rs:57:12
|
LL | match (&p.b,) { (_,) => { } }
| ^^^^
@@ -53,6 +53,14 @@ LL | match (&p.b,) { (_,) => { } }
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/issue-53114-safety-checks.rs:24:13
+ |
+LL | let _ = u1.a;
+ | ^^^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
--> $DIR/issue-53114-safety-checks.rs:25:13
|
LL | let _ = &u2.a;
@@ -77,6 +85,14 @@ LL | let (_,) = (&u2.a,);
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/issue-53114-safety-checks.rs:38:16
+ |
+LL | let _: _ = u1.a;
+ | ^^^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
--> $DIR/issue-53114-safety-checks.rs:38:12
|
LL | let _: _ = u1.a;
@@ -85,7 +101,7 @@ LL | let _: _ = u1.a;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:39:16
+ --> $DIR/issue-53114-safety-checks.rs:40:16
|
LL | let _: _ = &u2.a;
| ^^^^^ access to union field
@@ -93,7 +109,7 @@ LL | let _: _ = &u2.a;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:43:20
+ --> $DIR/issue-53114-safety-checks.rs:44:20
|
LL | let (_,): _ = (u1.a,);
| ^^^^ access to union field
@@ -101,7 +117,7 @@ LL | let (_,): _ = (u1.a,);
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:44:20
+ --> $DIR/issue-53114-safety-checks.rs:45:20
|
LL | let (_,): _ = (&u2.a,);
| ^^^^^ access to union field
@@ -109,7 +125,7 @@ LL | let (_,): _ = (&u2.a,);
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:52:11
+ --> $DIR/issue-53114-safety-checks.rs:53:11
|
LL | match u1.a { _ => { } }
| ^^^^ access to union field
@@ -117,7 +133,7 @@ LL | match u1.a { _ => { } }
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:53:11
+ --> $DIR/issue-53114-safety-checks.rs:54:11
|
LL | match &u2.a { _ => { } }
| ^^^^^ access to union field
@@ -125,7 +141,7 @@ LL | match &u2.a { _ => { } }
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:57:12
+ --> $DIR/issue-53114-safety-checks.rs:58:12
|
LL | match (u1.a,) { (_,) => { } }
| ^^^^ access to union field
@@ -133,14 +149,14 @@ LL | match (u1.a,) { (_,) => { } }
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/issue-53114-safety-checks.rs:58:12
+ --> $DIR/issue-53114-safety-checks.rs:59:12
|
LL | match (&u2.a,) { (_,) => { } }
| ^^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
-error: aborting due to 17 previous errors
+error: aborting due to 19 previous errors
Some errors have detailed explanations: E0133, E0793.
For more information about an error, try `rustc --explain E0133`.