@@ -34,20 +34,38 @@ use fmt;
34
34
35
35
#[ cold] #[ inline( never) ] // this is the slow path, always
36
36
#[ lang="panic" ]
37
+ #[ cfg( stage0) ]
37
38
pub fn panic ( expr_file_line : & ( & ' static str , & ' static str , uint ) ) -> ! {
38
39
let ( expr, file, line) = * expr_file_line;
39
40
panic_fmt ( format_args ! ( "{}" , expr) , & ( file, line) )
40
41
}
42
+ #[ cold] #[ inline( never) ] // this is the slow path, always
43
+ #[ lang="panic" ]
44
+ #[ cfg( not( stage0) ) ]
45
+ pub fn panic ( expr_file_line : & ( & ' static str , & ' static str , u32 ) ) -> ! {
46
+ let ( expr, file, line) = * expr_file_line;
47
+ panic_fmt ( format_args ! ( "{}" , expr) , & ( file, line) )
48
+ }
41
49
42
50
#[ cold] #[ inline( never) ]
43
51
#[ lang="panic_bounds_check" ]
52
+ #[ cfg( stage0) ]
44
53
fn panic_bounds_check ( file_line : & ( & ' static str , uint ) ,
45
54
index : uint , len : uint ) -> ! {
46
55
panic_fmt ( format_args ! ( "index out of bounds: the len is {} but the index is {}" ,
47
56
len, index) , file_line)
48
57
}
58
+ #[ cold] #[ inline( never) ]
59
+ #[ lang="panic_bounds_check" ]
60
+ #[ cfg( not( stage0) ) ]
61
+ fn panic_bounds_check ( file_line : & ( & ' static str , u32 ) ,
62
+ index : uint , len : uint ) -> ! {
63
+ panic_fmt ( format_args ! ( "index out of bounds: the len is {} but the index is {}" ,
64
+ len, index) , file_line)
65
+ }
49
66
50
67
#[ cold] #[ inline( never) ]
68
+ #[ cfg( stage0) ]
51
69
pub fn panic_fmt ( fmt : fmt:: Arguments , file_line : & ( & ' static str , uint ) ) -> ! {
52
70
#[ allow( improper_ctypes) ]
53
71
extern {
@@ -57,3 +75,14 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
57
75
let ( file, line) = * file_line;
58
76
unsafe { panic_impl ( fmt, file, line) }
59
77
}
78
+ #[ cold] #[ inline( never) ]
79
+ #[ cfg( not( stage0) ) ]
80
+ pub fn panic_fmt ( fmt : fmt:: Arguments , file_line : & ( & ' static str , u32 ) ) -> ! {
81
+ #[ allow( improper_ctypes) ]
82
+ extern {
83
+ #[ lang = "panic_fmt" ]
84
+ fn panic_impl ( fmt : fmt:: Arguments , file : & ' static str , line : uint ) -> !;
85
+ }
86
+ let ( file, line) = * file_line;
87
+ unsafe { panic_impl ( fmt, file, line as uint ) }
88
+ }
0 commit comments