Test -Zthir-unsafeck for unsafe function calls
This commit is contained in:
parent
29780f43e2
commit
a95b342f02
46 changed files with 422 additions and 45 deletions
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28776.rs:4:5
|
||||
--> $DIR/issue-28776.rs:7:5
|
||||
|
|
||||
LL | (&ptr::write)(1 as *mut _, 42);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
use std::ptr;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-28776.thir.stderr
Normal file
11
src/test/ui/issues/issue-28776.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28776.rs:7:5
|
||||
|
|
||||
LL | (&ptr::write)(1 as *mut _, 42);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-3080.rs:7:5
|
||||
--> $DIR/issue-3080.rs:10:5
|
||||
|
|
||||
LL | X(()).with();
|
||||
| ^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
struct X(());
|
||||
impl X {
|
||||
pub unsafe fn with(&self) { }
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-3080.thir.stderr
Normal file
11
src/test/ui/issues/issue-3080.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-3080.rs:10:5
|
||||
|
|
||||
LL | X(()).with();
|
||||
| ^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-5844.rs:6:5
|
||||
--> $DIR/issue-5844.rs:8:5
|
||||
|
|
||||
LL | issue_5844_aux::rand();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
//aux-build:issue-5844-aux.rs
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern crate issue_5844_aux;
|
||||
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-5844.thir.stderr
Normal file
11
src/test/ui/issues/issue-5844.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-5844.rs:8:5
|
||||
|
|
||||
LL | issue_5844_aux::rand();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
||||
|
|
||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue