File tree 3 files changed +8
-9
lines changed
tests/ui/const-generics/issues
3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
error[E0741]: using function pointers as const generic parameters is forbidden
2
- --> $DIR/issue-72352.rs:7 :42
2
+ --> $DIR/issue-72352.rs:8 :42
3
3
|
4
- LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8 ) -> usize {
4
+ LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char ) -> usize {
5
5
| ^^^^^^^^^^^^^^^^^^
6
6
7
7
error: aborting due to 1 previous error
Original file line number Diff line number Diff line change 1
1
error: using function pointers as const generic parameters is forbidden
2
- --> $DIR/issue-72352.rs:7 :42
2
+ --> $DIR/issue-72352.rs:8 :42
3
3
|
4
- LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8 ) -> usize {
4
+ LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char ) -> usize {
5
5
| ^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= note: the only supported types are integers, `bool` and `char`
Original file line number Diff line number Diff line change 1
1
// revisions: full min
2
+
2
3
#![ cfg_attr( full, feature( adt_const_params) ) ]
3
4
#![ cfg_attr( full, allow( incomplete_features) ) ]
4
5
5
- use std:: ffi:: { CStr , CString } ;
6
+ use std:: ffi:: { c_char , CStr , CString } ;
6
7
7
- unsafe fn unsafely_do_the_thing < const F : fn ( & CStr ) -> usize > ( ptr : * const i8 ) -> usize {
8
+ unsafe fn unsafely_do_the_thing < const F : fn ( & CStr ) -> usize > ( ptr : * const c_char ) -> usize {
8
9
//~^ ERROR: using function pointers as const generic parameters is forbidden
9
10
F ( CStr :: from_ptr ( ptr) )
10
11
}
@@ -16,7 +17,5 @@ fn safely_do_the_thing(s: &CStr) -> usize {
16
17
fn main ( ) {
17
18
let baguette = CString :: new ( "baguette" ) . unwrap ( ) ;
18
19
let ptr = baguette. as_ptr ( ) ;
19
- println ! ( "{}" , unsafe {
20
- unsafely_do_the_thing:: <safely_do_the_thing>( ptr)
21
- } ) ;
20
+ println ! ( "{}" , unsafe { unsafely_do_the_thing:: <safely_do_the_thing>( ptr) } ) ;
22
21
}
You can’t perform that action at this time.
0 commit comments