File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
tests/ui/rust-2024/unsafe-extern-blocks Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ unsafe extern "C" {
2
+ fn test1 ( i : i32 ) ;
3
+ }
4
+
5
+ fn test2 ( i : i32 ) {
6
+ test1 ( i) ;
7
+ //~^ ERROR: call to unsafe function `test1` is unsafe and requires unsafe function or block [E0133]
8
+ }
9
+
10
+ unsafe fn test3 ( i : i32 ) {
11
+ test1 ( i) ;
12
+ }
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0133]: call to unsafe function `test1` is unsafe and requires unsafe function or block
2
+ --> $DIR/extern-items-unsafe.rs:6:5
3
+ |
4
+ LL | test1(i);
5
+ | ^^^^^^^^ call to unsafe function
6
+ |
7
+ = note: consult the function's documentation for information on how to avoid undefined behavior
8
+
9
+ error: aborting due to 1 previous error
10
+
11
+ For more information about this error, try `rustc --explain E0133`.
You can’t perform that action at this time.
0 commit comments