s/mt/mutability/
This commit is contained in:
@@ -343,7 +343,7 @@ impl<'hir> Map<'hir> {
|
||||
DefKind::InlineConst => BodyOwnerKind::Const { inline: true },
|
||||
DefKind::Ctor(..) | DefKind::Fn | DefKind::AssocFn => BodyOwnerKind::Fn,
|
||||
DefKind::Closure => BodyOwnerKind::Closure,
|
||||
DefKind::Static { mt, nested: false } => BodyOwnerKind::Static(mt),
|
||||
DefKind::Static { mutability, nested: false } => BodyOwnerKind::Static(mutability),
|
||||
dk => bug!("{:?} is not a body node: {:?}", def_id, dk),
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ impl<'hir> Map<'hir> {
|
||||
let def_id = def_id.into();
|
||||
let ccx = match self.body_owner_kind(def_id) {
|
||||
BodyOwnerKind::Const { inline } => ConstContext::Const { inline },
|
||||
BodyOwnerKind::Static(mt) => ConstContext::Static(mt),
|
||||
BodyOwnerKind::Static(mutability) => ConstContext::Static(mutability),
|
||||
|
||||
BodyOwnerKind::Fn if self.tcx.is_constructor(def_id) => return None,
|
||||
BodyOwnerKind::Fn | BodyOwnerKind::Closure if self.tcx.is_const_fn_raw(def_id) => {
|
||||
|
||||
@@ -498,8 +498,10 @@ fn write_mir_sig(tcx: TyCtxt<'_>, body: &Body<'_>, w: &mut dyn io::Write) -> io:
|
||||
match (kind, body.source.promoted) {
|
||||
(_, Some(_)) => write!(w, "const ")?, // promoteds are the closest to consts
|
||||
(DefKind::Const | DefKind::AssocConst, _) => write!(w, "const ")?,
|
||||
(DefKind::Static { mt: hir::Mutability::Not, nested: false }, _) => write!(w, "static ")?,
|
||||
(DefKind::Static { mt: hir::Mutability::Mut, nested: false }, _) => {
|
||||
(DefKind::Static { mutability: hir::Mutability::Not, nested: false }, _) => {
|
||||
write!(w, "static ")?
|
||||
}
|
||||
(DefKind::Static { mutability: hir::Mutability::Mut, nested: false }, _) => {
|
||||
write!(w, "static mut ")?
|
||||
}
|
||||
(_, _) if is_function => write!(w, "fn ")?,
|
||||
|
||||
@@ -621,7 +621,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
|
||||
#[inline]
|
||||
pub fn static_mutability(self, def_id: DefId) -> Option<hir::Mutability> {
|
||||
if let DefKind::Static { mt, .. } = self.def_kind(def_id) { Some(mt) } else { None }
|
||||
if let DefKind::Static { mutability, .. } = self.def_kind(def_id) {
|
||||
Some(mutability)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if this is a `static` item with the `#[thread_local]` attribute.
|
||||
|
||||
Reference in New Issue
Block a user