Skip to content

Commit fd60a1d

Browse files
committed
---
yaml --- r: 180119 b: refs/heads/auto c: 4ef4ddd757f93fee4e5bf8aafd3e9233ea9df034 h: refs/heads/master i: 180117: 4b8c271 180115: b16dd2d 180111: c562a1e v: v3
1 parent d103af2 commit fd60a1d

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: fa73d1317ab548315678e0da6df18501829dbb64
13+
refs/heads/auto: 4ef4ddd757f93fee4e5bf8aafd3e9233ea9df034
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/metadata/common.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
pub use self::astencode_tag::*;
1414

15-
use std::mem;
1615
use back::svh::Svh;
1716

1817
// 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;
113112
pub const tag_items_data_item_reexport_name: uint = 0x3a;
114113

115114
// used to encode crate_ctxt side tables
116-
#[derive(Copy, PartialEq)]
115+
#[derive(Copy, PartialEq, FromPrimitive)]
117116
#[repr(uint)]
118117
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
119118
tag_ast = 0x40,
@@ -146,17 +145,6 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
146145
tag_table_object_cast_map = 0x58,
147146
}
148147

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-
160148
pub const tag_item_trait_item_sort: uint = 0x60;
161149

162150
pub const tag_item_trait_parent_sort: uint = 0x61;

branches/auto/src/librustc/middle/astencode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use syntax::ptr::P;
3838
use syntax;
3939

4040
use std::old_io::Seek;
41+
use std::num::FromPrimitive;
4142
use std::rc::Rc;
4243

4344
use rbml::io::SeekableMemWriter;
@@ -1847,8 +1848,8 @@ fn decode_side_tables(dcx: &DecodeContext,
18471848
debug!(">> Side table document with tag 0x{:x} \
18481849
found for id {} (orig {})",
18491850
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 {
18521853
None => {
18531854
dcx.tcx.sess.bug(
18541855
&format!("unknown tag found in side tables: {:x}",

0 commit comments

Comments
 (0)