]>
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 | ||
1a4d82fc | 15 | use back::svh::Svh; |
223e47cc | 16 | |
c34b1796 AL |
17 | // RBML enum definitions and utils shared by the encoder and decoder |
18 | // | |
19 | // 0x00..0x1f: reserved for RBML generic type tags | |
20 | // 0x20..0xef: free for use, preferred for frequent tags | |
21 | // 0xf0..0xff: internally used by RBML to encode 0x100..0xfff in two bytes | |
22 | // 0x100..0xfff: free for use, preferred for infrequent tags | |
223e47cc | 23 | |
c34b1796 | 24 | pub const tag_items: usize = 0x100; // top-level only |
223e47cc | 25 | |
c34b1796 | 26 | pub const tag_paths_data_name: usize = 0x20; |
223e47cc | 27 | |
c34b1796 | 28 | pub const tag_def_id: usize = 0x21; |
223e47cc | 29 | |
c34b1796 | 30 | pub const tag_items_data: usize = 0x22; |
223e47cc | 31 | |
c34b1796 | 32 | pub const tag_items_data_item: usize = 0x23; |
223e47cc | 33 | |
c34b1796 | 34 | pub const tag_items_data_item_family: usize = 0x24; |
223e47cc | 35 | |
c34b1796 | 36 | pub const tag_items_data_item_type: usize = 0x25; |
223e47cc | 37 | |
c34b1796 | 38 | pub const tag_items_data_item_symbol: usize = 0x26; |
223e47cc | 39 | |
c34b1796 | 40 | pub const tag_items_data_item_variant: usize = 0x27; |
223e47cc | 41 | |
c34b1796 | 42 | pub const tag_items_data_parent_item: usize = 0x28; |
223e47cc | 43 | |
c34b1796 | 44 | pub const tag_items_data_item_is_tuple_struct_ctor: usize = 0x29; |
223e47cc | 45 | |
c34b1796 | 46 | pub const tag_index: usize = 0x2a; |
223e47cc | 47 | |
c34b1796 | 48 | pub const tag_index_buckets: usize = 0x2b; |
223e47cc | 49 | |
c34b1796 | 50 | pub const tag_index_buckets_bucket: usize = 0x2c; |
223e47cc | 51 | |
c34b1796 | 52 | pub const tag_index_buckets_bucket_elt: usize = 0x2d; |
223e47cc | 53 | |
c34b1796 | 54 | pub const tag_index_table: usize = 0x2e; |
223e47cc | 55 | |
c34b1796 | 56 | pub const tag_meta_item_name_value: usize = 0x2f; |
223e47cc | 57 | |
c34b1796 | 58 | pub const tag_meta_item_name: usize = 0x30; |
223e47cc | 59 | |
c34b1796 | 60 | pub const tag_meta_item_value: usize = 0x31; |
223e47cc | 61 | |
c34b1796 | 62 | pub const tag_attributes: usize = 0x101; // top-level only |
223e47cc | 63 | |
c34b1796 | 64 | pub const tag_attribute: usize = 0x32; |
223e47cc | 65 | |
c34b1796 | 66 | pub const tag_meta_item_word: usize = 0x33; |
223e47cc | 67 | |
c34b1796 | 68 | pub const tag_meta_item_list: usize = 0x34; |
223e47cc LB |
69 | |
70 | // The list of crates that this crate depends on | |
c34b1796 | 71 | pub const tag_crate_deps: usize = 0x102; // top-level only |
223e47cc LB |
72 | |
73 | // A single crate dependency | |
c34b1796 | 74 | pub const tag_crate_dep: usize = 0x35; |
223e47cc | 75 | |
c34b1796 AL |
76 | pub const tag_crate_hash: usize = 0x103; // top-level only |
77 | pub const tag_crate_crate_name: usize = 0x104; // top-level only | |
223e47cc | 78 | |
c34b1796 AL |
79 | pub const tag_crate_dep_crate_name: usize = 0x36; |
80 | pub const tag_crate_dep_hash: usize = 0x37; | |
223e47cc | 81 | |
c34b1796 | 82 | pub const tag_mod_impl: usize = 0x38; |
223e47cc | 83 | |
c34b1796 | 84 | pub const tag_item_trait_item: usize = 0x39; |
223e47cc | 85 | |
c34b1796 | 86 | pub const tag_item_trait_ref: usize = 0x3a; |
223e47cc LB |
87 | |
88 | // discriminator value for variants | |
c34b1796 | 89 | pub const tag_disr_val: usize = 0x3c; |
1a4d82fc JJ |
90 | |
91 | // used to encode ast_map::PathElem | |
c34b1796 AL |
92 | pub const tag_path: usize = 0x3d; |
93 | pub const tag_path_len: usize = 0x3e; | |
94 | pub const tag_path_elem_mod: usize = 0x3f; | |
95 | pub const tag_path_elem_name: usize = 0x40; | |
96 | pub const tag_item_field: usize = 0x41; | |
97 | pub const tag_item_field_origin: usize = 0x42; | |
98 | ||
99 | pub const tag_item_variances: usize = 0x43; | |
223e47cc | 100 | /* |
1a4d82fc JJ |
101 | trait items contain tag_item_trait_item elements, |
102 | impl items contain tag_item_impl_item elements, and classes | |
223e47cc LB |
103 | have both. That's because some code treats classes like traits, |
104 | and other code treats them like impls. Because classes can contain | |
1a4d82fc | 105 | both, tag_item_trait_item and tag_item_impl_item have to be two |
223e47cc LB |
106 | different tags. |
107 | */ | |
c34b1796 AL |
108 | pub const tag_item_impl_item: usize = 0x44; |
109 | pub const tag_item_trait_method_explicit_self: usize = 0x45; | |
223e47cc | 110 | |
970d7e83 | 111 | |
223e47cc LB |
112 | // Reexports are found within module tags. Each reexport contains def_ids |
113 | // and names. | |
c34b1796 AL |
114 | pub const tag_items_data_item_reexport: usize = 0x46; |
115 | pub const tag_items_data_item_reexport_def_id: usize = 0x47; | |
116 | pub const tag_items_data_item_reexport_name: usize = 0x48; | |
223e47cc LB |
117 | |
118 | // used to encode crate_ctxt side tables | |
9346a6ac AL |
119 | enum_from_u32! { |
120 | #[derive(Copy, Clone, PartialEq)] | |
121 | #[repr(usize)] | |
122 | pub enum astencode_tag { // Reserves 0x50 -- 0x6f | |
123 | tag_ast = 0x50, | |
124 | ||
125 | tag_tree = 0x51, | |
126 | ||
127 | tag_id_range = 0x52, | |
128 | ||
129 | tag_table = 0x53, | |
130 | // GAP 0x54, 0x55 | |
131 | tag_table_def = 0x56, | |
132 | tag_table_node_type = 0x57, | |
133 | tag_table_item_subst = 0x58, | |
134 | tag_table_freevars = 0x59, | |
135 | tag_table_tcache = 0x5a, | |
136 | tag_table_param_defs = 0x5b, | |
137 | tag_table_mutbl = 0x5c, | |
138 | tag_table_last_use = 0x5d, | |
139 | tag_table_spill = 0x5e, | |
140 | tag_table_method_map = 0x5f, | |
141 | tag_table_vtable_map = 0x60, | |
142 | tag_table_adjustments = 0x61, | |
143 | tag_table_moves_map = 0x62, | |
144 | tag_table_capture_map = 0x63, | |
145 | tag_table_closure_tys = 0x64, | |
146 | tag_table_closure_kinds = 0x65, | |
147 | tag_table_upvar_capture_map = 0x66, | |
148 | tag_table_capture_modes = 0x67, | |
149 | tag_table_object_cast_map = 0x68, | |
150 | tag_table_const_qualif = 0x69, | |
151 | } | |
970d7e83 | 152 | } |
223e47cc | 153 | |
c34b1796 | 154 | pub const tag_item_trait_item_sort: usize = 0x70; |
1a4d82fc | 155 | |
c34b1796 | 156 | pub const tag_item_trait_parent_sort: usize = 0x71; |
1a4d82fc | 157 | |
c34b1796 | 158 | pub const tag_item_impl_type_basename: usize = 0x72; |
223e47cc | 159 | |
c34b1796 | 160 | pub const tag_crate_triple: usize = 0x105; // top-level only |
1a4d82fc | 161 | |
c34b1796 | 162 | pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only |
223e47cc LB |
163 | |
164 | // Language items are a top-level directory (for speed). Hierarchy: | |
165 | // | |
166 | // tag_lang_items | |
167 | // - tag_lang_items_item | |
168 | // - tag_lang_items_item_id: u32 | |
169 | // - tag_lang_items_item_node_id: u32 | |
170 | ||
c34b1796 AL |
171 | pub const tag_lang_items: usize = 0x107; // top-level only |
172 | pub const tag_lang_items_item: usize = 0x73; | |
173 | pub const tag_lang_items_item_id: usize = 0x74; | |
174 | pub const tag_lang_items_item_node_id: usize = 0x75; | |
175 | pub const tag_lang_items_missing: usize = 0x76; | |
1a4d82fc | 176 | |
c34b1796 AL |
177 | pub const tag_item_unnamed_field: usize = 0x77; |
178 | pub const tag_items_data_item_visibility: usize = 0x78; | |
1a4d82fc | 179 | |
c34b1796 AL |
180 | pub const tag_item_method_tps: usize = 0x79; |
181 | pub const tag_item_method_fty: usize = 0x7a; | |
1a4d82fc | 182 | |
c34b1796 AL |
183 | pub const tag_mod_child: usize = 0x7b; |
184 | pub const tag_misc_info: usize = 0x108; // top-level only | |
185 | pub const tag_misc_info_crate_items: usize = 0x7c; | |
1a4d82fc | 186 | |
c34b1796 AL |
187 | pub const tag_item_method_provided_source: usize = 0x7d; |
188 | pub const tag_item_impl_vtables: usize = 0x7e; | |
1a4d82fc | 189 | |
c34b1796 AL |
190 | pub const tag_impls: usize = 0x109; // top-level only |
191 | pub const tag_impls_impl: usize = 0x7f; | |
d9579d0f | 192 | pub const tag_impls_impl_trait_def_id: usize = 0x8d; |
1a4d82fc | 193 | |
c34b1796 AL |
194 | pub const tag_items_data_item_inherent_impl: usize = 0x80; |
195 | pub const tag_items_data_item_extension_impl: usize = 0x81; | |
223e47cc | 196 | |
c34b1796 AL |
197 | pub const tag_native_libraries: usize = 0x10a; // top-level only |
198 | pub const tag_native_libraries_lib: usize = 0x82; | |
199 | pub const tag_native_libraries_name: usize = 0x83; | |
200 | pub const tag_native_libraries_kind: usize = 0x84; | |
223e47cc | 201 | |
c34b1796 | 202 | pub const tag_plugin_registrar_fn: usize = 0x10b; // top-level only |
223e47cc | 203 | |
c34b1796 AL |
204 | pub const tag_method_argument_names: usize = 0x85; |
205 | pub const tag_method_argument_name: usize = 0x86; | |
970d7e83 | 206 | |
c34b1796 AL |
207 | pub const tag_reachable_extern_fns: usize = 0x10c; // top-level only |
208 | pub const tag_reachable_extern_fn_id: usize = 0x87; | |
970d7e83 | 209 | |
c34b1796 | 210 | pub const tag_items_data_item_stability: usize = 0x88; |
1a4d82fc | 211 | |
c34b1796 | 212 | pub const tag_items_data_item_repr: usize = 0x89; |
1a4d82fc | 213 | |
85aaf69f | 214 | #[derive(Clone, Debug)] |
223e47cc | 215 | pub struct LinkMeta { |
1a4d82fc JJ |
216 | pub crate_name: String, |
217 | pub crate_hash: Svh, | |
223e47cc | 218 | } |
1a4d82fc | 219 | |
c34b1796 AL |
220 | pub const tag_struct_fields: usize = 0x10d; // top-level only |
221 | pub const tag_struct_field: usize = 0x8a; | |
222 | pub const tag_struct_field_id: usize = 0x8b; | |
223 | ||
224 | pub const tag_attribute_is_sugared_doc: usize = 0x8c; | |
1a4d82fc | 225 | |
c34b1796 | 226 | pub const tag_items_data_region: usize = 0x8e; |
1a4d82fc | 227 | |
c34b1796 AL |
228 | pub const tag_region_param_def: usize = 0x8f; |
229 | pub const tag_region_param_def_ident: usize = 0x90; | |
230 | pub const tag_region_param_def_def_id: usize = 0x91; | |
231 | pub const tag_region_param_def_space: usize = 0x92; | |
232 | pub const tag_region_param_def_index: usize = 0x93; | |
1a4d82fc | 233 | |
c34b1796 | 234 | pub const tag_type_param_def: usize = 0x94; |
1a4d82fc | 235 | |
c34b1796 AL |
236 | pub const tag_item_generics: usize = 0x95; |
237 | pub const tag_method_ty_generics: usize = 0x96; | |
1a4d82fc | 238 | |
c34b1796 AL |
239 | pub const tag_predicate: usize = 0x97; |
240 | pub const tag_predicate_space: usize = 0x98; | |
241 | pub const tag_predicate_data: usize = 0x99; | |
1a4d82fc | 242 | |
c34b1796 | 243 | pub const tag_unsafety: usize = 0x9a; |
1a4d82fc | 244 | |
c34b1796 AL |
245 | pub const tag_associated_type_names: usize = 0x9b; |
246 | pub const tag_associated_type_name: usize = 0x9c; | |
1a4d82fc | 247 | |
c34b1796 | 248 | pub const tag_polarity: usize = 0x9d; |
1a4d82fc | 249 | |
c34b1796 AL |
250 | pub const tag_macro_defs: usize = 0x10e; // top-level only |
251 | pub const tag_macro_def: usize = 0x9e; | |
252 | pub const tag_macro_def_body: usize = 0x9f; | |
1a4d82fc | 253 | |
c34b1796 | 254 | pub const tag_paren_sugar: usize = 0xa0; |
1a4d82fc | 255 | |
c34b1796 AL |
256 | pub const tag_codemap: usize = 0xa1; |
257 | pub const tag_codemap_filemap: usize = 0xa2; | |
1a4d82fc | 258 | |
c34b1796 | 259 | pub const tag_item_super_predicates: usize = 0xa3; |
85aaf69f | 260 | |
c34b1796 | 261 | pub const tag_defaulted_trait: usize = 0xa4; |
d9579d0f AL |
262 | |
263 | pub const tag_impl_coerce_unsized_kind: usize = 0xa5; |