use std::ops::Range;
use rustc_target::spec::abi;
use syntax::ast::{self, Ident};
-use syntax::symbol::{keywords, InternedString};
+use syntax::symbol::{kw, InternedString};
use serialize;
use self::InferTy::*;
// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
-static_assert!(MEM_SIZE_OF_TY_KIND: ::std::mem::size_of::<TyKind<'_>>() == 24);
+static_assert_size!(TyKind<'_>, 24);
/// A closure can be modeled as a struct that looks like:
///
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord,
Hash, RustcEncodable, RustcDecodable, HashStable)]
pub struct ParamTy {
- pub idx: u32,
+ pub index: u32,
pub name: InternedString,
}
impl<'a, 'gcx, 'tcx> ParamTy {
pub fn new(index: u32, name: InternedString) -> ParamTy {
- ParamTy { idx: index, name: name }
+ ParamTy { index, name: name }
}
pub fn for_self() -> ParamTy {
- ParamTy::new(0, keywords::SelfUpper.name().as_interned_str())
+ ParamTy::new(0, kw::SelfUpper.as_interned_str())
}
pub fn for_def(def: &ty::GenericParamDef) -> ParamTy {
}
pub fn to_ty(self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
- tcx.mk_ty_param(self.idx, self.name)
+ tcx.mk_ty_param(self.index, self.name)
}
pub fn is_self(&self) -> bool {
- // FIXME(#50125): Ignoring `Self` with `idx != 0` might lead to weird behavior elsewhere,
+ // FIXME(#50125): Ignoring `Self` with `index != 0` might lead to weird behavior elsewhere,
// but this should only be possible when using `-Z continue-parse-after-error` like
// `compile-fail/issue-36638.rs`.
- self.name == keywords::SelfUpper.name().as_str() && self.idx == 0
+ self.name.as_symbol() == kw::SelfUpper && self.index == 0
}
}
pub fn is_param(&self, index: u32) -> bool {
match self.sty {
- ty::Param(ref data) => data.idx == index,
+ ty::Param(ref data) => data.index == index,
_ => false,
}
}
}
#[cfg(target_arch = "x86_64")]
-static_assert!(CONST_SIZE: ::std::mem::size_of::<Const<'static>>() == 48);
+static_assert_size!(Const<'_>, 48);
impl<'tcx> Const<'tcx> {
#[inline]