From 40d9da4d8c9cad8cd78a3fcc47f40cb9335a07d7 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Mon, 26 Apr 2021 20:27:27 +0100 Subject: [PATCH] global_asm! consts do not depend on other items --- compiler/rustc_mir/src/monomorphize/collector.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_mir/src/monomorphize/collector.rs b/compiler/rustc_mir/src/monomorphize/collector.rs index c0d327d4788..e4ad92eb1b1 100644 --- a/compiler/rustc_mir/src/monomorphize/collector.rs +++ b/compiler/rustc_mir/src/monomorphize/collector.rs @@ -397,13 +397,10 @@ fn collect_items_rec<'tcx>( if let hir::ItemKind::GlobalAsm(asm) = item.kind { for (op, op_sp) in asm.operands { match op { - hir::InlineAsmOperand::Const { ref anon_const } => { - // Treat these the same way as ItemKind::Const - let anon_const_def_id = - tcx.hir().local_def_id(anon_const.hir_id).to_def_id(); - if let Ok(val) = tcx.const_eval_poly(anon_const_def_id) { - collect_const_value(tcx, val, &mut neighbors); - } + hir::InlineAsmOperand::Const { .. } => { + // Only constants which resolve to a plain integer + // are supported. Therefore the value should not + // depend on any other items. } _ => span_bug!(*op_sp, "invalid operand type for global_asm!"), }