1
Fork 0

Store a LocalDefId in hir::AnonConst.

This commit is contained in:
Camille GILLOT 2022-11-06 19:17:57 +00:00
parent 18482f7b23
commit 607d0c2a14
12 changed files with 49 additions and 56 deletions

View file

@ -40,12 +40,12 @@ impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
.iter()
.map(|(op, op_sp)| match *op {
hir::InlineAsmOperand::Const { ref anon_const } => {
let anon_const_def_id =
cx.tcx().hir().local_def_id(anon_const.hir_id).to_def_id();
let const_value =
cx.tcx().const_eval_poly(anon_const_def_id).unwrap_or_else(
|_| span_bug!(*op_sp, "asm const cannot be resolved"),
);
let const_value = cx
.tcx()
.const_eval_poly(anon_const.def_id.to_def_id())
.unwrap_or_else(|_| {
span_bug!(*op_sp, "asm const cannot be resolved")
});
let ty = cx
.tcx()
.typeck_body(anon_const.body)