]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_trait_selection/traits/error_reporting/mod.rs
Don't implement Fn* for unsafe #[target_feature] functions
[rust.git] / src / librustc_trait_selection / traits / error_reporting / mod.rs
index 39530853318e313fbfc035bc7abda933bbb15a71..76e01a40a2362484fa8afbd294974c8c2353d6d0 100644 (file)
@@ -292,11 +292,9 @@ fn report_selection_error(
                             self.tcx.lang_items().fn_once_trait(),
                         ]
                         .contains(&Some(trait_ref.def_id()));
-                        let is_safe_target_feature_fn =
+                        let is_target_feature_fn =
                             if let ty::FnDef(def_id, _) = trait_ref.skip_binder().self_ty().kind {
-                                trait_ref.skip_binder().self_ty().fn_sig(self.tcx).unsafety()
-                                    == hir::Unsafety::Normal
-                                    && !self.tcx.codegen_fn_attrs(def_id).target_features.is_empty()
+                                !self.tcx.codegen_fn_attrs(def_id).target_features.is_empty()
                             } else {
                                 false
                             };
@@ -441,7 +439,7 @@ fn report_selection_error(
                             );
                         }
 
-                        if is_fn_trait && is_safe_target_feature_fn {
+                        if is_fn_trait && is_target_feature_fn {
                             err.note(&format!(
                                 "`{}` has `#[target_feature]` and is unsafe to call",
                                 trait_ref.skip_binder().self_ty(),