]>
Commit | Line | Data |
---|---|---|
c34b1796 | 1 | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT |
223e47cc LB |
2 | // file at the top-level directory of this distribution and at |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
1a4d82fc JJ |
10 | |
11 | #![allow(non_camel_case_types, non_upper_case_globals)] | |
12 | ||
13 | pub use self::astencode_tag::*; | |
14 | ||
c34b1796 AL |
15 | // RBML enum definitions and utils shared by the encoder and decoder |
16 | // | |
17 | // 0x00..0x1f: reserved for RBML generic type tags | |
18 | // 0x20..0xef: free for use, preferred for frequent tags | |
19 | // 0xf0..0xff: internally used by RBML to encode 0x100..0xfff in two bytes | |
20 | // 0x100..0xfff: free for use, preferred for infrequent tags | |
223e47cc | 21 | |
c34b1796 | 22 | pub const tag_items: usize = 0x100; // top-level only |
223e47cc | 23 | |
c34b1796 | 24 | pub const tag_paths_data_name: usize = 0x20; |
223e47cc | 25 | |
c34b1796 | 26 | pub const tag_def_id: usize = 0x21; |
223e47cc | 27 | |
c34b1796 | 28 | pub const tag_items_data: usize = 0x22; |
223e47cc | 29 | |
c34b1796 | 30 | pub const tag_items_data_item: usize = 0x23; |
223e47cc | 31 | |
c34b1796 | 32 | pub const tag_items_data_item_family: usize = 0x24; |
223e47cc | 33 | |
c34b1796 | 34 | pub const tag_items_data_item_type: usize = 0x25; |
223e47cc | 35 | |
c34b1796 | 36 | pub const tag_items_data_item_symbol: usize = 0x26; |
223e47cc | 37 | |
c34b1796 | 38 | pub const tag_items_data_item_variant: usize = 0x27; |
223e47cc | 39 | |
c34b1796 | 40 | pub const tag_items_data_parent_item: usize = 0x28; |
223e47cc | 41 | |
c34b1796 | 42 | pub const tag_items_data_item_is_tuple_struct_ctor: usize = 0x29; |
223e47cc | 43 | |
b039eaaf SL |
44 | pub const tag_items_closure_kind: usize = 0x2a; |
45 | pub const tag_items_closure_ty: usize = 0x2b; | |
46 | pub const tag_def_key: usize = 0x2c; | |
223e47cc | 47 | |
b039eaaf SL |
48 | // GAP 0x2d 0x2e |
49 | ||
50 | pub const tag_index: usize = 0x110; // top-level only | |
51 | pub const tag_xref_index: usize = 0x111; // top-level only | |
52 | pub const tag_xref_data: usize = 0x112; // top-level only | |
223e47cc | 53 | |
c34b1796 | 54 | pub const tag_meta_item_name_value: usize = 0x2f; |
223e47cc | 55 | |
c34b1796 | 56 | pub const tag_meta_item_name: usize = 0x30; |
223e47cc | 57 | |
c34b1796 | 58 | pub const tag_meta_item_value: usize = 0x31; |
223e47cc | 59 | |
c34b1796 | 60 | pub const tag_attributes: usize = 0x101; // top-level only |
223e47cc | 61 | |
c34b1796 | 62 | pub const tag_attribute: usize = 0x32; |
223e47cc | 63 | |
c34b1796 | 64 | pub const tag_meta_item_word: usize = 0x33; |
223e47cc | 65 | |
c34b1796 | 66 | pub const tag_meta_item_list: usize = 0x34; |
223e47cc LB |
67 | |
68 | // The list of crates that this crate depends on | |
c34b1796 | 69 | pub const tag_crate_deps: usize = 0x102; // top-level only |
223e47cc LB |
70 | |
71 | // A single crate dependency | |
c34b1796 | 72 | pub const tag_crate_dep: usize = 0x35; |
223e47cc | 73 | |
c34b1796 AL |
74 | pub const tag_crate_hash: usize = 0x103; // top-level only |
75 | pub const tag_crate_crate_name: usize = 0x104; // top-level only | |
54a0048b | 76 | pub const tag_crate_disambiguator: usize = 0x113; // top-level only |
223e47cc | 77 | |
c34b1796 AL |
78 | pub const tag_crate_dep_crate_name: usize = 0x36; |
79 | pub const tag_crate_dep_hash: usize = 0x37; | |
e9174d1e | 80 | pub const tag_crate_dep_explicitly_linked: usize = 0x38; // top-level only |
223e47cc | 81 | |
e9174d1e | 82 | pub const tag_item_trait_item: usize = 0x3a; |
223e47cc | 83 | |
e9174d1e | 84 | pub const tag_item_trait_ref: usize = 0x3b; |
223e47cc LB |
85 | |
86 | // discriminator value for variants | |
c34b1796 | 87 | pub const tag_disr_val: usize = 0x3c; |
1a4d82fc | 88 | |
54a0048b | 89 | // GAP 0x3d, 0x3e, 0x3f, 0x40 |
c34b1796 | 90 | |
54a0048b SL |
91 | pub const tag_item_field: usize = 0x41; |
92 | // GAP 0x42 | |
c34b1796 | 93 | pub const tag_item_variances: usize = 0x43; |
223e47cc | 94 | /* |
1a4d82fc JJ |
95 | trait items contain tag_item_trait_item elements, |
96 | impl items contain tag_item_impl_item elements, and classes | |
223e47cc LB |
97 | have both. That's because some code treats classes like traits, |
98 | and other code treats them like impls. Because classes can contain | |
1a4d82fc | 99 | both, tag_item_trait_item and tag_item_impl_item have to be two |
223e47cc LB |
100 | different tags. |
101 | */ | |
c34b1796 AL |
102 | pub const tag_item_impl_item: usize = 0x44; |
103 | pub const tag_item_trait_method_explicit_self: usize = 0x45; | |
223e47cc | 104 | |
970d7e83 | 105 | |
223e47cc LB |
106 | // Reexports are found within module tags. Each reexport contains def_ids |
107 | // and names. | |
c34b1796 AL |
108 | pub const tag_items_data_item_reexport: usize = 0x46; |
109 | pub const tag_items_data_item_reexport_def_id: usize = 0x47; | |
110 | pub const tag_items_data_item_reexport_name: usize = 0x48; | |
223e47cc LB |
111 | |
112 | // used to encode crate_ctxt side tables | |
9346a6ac AL |
113 | enum_from_u32! { |
114 | #[derive(Copy, Clone, PartialEq)] | |
115 | #[repr(usize)] | |
116 | pub enum astencode_tag { // Reserves 0x50 -- 0x6f | |
117 | tag_ast = 0x50, | |
118 | ||
119 | tag_tree = 0x51, | |
120 | ||
9cc50fc6 SL |
121 | tag_mir = 0x52, |
122 | ||
9346a6ac AL |
123 | tag_table = 0x53, |
124 | // GAP 0x54, 0x55 | |
125 | tag_table_def = 0x56, | |
126 | tag_table_node_type = 0x57, | |
127 | tag_table_item_subst = 0x58, | |
128 | tag_table_freevars = 0x59, | |
b039eaaf | 129 | // GAP 0x5a, 0x5b, 0x5c, 0x5d, 0x5e |
9346a6ac | 130 | tag_table_method_map = 0x5f, |
b039eaaf | 131 | // GAP 0x60 |
9346a6ac | 132 | tag_table_adjustments = 0x61, |
b039eaaf | 133 | // GAP 0x62, 0x63, 0x64, 0x65 |
9346a6ac | 134 | tag_table_upvar_capture_map = 0x66, |
b039eaaf | 135 | // GAP 0x67, 0x68 |
9346a6ac | 136 | tag_table_const_qualif = 0x69, |
62682a34 | 137 | tag_table_cast_kinds = 0x6a, |
9346a6ac | 138 | } |
970d7e83 | 139 | } |
223e47cc | 140 | |
c34b1796 | 141 | pub const tag_item_trait_item_sort: usize = 0x70; |
1a4d82fc | 142 | |
c34b1796 | 143 | pub const tag_crate_triple: usize = 0x105; // top-level only |
1a4d82fc | 144 | |
c34b1796 | 145 | pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only |
223e47cc LB |
146 | |
147 | // Language items are a top-level directory (for speed). Hierarchy: | |
148 | // | |
149 | // tag_lang_items | |
150 | // - tag_lang_items_item | |
151 | // - tag_lang_items_item_id: u32 | |
b039eaaf | 152 | // - tag_lang_items_item_index: u32 |
223e47cc | 153 | |
c34b1796 AL |
154 | pub const tag_lang_items: usize = 0x107; // top-level only |
155 | pub const tag_lang_items_item: usize = 0x73; | |
156 | pub const tag_lang_items_item_id: usize = 0x74; | |
b039eaaf | 157 | pub const tag_lang_items_item_index: usize = 0x75; |
c34b1796 | 158 | pub const tag_lang_items_missing: usize = 0x76; |
1a4d82fc | 159 | |
c34b1796 AL |
160 | pub const tag_item_unnamed_field: usize = 0x77; |
161 | pub const tag_items_data_item_visibility: usize = 0x78; | |
b039eaaf SL |
162 | pub const tag_items_data_item_inherent_impl: usize = 0x79; |
163 | // GAP 0x7a | |
c34b1796 AL |
164 | pub const tag_mod_child: usize = 0x7b; |
165 | pub const tag_misc_info: usize = 0x108; // top-level only | |
166 | pub const tag_misc_info_crate_items: usize = 0x7c; | |
1a4d82fc | 167 | |
c34b1796 | 168 | pub const tag_impls: usize = 0x109; // top-level only |
b039eaaf SL |
169 | pub const tag_impls_trait: usize = 0x7d; |
170 | pub const tag_impls_trait_impl: usize = 0x7e; | |
1a4d82fc | 171 | |
b039eaaf | 172 | // GAP 0x7f, 0x80, 0x81 |
223e47cc | 173 | |
c34b1796 AL |
174 | pub const tag_native_libraries: usize = 0x10a; // top-level only |
175 | pub const tag_native_libraries_lib: usize = 0x82; | |
176 | pub const tag_native_libraries_name: usize = 0x83; | |
177 | pub const tag_native_libraries_kind: usize = 0x84; | |
223e47cc | 178 | |
c34b1796 | 179 | pub const tag_plugin_registrar_fn: usize = 0x10b; // top-level only |
223e47cc | 180 | |
c34b1796 AL |
181 | pub const tag_method_argument_names: usize = 0x85; |
182 | pub const tag_method_argument_name: usize = 0x86; | |
970d7e83 | 183 | |
e9174d1e SL |
184 | pub const tag_reachable_ids: usize = 0x10c; // top-level only |
185 | pub const tag_reachable_id: usize = 0x87; | |
970d7e83 | 186 | |
c34b1796 | 187 | pub const tag_items_data_item_stability: usize = 0x88; |
1a4d82fc | 188 | |
c34b1796 | 189 | pub const tag_items_data_item_repr: usize = 0x89; |
1a4d82fc | 190 | |
c34b1796 AL |
191 | pub const tag_struct_fields: usize = 0x10d; // top-level only |
192 | pub const tag_struct_field: usize = 0x8a; | |
c34b1796 | 193 | |
b039eaaf | 194 | pub const tag_items_data_item_struct_ctor: usize = 0x8b; |
c34b1796 | 195 | pub const tag_attribute_is_sugared_doc: usize = 0x8c; |
b039eaaf | 196 | // GAP 0x8d |
c34b1796 | 197 | pub const tag_items_data_region: usize = 0x8e; |
1a4d82fc | 198 | |
c34b1796 AL |
199 | pub const tag_region_param_def: usize = 0x8f; |
200 | pub const tag_region_param_def_ident: usize = 0x90; | |
201 | pub const tag_region_param_def_def_id: usize = 0x91; | |
202 | pub const tag_region_param_def_space: usize = 0x92; | |
203 | pub const tag_region_param_def_index: usize = 0x93; | |
1a4d82fc | 204 | |
c34b1796 | 205 | pub const tag_type_param_def: usize = 0x94; |
1a4d82fc | 206 | |
c34b1796 AL |
207 | pub const tag_item_generics: usize = 0x95; |
208 | pub const tag_method_ty_generics: usize = 0x96; | |
1a4d82fc | 209 | |
b039eaaf SL |
210 | pub const tag_type_predicate: usize = 0x97; |
211 | pub const tag_self_predicate: usize = 0x98; | |
212 | pub const tag_fn_predicate: usize = 0x99; | |
1a4d82fc | 213 | |
c34b1796 | 214 | pub const tag_unsafety: usize = 0x9a; |
1a4d82fc | 215 | |
c34b1796 AL |
216 | pub const tag_associated_type_names: usize = 0x9b; |
217 | pub const tag_associated_type_name: usize = 0x9c; | |
1a4d82fc | 218 | |
c34b1796 | 219 | pub const tag_polarity: usize = 0x9d; |
1a4d82fc | 220 | |
c34b1796 AL |
221 | pub const tag_macro_defs: usize = 0x10e; // top-level only |
222 | pub const tag_macro_def: usize = 0x9e; | |
223 | pub const tag_macro_def_body: usize = 0x9f; | |
7453a54e SL |
224 | pub const tag_macro_def_span_lo: usize = 0xa8; |
225 | pub const tag_macro_def_span_hi: usize = 0xa9; | |
1a4d82fc | 226 | |
c34b1796 | 227 | pub const tag_paren_sugar: usize = 0xa0; |
1a4d82fc | 228 | |
c34b1796 AL |
229 | pub const tag_codemap: usize = 0xa1; |
230 | pub const tag_codemap_filemap: usize = 0xa2; | |
1a4d82fc | 231 | |
c34b1796 | 232 | pub const tag_item_super_predicates: usize = 0xa3; |
85aaf69f | 233 | |
c34b1796 | 234 | pub const tag_defaulted_trait: usize = 0xa4; |
d9579d0f AL |
235 | |
236 | pub const tag_impl_coerce_unsized_kind: usize = 0xa5; | |
62682a34 SL |
237 | |
238 | pub const tag_items_data_item_constness: usize = 0xa6; | |
b039eaaf | 239 | |
9cc50fc6 SL |
240 | pub const tag_items_data_item_deprecation: usize = 0xa7; |
241 | ||
54a0048b SL |
242 | pub const tag_items_data_item_defaultness: usize = 0xa8; |
243 | ||
244 | pub const tag_items_data_parent_impl: usize = 0xa9; | |
245 | ||
b039eaaf SL |
246 | pub const tag_rustc_version: usize = 0x10f; |
247 | pub fn rustc_version() -> String { | |
248 | format!( | |
249 | "rustc {}", | |
250 | option_env!("CFG_VERSION").unwrap_or("unknown version") | |
251 | ) | |
252 | } |