File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
tests/ui/consts/const-extern-fn Expand file tree Collapse file tree 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 {
22 5
33}
44
5+ const unsafe extern "C-unwind" fn bar ( ) -> usize {
6+ 5
7+ }
8+
59fn main ( ) {
610 let a: [ u8 ; foo ( ) ] ;
711 //~^ call to unsafe function `foo` is unsafe and requires unsafe function or block
812 foo ( ) ;
913 //~^ 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
1018}
Original file line number Diff line number Diff line change 11error[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
33 |
44LL | foo();
55 | ^^^^^ call to unsafe function
66 |
77 = note: consult the function's documentation for information on how to avoid undefined behavior
88
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+
917error[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
1119 |
1220LL | let a: [u8; foo()];
1321 | ^^^^^ call to unsafe function
1422 |
1523 = note: consult the function's documentation for information on how to avoid undefined behavior
1624
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
1834
1935For more information about this error, try `rustc --explain E0133`.
You can’t perform that action at this time.
0 commit comments