]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_back/abi.rs
Auto merge of #31846 - alexcrichton:better-disable-jemallc, r=brson
[rust.git] / src / librustc_back / abi.rs
index 335317be4b419a0753b97977d7f6a175246c40ca..c3a3a8d582aff91f2fc400141e0b57d16d605234 100644 (file)
@@ -8,23 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(non_upper_case_globals)]
+pub const BOX_FIELD_DROP_GLUE: usize = 1;
+pub const BOX_FIELD_BODY: usize = 4;
 
-pub const box_field_refcnt: uint = 0u;
-pub const box_field_drop_glue: uint = 1u;
-pub const box_field_body: uint = 4u;
+/// The first half of a fat pointer.
+/// - For a closure, this is the code address.
+/// - For an object or trait instance, this is the address of the box.
+/// - For a slice, this is the base address.
+pub const FAT_PTR_ADDR: usize = 0;
 
-// FIXME(18590) although we have three different layouts here, the compiler relies on
-// them being the same. We should replace them with one set of constants.
-
-// The two halves of a closure: code and environment.
-pub const fn_field_code: uint = 0u;
-pub const fn_field_box: uint = 1u;
-
-// The two fields of a trait object/trait instance: vtable and box.
-// The vtable contains the type descriptor as first element.
-pub const trt_field_box: uint = 0u;
-pub const trt_field_vtable: uint = 1u;
-
-pub const slice_elt_base: uint = 0u;
-pub const slice_elt_len: uint = 1u;
+/// The second half of a fat pointer.
+/// - For a closure, this is the address of the environment.
+/// - For an object or trait instance, this is the address of the vtable.
+/// - For a slice, this is the length.
+pub const FAT_PTR_EXTRA: usize = 1;