2015-02-28 10:09:39 -06:00
|
|
|
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
2012-12-03 18:48:01 -06:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
2013-12-09 15:56:53 -06:00
|
|
|
|
2014-10-27 17:37:07 -05:00
|
|
|
#![allow(non_camel_case_types, non_upper_case_globals)]
|
2014-02-10 08:36:31 -06:00
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
pub use self::astencode_tag::*;
|
|
|
|
|
2015-02-28 10:09:39 -06:00
|
|
|
// RBML enum definitions and utils shared by the encoder and decoder
|
|
|
|
//
|
|
|
|
// 0x00..0x1f: reserved for RBML generic type tags
|
|
|
|
// 0x20..0xef: free for use, preferred for frequent tags
|
|
|
|
// 0xf0..0xff: internally used by RBML to encode 0x100..0xfff in two bytes
|
|
|
|
// 0x100..0xfff: free for use, preferred for infrequent tags
|
2011-07-07 14:22:39 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items: usize = 0x100; // top-level only
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_paths_data_name: usize = 0x20;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_def_id: usize = 0x21;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data: usize = 0x22;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item: usize = 0x23;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_family: usize = 0x24;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_type: usize = 0x25;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2016-05-12 11:58:11 -05:00
|
|
|
// GAP 0x26
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_variant: usize = 0x27;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_parent_item: usize = 0x28;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_is_tuple_struct_ctor: usize = 0x29;
|
2014-01-30 06:36:05 -06:00
|
|
|
|
2015-09-17 13:29:59 -05:00
|
|
|
pub const tag_items_closure_kind: usize = 0x2a;
|
|
|
|
pub const tag_items_closure_ty: usize = 0x2b;
|
2015-10-02 08:12:20 -05:00
|
|
|
pub const tag_def_key: usize = 0x2c;
|
2015-09-17 13:29:59 -05:00
|
|
|
|
2015-10-02 08:12:20 -05:00
|
|
|
// GAP 0x2d 0x2e
|
2015-09-17 13:29:59 -05:00
|
|
|
|
2015-09-17 08:04:18 -05:00
|
|
|
pub const tag_index: usize = 0x110; // top-level only
|
|
|
|
pub const tag_xref_index: usize = 0x111; // top-level only
|
|
|
|
pub const tag_xref_data: usize = 0x112; // top-level only
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_meta_item_name_value: usize = 0x2f;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_meta_item_name: usize = 0x30;
|
2011-06-27 16:54:59 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_meta_item_value: usize = 0x31;
|
2011-06-27 21:41:48 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_attributes: usize = 0x101; // top-level only
|
2011-06-27 21:41:48 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_attribute: usize = 0x32;
|
2011-06-27 21:41:48 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_meta_item_word: usize = 0x33;
|
2011-06-28 01:02:02 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_meta_item_list: usize = 0x34;
|
2011-07-07 14:22:39 -05:00
|
|
|
|
2011-07-08 13:29:56 -05:00
|
|
|
// The list of crates that this crate depends on
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_crate_deps: usize = 0x102; // top-level only
|
2011-07-08 13:29:56 -05:00
|
|
|
|
|
|
|
// A single crate dependency
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_crate_dep: usize = 0x35;
|
2011-07-08 13:29:56 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_crate_hash: usize = 0x103; // top-level only
|
|
|
|
pub const tag_crate_crate_name: usize = 0x104; // top-level only
|
2016-02-12 07:41:30 -06:00
|
|
|
pub const tag_crate_disambiguator: usize = 0x113; // top-level only
|
2011-12-11 09:23:38 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_crate_dep_crate_name: usize = 0x36;
|
|
|
|
pub const tag_crate_dep_hash: usize = 0x37;
|
2015-06-25 12:07:01 -05:00
|
|
|
pub const tag_crate_dep_explicitly_linked: usize = 0x38; // top-level only
|
2012-04-07 12:59:37 -05:00
|
|
|
|
2015-06-25 12:07:01 -05:00
|
|
|
pub const tag_item_trait_item: usize = 0x3a;
|
2013-03-27 05:16:28 -05:00
|
|
|
|
2015-06-25 12:07:01 -05:00
|
|
|
pub const tag_item_trait_ref: usize = 0x3b;
|
2011-12-16 07:17:52 -06:00
|
|
|
|
2012-01-10 15:50:40 -06:00
|
|
|
// discriminator value for variants
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_disr_val: usize = 0x3c;
|
2014-02-13 23:07:09 -06:00
|
|
|
|
2016-04-06 05:51:55 -05:00
|
|
|
// GAP 0x3d, 0x3e, 0x3f, 0x40
|
2015-03-25 19:06:52 -05:00
|
|
|
|
2016-04-06 05:51:55 -05:00
|
|
|
pub const tag_item_field: usize = 0x41;
|
|
|
|
// GAP 0x42
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_item_variances: usize = 0x43;
|
2012-04-26 14:15:46 -05:00
|
|
|
/*
|
2014-08-04 15:56:56 -05:00
|
|
|
trait items contain tag_item_trait_item elements,
|
|
|
|
impl items contain tag_item_impl_item elements, and classes
|
2012-07-03 18:30:42 -05:00
|
|
|
have both. That's because some code treats classes like traits,
|
2012-04-26 14:15:46 -05:00
|
|
|
and other code treats them like impls. Because classes can contain
|
2014-08-04 15:56:56 -05:00
|
|
|
both, tag_item_trait_item and tag_item_impl_item have to be two
|
2012-04-26 14:15:46 -05:00
|
|
|
different tags.
|
|
|
|
*/
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_item_impl_item: usize = 0x44;
|
|
|
|
pub const tag_item_trait_method_explicit_self: usize = 0x45;
|
2012-04-18 23:26:25 -05:00
|
|
|
|
2013-03-27 09:26:57 -05:00
|
|
|
|
2012-08-17 14:41:34 -05:00
|
|
|
// Reexports are found within module tags. Each reexport contains def_ids
|
|
|
|
// and names.
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_reexport: usize = 0x46;
|
|
|
|
pub const tag_items_data_item_reexport_def_id: usize = 0x47;
|
|
|
|
pub const tag_items_data_item_reexport_name: usize = 0x48;
|
2012-08-17 14:41:34 -05:00
|
|
|
|
2012-02-14 17:21:53 -06:00
|
|
|
// used to encode crate_ctxt side tables
|
2015-04-17 17:32:42 -05:00
|
|
|
enum_from_u32! {
|
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
#[repr(usize)]
|
|
|
|
pub enum astencode_tag { // Reserves 0x50 -- 0x6f
|
|
|
|
tag_ast = 0x50,
|
|
|
|
|
|
|
|
tag_tree = 0x51,
|
|
|
|
|
2015-12-08 14:53:19 -06:00
|
|
|
tag_mir = 0x52,
|
|
|
|
|
2015-04-17 17:32:42 -05:00
|
|
|
tag_table = 0x53,
|
|
|
|
// GAP 0x54, 0x55
|
|
|
|
tag_table_def = 0x56,
|
|
|
|
tag_table_node_type = 0x57,
|
|
|
|
tag_table_item_subst = 0x58,
|
|
|
|
tag_table_freevars = 0x59,
|
2015-09-29 15:51:55 -05:00
|
|
|
// GAP 0x5a, 0x5b, 0x5c, 0x5d, 0x5e
|
2015-04-17 17:32:42 -05:00
|
|
|
tag_table_method_map = 0x5f,
|
2015-09-17 04:30:04 -05:00
|
|
|
// GAP 0x60
|
2015-04-17 17:32:42 -05:00
|
|
|
tag_table_adjustments = 0x61,
|
2015-10-02 08:44:26 -05:00
|
|
|
// GAP 0x62, 0x63, 0x64, 0x65
|
2015-04-17 17:32:42 -05:00
|
|
|
tag_table_upvar_capture_map = 0x66,
|
2015-09-17 04:30:04 -05:00
|
|
|
// GAP 0x67, 0x68
|
2015-04-17 17:32:42 -05:00
|
|
|
tag_table_const_qualif = 0x69,
|
2015-05-05 11:36:47 -05:00
|
|
|
tag_table_cast_kinds = 0x6a,
|
2015-04-17 17:32:42 -05:00
|
|
|
}
|
2012-02-14 17:21:53 -06:00
|
|
|
}
|
librustc: Make `Copy` opt-in.
This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.
A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.
For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.
This breaks code like:
#[deriving(Show)]
struct Point2D {
x: int,
y: int,
}
fn main() {
let mypoint = Point2D {
x: 1,
y: 1,
};
let otherpoint = mypoint;
println!("{}{}", mypoint, otherpoint);
}
Change this code to:
#[deriving(Show)]
struct Point2D {
x: int,
y: int,
}
impl Copy for Point2D {}
fn main() {
let mypoint = Point2D {
x: 1,
y: 1,
};
let otherpoint = mypoint;
println!("{}{}", mypoint, otherpoint);
}
This is the backwards-incompatible part of #13231.
Part of RFC #3.
[breaking-change]
2014-12-05 19:01:33 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_item_trait_item_sort: usize = 0x70;
|
2012-10-08 14:39:30 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_crate_triple: usize = 0x105; // top-level only
|
2014-05-29 00:26:56 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only
|
2014-05-29 00:26:56 -05:00
|
|
|
|
2013-01-07 12:51:53 -06:00
|
|
|
// Language items are a top-level directory (for speed). Hierarchy:
|
|
|
|
//
|
|
|
|
// tag_lang_items
|
|
|
|
// - tag_lang_items_item
|
|
|
|
// - tag_lang_items_item_id: u32
|
2015-09-17 13:29:59 -05:00
|
|
|
// - tag_lang_items_item_index: u32
|
2013-01-07 12:51:53 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_lang_items: usize = 0x107; // top-level only
|
|
|
|
pub const tag_lang_items_item: usize = 0x73;
|
|
|
|
pub const tag_lang_items_item_id: usize = 0x74;
|
2015-09-17 13:29:59 -05:00
|
|
|
pub const tag_lang_items_item_index: usize = 0x75;
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_lang_items_missing: usize = 0x76;
|
2013-01-07 12:51:53 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_item_unnamed_field: usize = 0x77;
|
|
|
|
pub const tag_items_data_item_visibility: usize = 0x78;
|
2015-10-02 08:44:26 -05:00
|
|
|
pub const tag_items_data_item_inherent_impl: usize = 0x79;
|
|
|
|
// GAP 0x7a
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_mod_child: usize = 0x7b;
|
|
|
|
pub const tag_misc_info: usize = 0x108; // top-level only
|
|
|
|
pub const tag_misc_info_crate_items: usize = 0x7c;
|
2013-07-16 18:28:33 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_impls: usize = 0x109; // top-level only
|
2015-10-02 08:44:26 -05:00
|
|
|
pub const tag_impls_trait: usize = 0x7d;
|
|
|
|
pub const tag_impls_trait_impl: usize = 0x7e;
|
2013-08-23 16:34:00 -05:00
|
|
|
|
2015-10-02 08:44:26 -05:00
|
|
|
// GAP 0x7f, 0x80, 0x81
|
2013-08-30 02:47:10 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_native_libraries: usize = 0x10a; // top-level only
|
|
|
|
pub const tag_native_libraries_lib: usize = 0x82;
|
|
|
|
pub const tag_native_libraries_name: usize = 0x83;
|
|
|
|
pub const tag_native_libraries_kind: usize = 0x84;
|
2013-10-29 05:03:32 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_plugin_registrar_fn: usize = 0x10b; // top-level only
|
2014-12-30 21:10:46 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_method_argument_names: usize = 0x85;
|
|
|
|
pub const tag_method_argument_name: usize = 0x86;
|
2013-12-25 12:10:33 -06:00
|
|
|
|
2015-07-28 19:19:08 -05:00
|
|
|
pub const tag_reachable_ids: usize = 0x10c; // top-level only
|
|
|
|
pub const tag_reachable_id: usize = 0x87;
|
2014-05-23 19:13:44 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_stability: usize = 0x88;
|
2014-06-06 19:48:46 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_item_repr: usize = 0x89;
|
2014-09-29 23:52:06 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_struct_fields: usize = 0x10d; // top-level only
|
|
|
|
pub const tag_struct_field: usize = 0x8a;
|
2014-07-30 00:08:39 -05:00
|
|
|
|
2015-10-02 08:12:20 -05:00
|
|
|
pub const tag_items_data_item_struct_ctor: usize = 0x8b;
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_attribute_is_sugared_doc: usize = 0x8c;
|
2015-10-02 08:44:26 -05:00
|
|
|
// GAP 0x8d
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_items_data_region: usize = 0x8e;
|
2014-08-27 20:46:52 -05:00
|
|
|
|
2016-08-08 15:39:49 -05:00
|
|
|
pub const tag_item_generics: usize = 0x8f;
|
|
|
|
// GAP 0x90, 0x91, 0x92, 0x93, 0x94
|
2014-08-27 20:46:52 -05:00
|
|
|
|
2016-08-08 15:39:49 -05:00
|
|
|
pub const tag_item_predicates: usize = 0x95;
|
|
|
|
// GAP 0x96
|
2014-12-07 10:10:48 -06:00
|
|
|
|
2016-06-13 12:10:32 -05:00
|
|
|
pub const tag_predicate: usize = 0x97;
|
|
|
|
// GAP 0x98, 0x99
|
2014-12-09 18:59:20 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_unsafety: usize = 0x9a;
|
2014-12-17 13:16:28 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_associated_type_names: usize = 0x9b;
|
|
|
|
pub const tag_associated_type_name: usize = 0x9c;
|
2014-12-28 16:33:18 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_polarity: usize = 0x9d;
|
2014-12-30 21:10:46 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_macro_defs: usize = 0x10e; // top-level only
|
|
|
|
pub const tag_macro_def: usize = 0x9e;
|
|
|
|
pub const tag_macro_def_body: usize = 0x9f;
|
2016-01-29 01:22:55 -06:00
|
|
|
pub const tag_macro_def_span_lo: usize = 0xa8;
|
|
|
|
pub const tag_macro_def_span_hi: usize = 0xa9;
|
2015-01-26 13:39:58 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_paren_sugar: usize = 0xa0;
|
2015-02-11 11:29:49 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_codemap: usize = 0xa1;
|
|
|
|
pub const tag_codemap_filemap: usize = 0xa2;
|
2015-02-24 08:24:42 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_item_super_predicates: usize = 0xa3;
|
2015-03-04 14:19:27 -06:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
pub const tag_defaulted_trait: usize = 0xa4;
|
2015-04-14 18:57:29 -05:00
|
|
|
|
|
|
|
pub const tag_impl_coerce_unsized_kind: usize = 0xa5;
|
2015-02-25 14:06:08 -06:00
|
|
|
|
|
|
|
pub const tag_items_data_item_constness: usize = 0xa6;
|
2015-09-27 23:31:45 -05:00
|
|
|
|
2015-12-04 10:34:28 -06:00
|
|
|
pub const tag_items_data_item_deprecation: usize = 0xa7;
|
|
|
|
|
2015-12-28 18:14:28 -06:00
|
|
|
pub const tag_items_data_item_defaultness: usize = 0xa8;
|
|
|
|
|
2015-12-22 12:20:47 -06:00
|
|
|
pub const tag_items_data_parent_impl: usize = 0xa9;
|
|
|
|
|
2015-09-27 23:31:45 -05:00
|
|
|
pub const tag_rustc_version: usize = 0x10f;
|
|
|
|
pub fn rustc_version() -> String {
|
|
|
|
format!(
|
|
|
|
"rustc {}",
|
2016-05-17 13:55:34 -05:00
|
|
|
option_env!("CFG_VERSION").unwrap_or("unknown version")
|
2015-09-27 23:31:45 -05:00
|
|
|
)
|
|
|
|
}
|
rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.
[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md
Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.
With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.
Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-04-08 18:18:40 -05:00
|
|
|
|
|
|
|
pub const tag_panic_strategy: usize = 0x114;
|
2016-07-01 16:36:33 -05:00
|
|
|
|
|
|
|
// NB: increment this if you change the format of metadata such that
|
|
|
|
// rustc_version can't be found.
|
|
|
|
pub const metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 2];
|