diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-05-02 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-05-03 07:12:43 +0200 |
| commit | e62663492b2773d50e37a70420f41e758d5af722 (patch) | |
| tree | 2bdd7fb5ab75313df05e368281e9cea1a92a37e8 /compiler/rustc_monomorphize | |
| parent | 24c898504379252fafedc218074af49126da41ec (diff) | |
Collect function instance used in `global_asm!` sym operand
The constants used in SymFn operands have FnDef type, so the type of the constant identifies the function.
Diffstat (limited to 'compiler/rustc_monomorphize')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 1828aecb375..18f32b04fad 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -445,12 +445,9 @@ fn collect_items_rec<'tcx>( // depend on any other items. } hir::InlineAsmOperand::SymFn { anon_const } => { - let def_id = tcx.hir().body_owner_def_id(anon_const.body).to_def_id(); - if let Ok(val) = tcx.const_eval_poly(def_id) { - rustc_data_structures::stack::ensure_sufficient_stack(|| { - collect_const_value(tcx, val, &mut neighbors); - }); - } + let fn_ty = + tcx.typeck_body(anon_const.body).node_type(anon_const.hir_id); + visit_fn_use(tcx, fn_ty, false, *op_sp, &mut neighbors); } hir::InlineAsmOperand::SymStatic { path: _, def_id } => { let instance = Instance::mono(tcx, *def_id); |
