Skip to content

Commit 40d9da4

Browse files
committed
global_asm! consts do not depend on other items
1 parent bb6bec1 commit 40d9da4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

compiler/rustc_mir/src/monomorphize/collector.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,10 @@ fn collect_items_rec<'tcx>(
397397
if let hir::ItemKind::GlobalAsm(asm) = item.kind {
398398
for (op, op_sp) in asm.operands {
399399
match op {
400-
hir::InlineAsmOperand::Const { ref anon_const } => {
401-
// Treat these the same way as ItemKind::Const
402-
let anon_const_def_id =
403-
tcx.hir().local_def_id(anon_const.hir_id).to_def_id();
404-
if let Ok(val) = tcx.const_eval_poly(anon_const_def_id) {
405-
collect_const_value(tcx, val, &mut neighbors);
406-
}
400+
hir::InlineAsmOperand::Const { .. } => {
401+
// Only constants which resolve to a plain integer
402+
// are supported. Therefore the value should not
403+
// depend on any other items.
407404
}
408405
_ => span_bug!(*op_sp, "invalid operand type for global_asm!"),
409406
}

0 commit comments

Comments
 (0)