1
Fork 0

Implement RFC 3525.

This commit is contained in:
Luca Versari 2024-06-24 17:17:18 +02:00 committed by Luca Versari
parent 748c54848d
commit 7eb4cfeace
25 changed files with 512 additions and 28 deletions

View file

@ -438,6 +438,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let is_target_feature_fn = if let ty::FnDef(def_id, _) =
*leaf_trait_ref.skip_binder().self_ty().kind()
{
// FIXME(struct_target_features): should a function that inherits
// target_features through arguments implement Fn traits?
!self.tcx.codegen_fn_attrs(def_id).target_features.is_empty()
} else {
false

View file

@ -545,6 +545,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// Provide an impl for suitable functions, rejecting `#[target_feature]` functions (RFC 2396).
ty::FnDef(def_id, args) => {
let tcx = self.tcx();
// FIXME(struct_target_features): should a function that inherits target_features
// through an argument implement Fn traits?
if tcx.fn_sig(def_id).skip_binder().is_fn_trait_compatible()
&& tcx.codegen_fn_attrs(def_id).target_features.is_empty()
{