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
};
);
}
- 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(),
|
= help: the trait `std::ops::Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}`
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }
+ = note: `unsafe fn() {foo_unsafe}` has `#[target_feature]` and is unsafe to call
error[E0277]: expected a `std::ops::FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:30:14
|
= help: the trait `std::ops::FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}`
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }
+ = note: `unsafe fn() {foo_unsafe}` has `#[target_feature]` and is unsafe to call
error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:32:15
|
= help: the trait `std::ops::FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}`
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }
+ = note: `unsafe fn() {foo_unsafe}` has `#[target_feature]` and is unsafe to call
error: aborting due to 6 previous errors