mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-18 09:53:26 +00:00
Auto merge of #28097 - tbu-:pr_macro_to_const_fn, r=eddyb
This commit is contained in:
commit
9a82594b8e
@ -177,15 +177,12 @@ pub fn represent_type<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||
repr
|
||||
}
|
||||
|
||||
macro_rules! repeat_u8_as_u32 {
|
||||
($name:expr) => { (($name as u32) << 24 |
|
||||
($name as u32) << 16 |
|
||||
($name as u32) << 8 |
|
||||
($name as u32)) }
|
||||
const fn repeat_u8_as_u32(val: u8) -> u32 {
|
||||
(val as u32) << 24 | (val as u32) << 16 | (val as u32) << 8 | val as u32
|
||||
}
|
||||
macro_rules! repeat_u8_as_u64 {
|
||||
($name:expr) => { ((repeat_u8_as_u32!($name) as u64) << 32 |
|
||||
(repeat_u8_as_u32!($name) as u64)) }
|
||||
|
||||
const fn repeat_u8_as_u64(val: u8) -> u64 {
|
||||
(repeat_u8_as_u32(val) as u64) << 32 | repeat_u8_as_u32(val) as u64
|
||||
}
|
||||
|
||||
/// `DTOR_NEEDED_HINT` is a stack-local hint that just means
|
||||
@ -203,8 +200,8 @@ pub const DTOR_NEEDED_HINT: u8 = 0x3d;
|
||||
pub const DTOR_MOVED_HINT: u8 = 0x2d;
|
||||
|
||||
pub const DTOR_NEEDED: u8 = 0xd4;
|
||||
pub const DTOR_NEEDED_U32: u32 = repeat_u8_as_u32!(DTOR_NEEDED);
|
||||
pub const DTOR_NEEDED_U64: u64 = repeat_u8_as_u64!(DTOR_NEEDED);
|
||||
pub const DTOR_NEEDED_U32: u32 = repeat_u8_as_u32(DTOR_NEEDED);
|
||||
pub const DTOR_NEEDED_U64: u64 = repeat_u8_as_u64(DTOR_NEEDED);
|
||||
#[allow(dead_code)]
|
||||
pub fn dtor_needed_usize(ccx: &CrateContext) -> usize {
|
||||
match &ccx.tcx().sess.target.target.target_pointer_width[..] {
|
||||
@ -215,8 +212,8 @@ pub fn dtor_needed_usize(ccx: &CrateContext) -> usize {
|
||||
}
|
||||
|
||||
pub const DTOR_DONE: u8 = 0x1d;
|
||||
pub const DTOR_DONE_U32: u32 = repeat_u8_as_u32!(DTOR_DONE);
|
||||
pub const DTOR_DONE_U64: u64 = repeat_u8_as_u64!(DTOR_DONE);
|
||||
pub const DTOR_DONE_U32: u32 = repeat_u8_as_u32(DTOR_DONE);
|
||||
pub const DTOR_DONE_U64: u64 = repeat_u8_as_u64(DTOR_DONE);
|
||||
#[allow(dead_code)]
|
||||
pub fn dtor_done_usize(ccx: &CrateContext) -> usize {
|
||||
match &ccx.tcx().sess.target.target.target_pointer_width[..] {
|
||||
|
@ -1372,8 +1372,6 @@ pub struct TypeBinding {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
|
||||
// NB PartialEq method appears below.
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
|
||||
pub struct Ty {
|
||||
pub id: NodeId,
|
||||
|
Loading…
Reference in New Issue
Block a user