File tree 4 files changed +9
-27
lines changed
4 files changed +9
-27
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,9 @@ pub trait Emitter {
68
68
sp : RenderSpan , msg : & str , lvl : Level ) ;
69
69
}
70
70
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.)
74
74
#[ derive( Copy , Clone ) ]
75
75
#[ must_use]
76
76
pub struct FatalError ;
Original file line number Diff line number Diff line change @@ -23,17 +23,6 @@ use parse::token::InternedString;
23
23
use parse:: token;
24
24
use ptr:: P ;
25
25
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
-
37
26
enum State {
38
27
Asm ,
39
28
Outputs ,
Original file line number Diff line number Diff line change @@ -24,17 +24,6 @@ use ptr::P;
24
24
use std:: collections:: HashMap ;
25
25
use std:: iter:: repeat;
26
26
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
-
38
27
#[ derive( PartialEq ) ]
39
28
enum ArgumentType {
40
29
Known ( String ) ,
Original file line number Diff line number Diff line change @@ -50,13 +50,17 @@ extern crate libc;
50
50
51
51
extern crate serialize as rustc_serialize; // used by deriving
52
52
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
53
57
macro_rules! panictry {
54
58
( $e: expr) => ( {
55
59
use std:: result:: Result :: { Ok , Err } ;
56
-
60
+ use diagnostic :: FatalError ;
57
61
match $e {
58
62
Ok ( e) => e,
59
- Err ( e ) => panic!( e )
63
+ Err ( FatalError ) => panic!( FatalError )
60
64
}
61
65
} )
62
66
}
You can’t perform that action at this time.
0 commit comments