File tree 2 files changed +27
-3
lines changed
tests/ui/consts/const-extern-fn
2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,17 @@ const unsafe extern "C" fn foo() -> usize {
2
2
5
3
3
}
4
4
5
+ const unsafe extern "C-unwind" fn bar ( ) -> usize {
6
+ 5
7
+ }
8
+
5
9
fn main ( ) {
6
10
let a: [ u8 ; foo ( ) ] ;
7
11
//~^ call to unsafe function `foo` is unsafe and requires unsafe function or block
8
12
foo ( ) ;
9
13
//~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
14
+ let b: [ u8 ; bar ( ) ] ;
15
+ //~^ call to unsafe function `bar` is unsafe and requires unsafe function or block
16
+ bar ( ) ;
17
+ //~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block
10
18
}
Original file line number Diff line number Diff line change 1
1
error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
2
- --> $DIR/const-extern-fn-requires-unsafe.rs:8 :5
2
+ --> $DIR/const-extern-fn-requires-unsafe.rs:12 :5
3
3
|
4
4
LL | foo();
5
5
| ^^^^^ call to unsafe function
6
6
|
7
7
= note: consult the function's documentation for information on how to avoid undefined behavior
8
8
9
+ error[E0133]: call to unsafe function `bar` is unsafe and requires unsafe function or block
10
+ --> $DIR/const-extern-fn-requires-unsafe.rs:16:5
11
+ |
12
+ LL | bar();
13
+ | ^^^^^ call to unsafe function
14
+ |
15
+ = note: consult the function's documentation for information on how to avoid undefined behavior
16
+
9
17
error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
10
- --> $DIR/const-extern-fn-requires-unsafe.rs:6 :17
18
+ --> $DIR/const-extern-fn-requires-unsafe.rs:10 :17
11
19
|
12
20
LL | let a: [u8; foo()];
13
21
| ^^^^^ call to unsafe function
14
22
|
15
23
= note: consult the function's documentation for information on how to avoid undefined behavior
16
24
17
- error: aborting due to 2 previous errors
25
+ error[E0133]: call to unsafe function `bar` is unsafe and requires unsafe function or block
26
+ --> $DIR/const-extern-fn-requires-unsafe.rs:14:17
27
+ |
28
+ LL | let b: [u8; bar()];
29
+ | ^^^^^ call to unsafe function
30
+ |
31
+ = note: consult the function's documentation for information on how to avoid undefined behavior
32
+
33
+ error: aborting due to 4 previous errors
18
34
19
35
For more information about this error, try `rustc --explain E0133`.
You can’t perform that action at this time.
0 commit comments