@@ -17,9 +17,9 @@ enum type_desc = {
17
17
18
18
#[ abi = "cdecl" ]
19
19
native mod rustrt {
20
- fn refcount ( t : * ( ) ) -> libc:: intptr_t ;
20
+ pure fn refcount ( t : * ( ) ) -> libc:: intptr_t ;
21
21
fn unsupervise ( ) ;
22
- fn shape_log_str ( t : * sys:: type_desc , data : * ( ) ) -> str ;
22
+ pure fn shape_log_str ( t : * sys:: type_desc , data : * ( ) ) -> str ;
23
23
}
24
24
25
25
#[ abi = "rust-intrinsic" ]
@@ -36,13 +36,13 @@ Returns a pointer to a type descriptor.
36
36
Useful for calling certain function in the Rust runtime or otherwise
37
37
performing dark magick.
38
38
" ]
39
- fn get_type_desc < T > ( ) -> * type_desc {
40
- rusti:: get_tydesc :: < T > ( ) as * type_desc
39
+ pure fn get_type_desc < T > ( ) -> * type_desc {
40
+ unchecked { rusti : : get_tydesc :: < T > ( ) as * type_desc }
41
41
}
42
42
43
43
#[ doc = "Returns the size of a type" ]
44
- fn size_of < T > ( ) -> uint unsafe {
45
- rusti:: size_of :: < T > ( )
44
+ pure fn size_of < T > ( ) -> uint unsafe {
45
+ unchecked { rusti : : size_of :: < T > ( ) }
46
46
}
47
47
48
48
#[ doc = "
@@ -51,23 +51,23 @@ Returns the ABI-required minimum alignment of a type
51
51
This is the alignment used for struct fields. It may be smaller
52
52
than the preferred alignment.
53
53
" ]
54
- fn min_align_of < T > ( ) -> uint unsafe {
55
- rusti:: min_align_of :: < T > ( )
54
+ pure fn min_align_of < T > ( ) -> uint unsafe {
55
+ unchecked { rusti : : min_align_of :: < T > ( ) }
56
56
}
57
57
58
58
#[ doc = "Returns the preferred alignment of a type" ]
59
- fn pref_align_of < T > ( ) -> uint unsafe {
60
- rusti:: pref_align_of :: < T > ( )
59
+ pure fn pref_align_of < T > ( ) -> uint unsafe {
60
+ unchecked { rusti : : pref_align_of :: < T > ( ) }
61
61
}
62
62
63
63
#[ doc = "Returns the refcount of a shared box" ]
64
- fn refcount < T > ( t : @T ) -> uint {
64
+ pure fn refcount < T > ( t : @T ) -> uint {
65
65
unsafe {
66
66
ret rustrt:: refcount ( unsafe :: reinterpret_cast ( t) ) as uint ;
67
67
}
68
68
}
69
69
70
- fn log_str < T > ( t : T ) -> str {
70
+ pure fn log_str < T > ( t : T ) -> str {
71
71
unsafe {
72
72
let data_ptr: * ( ) = unsafe :: reinterpret_cast ( ptr:: addr_of ( t) ) ;
73
73
rustrt:: shape_log_str ( get_type_desc :: < T > ( ) , data_ptr)
0 commit comments