own_counts
}
- pub fn get_named(&self, name: &InternedString) -> Option<&GenericParam> {
+ pub fn get_named(&self, name: InternedString) -> Option<&GenericParam> {
for param in &self.params {
- if *name == param.name.ident().as_interned_str() {
+ if name == param.name.ident().as_interned_str() {
return Some(param);
}
}
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
- static_assert!(MEM_SIZE_OF_EXPR: std::mem::size_of::<Expr>() == 72);
+ static_assert_size!(Expr, 72);
impl Expr {
pub fn precedence(&self) -> ExprPrecedence {
// `TyS` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
- static_assert!(MEM_SIZE_OF_TY_S: ::std::mem::size_of::<TyS<'_>>() == 32);
+ static_assert_size!(TyS<'_>, 32);
impl<'tcx> Ord for TyS<'tcx> {
fn cmp(&self, other: &TyS<'tcx>) -> Ordering {
impl SymbolName {
pub fn new(name: &str) -> SymbolName {
SymbolName {
- name: Symbol::intern(name).as_interned_str()
+ name: InternedString::intern(name)
}
}
// `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:
///
// 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.index == 0
+ self.name.as_symbol() == keywords::SelfUpper.name() && self.index == 0
}
}
}
#[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]