Give inline const separate DefKind
This commit is contained in:
parent
089a016919
commit
02c1774cd3
16 changed files with 46 additions and 15 deletions
|
@ -266,7 +266,15 @@ impl<'hir> Map<'hir> {
|
|||
};
|
||||
DefKind::Ctor(ctor_of, def::CtorKind::from_hir(variant_data))
|
||||
}
|
||||
Node::AnonConst(_) => DefKind::AnonConst,
|
||||
Node::AnonConst(_) => {
|
||||
let inline = match self.find(self.get_parent_node(hir_id)) {
|
||||
Some(Node::Expr(&Expr {
|
||||
kind: ExprKind::ConstBlock(ref anon_const), ..
|
||||
})) if anon_const.hir_id == hir_id => true,
|
||||
_ => false,
|
||||
};
|
||||
if inline { DefKind::InlineConst } else { DefKind::AnonConst }
|
||||
}
|
||||
Node::Field(_) => DefKind::Field,
|
||||
Node::Expr(expr) => match expr.kind {
|
||||
ExprKind::Closure(.., None) => DefKind::Closure,
|
||||
|
|
|
@ -958,7 +958,7 @@ fn write_mir_sig(tcx: TyCtxt<'_>, body: &Body<'_>, w: &mut dyn Write) -> io::Res
|
|||
write!(w, "static {}", if tcx.is_mutable_static(def_id) { "mut " } else { "" })?
|
||||
}
|
||||
(_, _) if is_function => write!(w, "fn ")?,
|
||||
(DefKind::AnonConst, _) => {} // things like anon const, not an item
|
||||
(DefKind::AnonConst | DefKind::InlineConst, _) => {} // things like anon const, not an item
|
||||
_ => bug!("Unexpected def kind {:?}", kind),
|
||||
}
|
||||
|
||||
|
|
|
@ -1927,7 +1927,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
| DefKind::Static
|
||||
| DefKind::AssocConst
|
||||
| DefKind::Ctor(..)
|
||||
| DefKind::AnonConst => self.mir_for_ctfe_opt_const_arg(def),
|
||||
| DefKind::AnonConst
|
||||
| DefKind::InlineConst => self.mir_for_ctfe_opt_const_arg(def),
|
||||
// If the caller wants `mir_for_ctfe` of a function they should not be using
|
||||
// `instance_mir`, so we'll assume const fn also wants the optimized version.
|
||||
_ => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue