@@ -36,60 +36,54 @@ pub extern mod rustrt {
36
36
unsafe fn rust_upcall_free ( ptr : * c_char ) ;
37
37
}
38
38
39
- #[ rt( fail_) ]
40
39
#[ lang="fail_" ]
41
- pub fn rt_fail_ ( expr : * c_char , file : * c_char , line : size_t ) -> ! {
40
+ pub fn fail_ ( expr : * c_char , file : * c_char , line : size_t ) -> ! {
42
41
sys:: begin_unwind_ ( expr, file, line) ;
43
42
}
44
43
45
- #[ rt( fail_bounds_check) ]
46
44
#[ lang="fail_bounds_check" ]
47
- pub unsafe fn rt_fail_bounds_check ( file : * c_char , line : size_t ,
48
- index : size_t , len : size_t ) {
45
+ pub unsafe fn fail_bounds_check ( file : * c_char , line : size_t ,
46
+ index : size_t , len : size_t ) {
49
47
let msg = fmt ! ( "index out of bounds: the len is %d but the index is %d" ,
50
48
len as int, index as int) ;
51
49
do str:: as_buf ( msg) |p, _len| {
52
- rt_fail_ ( p as * c_char , file, line) ;
50
+ fail_ ( p as * c_char , file, line) ;
53
51
}
54
52
}
55
53
56
- pub unsafe fn rt_fail_borrowed ( ) {
54
+ pub unsafe fn fail_borrowed ( ) {
57
55
let msg = "borrowed" ;
58
56
do str:: as_buf ( msg) |msg_p, _| {
59
57
do str:: as_buf ( "???" ) |file_p, _| {
60
- rt_fail_ ( msg_p as * c_char , file_p as * c_char , 0 ) ;
58
+ fail_ ( msg_p as * c_char , file_p as * c_char , 0 ) ;
61
59
}
62
60
}
63
61
}
64
62
65
63
// FIXME #4942: Make these signatures agree with exchange_alloc's signatures
66
- #[ rt( exchange_malloc) ]
67
64
#[ lang="exchange_malloc" ]
68
- pub unsafe fn rt_exchange_malloc ( td : * c_char , size : uintptr_t ) -> * c_char {
65
+ pub unsafe fn exchange_malloc ( td : * c_char , size : uintptr_t ) -> * c_char {
69
66
transmute ( exchange_alloc:: malloc ( transmute ( td) , transmute ( size) ) )
70
67
}
71
68
72
69
// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
73
70
// inside a landing pad may corrupt the state of the exception handler. If a
74
71
// problem occurs, call exit instead.
75
- #[ rt( exchange_free) ]
76
72
#[ lang="exchange_free" ]
77
- pub unsafe fn rt_exchange_free ( ptr : * c_char ) {
73
+ pub unsafe fn exchange_free ( ptr : * c_char ) {
78
74
exchange_alloc:: free ( transmute ( ptr) )
79
75
}
80
76
81
- #[ rt( malloc) ]
82
77
#[ lang="malloc" ]
83
- pub unsafe fn rt_malloc ( td : * c_char , size : uintptr_t ) -> * c_char {
78
+ pub unsafe fn local_malloc ( td : * c_char , size : uintptr_t ) -> * c_char {
84
79
return rustrt:: rust_upcall_malloc ( td, size) ;
85
80
}
86
81
87
82
// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
88
83
// inside a landing pad may corrupt the state of the exception handler. If a
89
84
// problem occurs, call exit instead.
90
- #[ rt( free) ]
91
85
#[ lang="free" ]
92
- pub unsafe fn rt_free ( ptr : * c_char ) {
86
+ pub unsafe fn local_free ( ptr : * c_char ) {
93
87
rustrt:: rust_upcall_free ( ptr) ;
94
88
}
95
89
@@ -112,7 +106,7 @@ pub unsafe fn return_to_mut(a: *u8) {
112
106
pub unsafe fn check_not_borrowed ( a : * u8 ) {
113
107
let a: * mut BoxRepr = transmute ( a) ;
114
108
if ( ( * a) . header . ref_count & FROZEN_BIT ) != 0 {
115
- rt_fail_borrowed ( ) ;
109
+ fail_borrowed ( ) ;
116
110
}
117
111
}
118
112
0 commit comments