-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for raw pointer dereference in THIR unsafeck
- Loading branch information
1 parent
f94942d
commit 27fe959
Showing
22 changed files
with
113 additions
and
10 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
2 changes: 1 addition & 1 deletion
2
...or/issue-45729-unsafe-in-generator.stderr → ...ssue-45729-unsafe-in-generator.mir.stderr
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,3 +1,6 @@ | ||
// revisions: mir thir | ||
// [thir]compile-flags: -Z thir-unsafeck | ||
|
||
#![feature(generators)] | ||
|
||
fn main() { | ||
|
11 changes: 11 additions & 0 deletions
11
src/test/ui/generator/issue-45729-unsafe-in-generator.thir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/issue-45729-unsafe-in-generator.rs:8:9 | ||
| | ||
LL | *(1 as *mut u32) = 42; | ||
| ^^^^^^^^^^^^^^^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
4 changes: 2 additions & 2 deletions
4
src/test/ui/issues/issue-47412.stderr → src/test/ui/issues/issue-47412.mir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/issue-47412.rs:21:11 | ||
| | ||
LL | match *ptr {} | ||
| ^^^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
2 changes: 1 addition & 1 deletion
2
src/test/ui/traits/safety-fn-body.stderr → src/test/ui/traits/safety-fn-body.mir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/safety-fn-body.rs:14:9 | ||
| | ||
LL | *self += 1; | ||
| ^^^^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
2 changes: 1 addition & 1 deletion
2
...afe/issue-45087-unreachable-unsafe.stderr → ...issue-45087-unreachable-unsafe.mir.stderr
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,3 +1,6 @@ | ||
// revisions: mir thir | ||
// [thir]compile-flags: -Z thir-unsafeck | ||
|
||
fn main() { | ||
return; | ||
*(1 as *mut u32) = 42; | ||
|
11 changes: 11 additions & 0 deletions
11
src/test/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/issue-45087-unreachable-unsafe.rs:6:5 | ||
| | ||
LL | *(1 as *mut u32) = 42; | ||
| ^^^^^^^^^^^^^^^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
2 changes: 1 addition & 1 deletion
2
.../unsafe/unsafe-fn-assign-deref-ptr.stderr → ...afe/unsafe-fn-assign-deref-ptr.mir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5 | ||
| | ||
LL | *p = 0; | ||
| ^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
2 changes: 1 addition & 1 deletion
2
...test/ui/unsafe/unsafe-fn-deref-ptr.stderr → .../ui/unsafe/unsafe-fn-deref-ptr.mir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/unsafe-fn-deref-ptr.rs:5:12 | ||
| | ||
LL | return *p; | ||
| ^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
2 changes: 1 addition & 1 deletion
2
...ui/unsafe/unsafe-unstable-const-fn.stderr → ...nsafe/unsafe-unstable-const-fn.mir.stderr
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/unsafe-unstable-const-fn.rs:11:5 | ||
| | ||
LL | *a == b | ||
| ^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0133`. |