about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2024-12-15 20:32:14 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-01-15 08:58:17 +0000
commit50654e538413635de2d50675112f1fd2d9a4e6d2 (patch)
tree0786643249e1452e4626d334b8bcf24b9cecb777 /compiler/rustc_middle
parente1a8b0da2d142ed156865693cd79b5522769e131 (diff)
downloadrust-50654e538413635de2d50675112f1fd2d9a4e6d2.tar.gz
rust-50654e538413635de2d50675112f1fd2d9a4e6d2.zip
Render fn defs with target_features attrs with the attribute
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 9fe1caa4b58..ac900edefe1 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -690,7 +690,14 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
                 if with_reduced_queries() {
                     p!(print_def_path(def_id, args));
                 } else {
-                    let sig = self.tcx().fn_sig(def_id).instantiate(self.tcx(), args);
+                    let mut sig = self.tcx().fn_sig(def_id).instantiate(self.tcx(), args);
+                    if self.tcx().codegen_fn_attrs(def_id).safe_target_features {
+                        p!("#[target_features] ");
+                        sig = sig.map_bound(|mut sig| {
+                            sig.safety = hir::Safety::Safe;
+                            sig
+                        });
+                    }
                     p!(print(sig), " {{", print_value_path(def_id, args), "}}");
                 }
             }