1
Fork 0

Remember mutability in DefKind::Static.

This allows to compute the `BodyOwnerKind` from `DefKind` only, and
removes a direct dependency of some MIR queries onto HIR.

As a side effect, it also simplifies metadata, since we don't need 4
flavours of `EntryKind::*Static` any more.
This commit is contained in:
Camille GILLOT 2022-03-29 17:11:12 +02:00
parent 11909e3588
commit 21a554caf6
40 changed files with 98 additions and 128 deletions

View file

@ -701,8 +701,8 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
}
// These items live in the value namespace.
ItemKind::Static(..) => {
let res = Res::Def(DefKind::Static, def_id);
ItemKind::Static(_, mt, _) => {
let res = Res::Def(DefKind::Static(mt), def_id);
self.r.define(parent, ident, ValueNS, (res, vis, sp, expansion));
}
ItemKind::Const(..) => {
@ -907,7 +907,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
let def_id = local_def_id.to_def_id();
let (def_kind, ns) = match item.kind {
ForeignItemKind::Fn(..) => (DefKind::Fn, ValueNS),
ForeignItemKind::Static(..) => (DefKind::Static, ValueNS),
ForeignItemKind::Static(_, mt, _) => (DefKind::Static(mt), ValueNS),
ForeignItemKind::TyAlias(..) => (DefKind::ForeignTy, TypeNS),
ForeignItemKind::MacCall(_) => unreachable!(),
};
@ -963,7 +963,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
Res::Def(
DefKind::Fn
| DefKind::AssocFn
| DefKind::Static
| DefKind::Static(_)
| DefKind::Const
| DefKind::AssocConst
| DefKind::Ctor(..),