File tree 1 file changed +13
-4
lines changed
compiler/rustc_monomorphize/src
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -486,10 +486,19 @@ fn collect_items_rec<'tcx>(
486
486
if let hir:: ItemKind :: GlobalAsm { asm, .. } = item. kind {
487
487
for ( op, op_sp) in asm. operands {
488
488
match * op {
489
- hir:: InlineAsmOperand :: Const { .. } => {
490
- // Only constants which resolve to a plain integer
491
- // are supported. Therefore the value should not
492
- // depend on any other items.
489
+ hir:: InlineAsmOperand :: Const { anon_const } => {
490
+ match tcx. const_eval_poly ( anon_const. def_id . to_def_id ( ) ) {
491
+ Ok ( val) => {
492
+ collect_const_value ( tcx, val, & mut used_items) ;
493
+ }
494
+ Err ( ErrorHandled :: TooGeneric ( ..) ) => {
495
+ span_bug ! ( * op_sp, "asm const cannot be resolved; too generic" )
496
+ }
497
+ Err ( err @ ErrorHandled :: Reported ( ..) ) => {
498
+ err. emit_note ( tcx) ;
499
+ continue ;
500
+ }
501
+ }
493
502
}
494
503
hir:: InlineAsmOperand :: SymFn { expr } => {
495
504
let fn_ty = tcx. typeck ( item_id. owner_id ) . expr_ty ( expr) ;
You can’t perform that action at this time.
0 commit comments