File tree Expand file tree Collapse file tree 3 files changed +5
-16
lines changed
branches/tmp/src/librustc Expand file tree Collapse file tree 3 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,4 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34
34
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
35
35
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
36
36
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37
- refs/heads/tmp: fa73d1317ab548315678e0da6df18501829dbb64
37
+ refs/heads/tmp: 4ef4ddd757f93fee4e5bf8aafd3e9233ea9df034
Original file line number Diff line number Diff line change 12
12
13
13
pub use self :: astencode_tag:: * ;
14
14
15
- use std:: mem;
16
15
use back:: svh:: Svh ;
17
16
18
17
// EBML enum definitions and utils shared by the encoder and decoder
@@ -113,7 +112,7 @@ pub const tag_items_data_item_reexport_def_id: uint = 0x39;
113
112
pub const tag_items_data_item_reexport_name: uint = 0x3a ;
114
113
115
114
// used to encode crate_ctxt side tables
116
- #[ derive( Copy , PartialEq ) ]
115
+ #[ derive( Copy , PartialEq , FromPrimitive ) ]
117
116
#[ repr( uint) ]
118
117
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
119
118
tag_ast = 0x40 ,
@@ -146,17 +145,6 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
146
145
tag_table_object_cast_map = 0x58 ,
147
146
}
148
147
149
- static first_astencode_tag: uint = tag_ast as uint ;
150
- static last_astencode_tag: uint = tag_table_object_cast_map as uint ;
151
- impl astencode_tag {
152
- pub fn from_uint ( value : uint ) -> Option < astencode_tag > {
153
- let is_a_tag = first_astencode_tag <= value && value <= last_astencode_tag;
154
- if !is_a_tag { None } else {
155
- Some ( unsafe { mem:: transmute :: < uint , astencode_tag > ( value) } )
156
- }
157
- }
158
- }
159
-
160
148
pub const tag_item_trait_item_sort: uint = 0x60 ;
161
149
162
150
pub const tag_item_trait_parent_sort: uint = 0x61 ;
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ use syntax::ptr::P;
38
38
use syntax;
39
39
40
40
use std:: old_io:: Seek ;
41
+ use std:: num:: FromPrimitive ;
41
42
use std:: rc:: Rc ;
42
43
43
44
use rbml:: io:: SeekableMemWriter ;
@@ -1847,8 +1848,8 @@ fn decode_side_tables(dcx: &DecodeContext,
1847
1848
debug ! ( ">> Side table document with tag 0x{:x} \
1848
1849
found for id {} (orig {})",
1849
1850
tag, id, id0) ;
1850
-
1851
- match c :: astencode_tag :: from_uint ( tag ) {
1851
+ let decoded_tag : Option < c :: astencode_tag > = FromPrimitive :: from_uint ( tag ) ;
1852
+ match decoded_tag {
1852
1853
None => {
1853
1854
dcx. tcx . sess . bug (
1854
1855
& format ! ( "unknown tag found in side tables: {:x}" ,
You can’t perform that action at this time.
0 commit comments