@@ -34,26 +34,55 @@ use fmt;
3434
3535#[ cold] #[ inline( never) ] // this is the slow path, always
3636#[ lang="panic" ]
37- pub fn panic ( expr_file_line : & ( & ' static str , & ' static str , uint ) ) -> ! {
37+ #[ cfg( stage0) ]
38+ pub fn panic ( expr_file_line : & ( & ' static str , & ' static str , usize ) ) -> ! {
39+ let ( expr, file, line) = * expr_file_line;
40+ panic_fmt ( format_args ! ( "{}" , expr) , & ( file, line) )
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 ) ) -> ! {
3846 let ( expr, file, line) = * expr_file_line;
3947 panic_fmt ( format_args ! ( "{}" , expr) , & ( file, line) )
4048}
4149
4250#[ cold] #[ inline( never) ]
4351#[ lang="panic_bounds_check" ]
44- fn panic_bounds_check ( file_line : & ( & ' static str , uint ) ,
45- index : uint , len : uint ) -> ! {
52+ #[ cfg( stage0) ]
53+ fn panic_bounds_check ( file_line : & ( & ' static str , usize ) ,
54+ index : usize , len : usize ) -> ! {
55+ panic_fmt ( format_args ! ( "index out of bounds: the len is {} but the index is {}" ,
56+ len, index) , file_line)
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 : usize , len : usize ) -> ! {
4663 panic_fmt ( format_args ! ( "index out of bounds: the len is {} but the index is {}" ,
4764 len, index) , file_line)
4865}
4966
5067#[ cold] #[ inline( never) ]
51- pub fn panic_fmt ( fmt : fmt:: Arguments , file_line : & ( & ' static str , uint ) ) -> ! {
68+ #[ cfg( stage0) ]
69+ pub fn panic_fmt ( fmt : fmt:: Arguments , file_line : & ( & ' static str , usize ) ) -> ! {
70+ #[ allow( improper_ctypes) ]
71+ extern {
72+ #[ lang = "panic_fmt" ]
73+ fn panic_impl ( fmt : fmt:: Arguments , file : & ' static str , line : uint ) -> !;
74+ }
75+ let ( file, line) = * file_line;
76+ unsafe { panic_impl ( fmt, file, line as uint ) }
77+ }
78+ #[ cold] #[ inline( never) ]
79+ #[ cfg( not( stage0) ) ]
80+ pub fn panic_fmt ( fmt : fmt:: Arguments , file_line : & ( & ' static str , u32 ) ) -> ! {
5281 #[ allow( improper_ctypes) ]
5382 extern {
5483 #[ lang = "panic_fmt" ]
5584 fn panic_impl ( fmt : fmt:: Arguments , file : & ' static str , line : uint ) -> !;
5685 }
5786 let ( file, line) = * file_line;
58- unsafe { panic_impl ( fmt, file, line) }
87+ unsafe { panic_impl ( fmt, file, line as uint ) }
5988}
0 commit comments