File tree Expand file tree Collapse file tree 4 files changed +9
-27
lines changed Expand file tree Collapse file tree 4 files changed +9
-27
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,9 @@ pub trait Emitter {
6868 sp : RenderSpan , msg : & str , lvl : Level ) ;
6969}
7070
71- /// This structure is used to signify that a task has panicked with a fatal error
72- /// from the diagnostics. You can use this with the `Any` trait to figure out
73- /// how a rustc task died (if so desired).
71+ /// Used as a return value to signify a fatal error occurred. (It is also
72+ /// used as the argument to panic at the moment, but that will eventually
73+ /// not be true.)
7474#[ derive( Copy , Clone ) ]
7575#[ must_use]
7676pub struct FatalError ;
Original file line number Diff line number Diff line change @@ -23,17 +23,6 @@ use parse::token::InternedString;
2323use parse:: token;
2424use ptr:: P ;
2525
26- macro_rules! panictry {
27- ( $e: expr) => ( {
28- use std:: result:: Result :: { Ok , Err } ;
29-
30- match $e {
31- Ok ( e) => e,
32- Err ( e) => panic!( e) ,
33- }
34- } )
35- }
36-
3726enum State {
3827 Asm ,
3928 Outputs ,
Original file line number Diff line number Diff line change @@ -24,17 +24,6 @@ use ptr::P;
2424use std:: collections:: HashMap ;
2525use std:: iter:: repeat;
2626
27- macro_rules! panictry {
28- ( $e: expr) => ( {
29- use std:: result:: Result :: { Ok , Err } ;
30-
31- match $e {
32- Ok ( e) => e,
33- Err ( e) => { panic!( e) ; }
34- }
35- } )
36- }
37-
3827#[ derive( PartialEq ) ]
3928enum ArgumentType {
4029 Known ( String ) ,
Original file line number Diff line number Diff line change @@ -50,13 +50,17 @@ extern crate libc;
5050
5151extern crate serialize as rustc_serialize; // used by deriving
5252
53+ // A variant of 'try!' that panics on Err(FatalError). This is used as a
54+ // crutch on the way towards a non-panic!-prone parser. It should be used
55+ // for fatal parsing errors; eventually we plan to convert all code using
56+ // panictry to just use normal try
5357macro_rules! panictry {
5458 ( $e: expr) => ( {
5559 use std:: result:: Result :: { Ok , Err } ;
56-
60+ use diagnostic :: FatalError ;
5761 match $e {
5862 Ok ( e) => e,
59- Err ( e ) => panic!( e )
63+ Err ( FatalError ) => panic!( FatalError )
6064 }
6165 } )
6266}
You can’t perform that action at this time.
0 commit comments