Auto merge of #95436 - cjgillot:static-mut, r=oli-obk
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:
commit
a40c595695
40 changed files with 98 additions and 128 deletions
|
@ -78,7 +78,7 @@ pub enum DefKind {
|
|||
Const,
|
||||
/// Constant generic parameter: `struct Foo<const N: usize> { ... }`
|
||||
ConstParam,
|
||||
Static,
|
||||
Static(ast::Mutability),
|
||||
/// Refers to the struct or enum variant's constructor.
|
||||
///
|
||||
/// The reason `Ctor` exists in addition to [`DefKind::Struct`] and
|
||||
|
@ -128,7 +128,7 @@ impl DefKind {
|
|||
"crate"
|
||||
}
|
||||
DefKind::Mod => "module",
|
||||
DefKind::Static => "static",
|
||||
DefKind::Static(..) => "static",
|
||||
DefKind::Enum => "enum",
|
||||
DefKind::Variant => "variant",
|
||||
DefKind::Ctor(CtorOf::Variant, CtorKind::Fn) => "tuple variant",
|
||||
|
@ -202,7 +202,7 @@ impl DefKind {
|
|||
DefKind::Fn
|
||||
| DefKind::Const
|
||||
| DefKind::ConstParam
|
||||
| DefKind::Static
|
||||
| DefKind::Static(..)
|
||||
| DefKind::Ctor(..)
|
||||
| DefKind::AssocFn
|
||||
| DefKind::AssocConst => Some(Namespace::ValueNS),
|
||||
|
|
|
@ -1530,7 +1530,7 @@ impl Expr<'_> {
|
|||
pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
|
||||
match self.kind {
|
||||
ExprKind::Path(QPath::Resolved(_, ref path)) => {
|
||||
matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static, _) | Res::Err)
|
||||
matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static(_), _) | Res::Err)
|
||||
}
|
||||
|
||||
// Type ascription inherits its place expression kind from its
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue