-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Visit patterns in THIR let expressions
This fixes some THIR unsafety checking errors not being emitted for let expressions in these situations.
- Loading branch information
1 parent
2b59992
commit 868de8e
Showing
8 changed files
with
66 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,83 @@ | ||
error[E0133]: access to union field is unsafe and requires unsafe function or block | ||
--> $DIR/union-unsafe.rs:33:5 | ||
--> $DIR/union-unsafe.rs:34:5 | ||
| | ||
LL | *(u.p) = 13; | ||
| ^^^^^^^^^^^ 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/union-unsafe.rs:46:6 | ||
--> $DIR/union-unsafe.rs:47:6 | ||
| | ||
LL | *u3.a = T::default(); | ||
| ^^^^ 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/union-unsafe.rs:52:6 | ||
--> $DIR/union-unsafe.rs:53:6 | ||
| | ||
LL | *u3.a = T::default(); | ||
| ^^^^ 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/union-unsafe.rs:60:13 | ||
--> $DIR/union-unsafe.rs:61:13 | ||
| | ||
LL | let a = 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/union-unsafe.rs:63:14 | ||
--> $DIR/union-unsafe.rs:64:14 | ||
| | ||
LL | let U1 { a } = u1; | ||
| ^ 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/union-unsafe.rs:64:12 | ||
--> $DIR/union-unsafe.rs:65:12 | ||
| | ||
LL | if let U1 { a: 12 } = u1 {} | ||
| ^^^^^^^^^^^^ 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/union-unsafe.rs:69:6 | ||
--> $DIR/union-unsafe.rs:66:12 | ||
| | ||
LL | if let Some(U1 { a: 13 }) = Some(u1) {} | ||
| ^^^^^^^^^^^^^^^^^^ 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/union-unsafe.rs:71:6 | ||
| | ||
LL | *u2.a = String::from("new"); | ||
| ^^^^ 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/union-unsafe.rs:73:6 | ||
--> $DIR/union-unsafe.rs:75:6 | ||
| | ||
LL | *u3.a = 1; | ||
| ^^^^ 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/union-unsafe.rs:77:6 | ||
--> $DIR/union-unsafe.rs:79:6 | ||
| | ||
LL | *u3.a = String::from("new"); | ||
| ^^^^ access to union field | ||
| | ||
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior | ||
|
||
error: aborting due to 9 previous errors | ||
error: aborting due to 10 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,83 @@ | ||
error[E0133]: access to union field is unsafe and requires unsafe function or block | ||
--> $DIR/union-unsafe.rs:33:6 | ||
--> $DIR/union-unsafe.rs:34:6 | ||
| | ||
LL | *(u.p) = 13; | ||
| ^^^^^ 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/union-unsafe.rs:46:6 | ||
--> $DIR/union-unsafe.rs:47:6 | ||
| | ||
LL | *u3.a = T::default(); | ||
| ^^^^ 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/union-unsafe.rs:52:6 | ||
--> $DIR/union-unsafe.rs:53:6 | ||
| | ||
LL | *u3.a = T::default(); | ||
| ^^^^ 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/union-unsafe.rs:60:13 | ||
--> $DIR/union-unsafe.rs:61:13 | ||
| | ||
LL | let a = 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/union-unsafe.rs:63:14 | ||
--> $DIR/union-unsafe.rs:64:14 | ||
| | ||
LL | let U1 { a } = u1; | ||
| ^ 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/union-unsafe.rs:64:8 | ||
--> $DIR/union-unsafe.rs:65:20 | ||
| | ||
LL | if let U1 { a: 12 } = u1 {} | ||
| ^^^^^^^^^^^^^^^^^^^^^ access to union field | ||
| ^^ 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/union-unsafe.rs:69:6 | ||
--> $DIR/union-unsafe.rs:66:25 | ||
| | ||
LL | if let Some(U1 { a: 13 }) = Some(u1) {} | ||
| ^^ 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/union-unsafe.rs:71:6 | ||
| | ||
LL | *u2.a = String::from("new"); | ||
| ^^^^ 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/union-unsafe.rs:73:6 | ||
--> $DIR/union-unsafe.rs:75:6 | ||
| | ||
LL | *u3.a = 1; | ||
| ^^^^ 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/union-unsafe.rs:77:6 | ||
--> $DIR/union-unsafe.rs:79:6 | ||
| | ||
LL | *u3.a = String::from("new"); | ||
| ^^^^ access to union field | ||
| | ||
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior | ||
|
||
error: aborting due to 9 previous errors | ||
error: aborting due to 10 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters