Add safe/unsafe to static inside extern blocks
This commit is contained in:
parent
b4cbdb7246
commit
bac72cf7cf
27 changed files with 152 additions and 57 deletions
|
@ -305,7 +305,9 @@ impl<'hir> Map<'hir> {
|
|||
DefKind::InlineConst => BodyOwnerKind::Const { inline: true },
|
||||
DefKind::Ctor(..) | DefKind::Fn | DefKind::AssocFn => BodyOwnerKind::Fn,
|
||||
DefKind::Closure => BodyOwnerKind::Closure,
|
||||
DefKind::Static { mutability, nested: false } => BodyOwnerKind::Static(mutability),
|
||||
DefKind::Static { safety: _, mutability, nested: false } => {
|
||||
BodyOwnerKind::Static(mutability)
|
||||
}
|
||||
dk => bug!("{:?} is not a body node: {:?}", def_id, dk),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -559,10 +559,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 { mutability: hir::Mutability::Not, nested: false }, _) => {
|
||||
(DefKind::Static { safety: _, mutability: hir::Mutability::Not, nested: false }, _) => {
|
||||
write!(w, "static ")?
|
||||
}
|
||||
(DefKind::Static { mutability: hir::Mutability::Mut, nested: false }, _) => {
|
||||
(DefKind::Static { safety: _, mutability: hir::Mutability::Mut, nested: false }, _) => {
|
||||
write!(w, "static mut ")?
|
||||
}
|
||||
(_, _) if is_function => write!(w, "fn ")?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue