File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1028,3 +1028,35 @@ where
10281028 Self :: eq : const ,
10291029 Self :: ne : const ; // π²π
10301030```
1031+
1032+ Additionally, if we could write bounds for the target features required by a
1033+ function, that could also be leveraged by implementable aliases:
1034+
1035+ ``` rust
1036+ trait FrobWithAvx2 {
1037+ #[target_feature(enable = " avx2" )]
1038+ fn frob (self );
1039+ }
1040+
1041+ trait FrobWithNoTargetFeatures = FrobWithAvx2
1042+ where
1043+ Self :: frob : needs_target_features! ("" ); // π²π
1044+ ```
1045+
1046+ Additional language extensions might be necessary to handle cases where the set
1047+ of target features a trait implementation may or may not use is large or open:
1048+
1049+ ``` rust
1050+ trait FrobWithUnknownTargetFeatures {
1051+ #[target_feature(enable = " *" )] // π²π
1052+ fn frob (self );
1053+ }
1054+
1055+ trait FrobWithAvx2 = FrobWithUnknownTargetFeatures ;
1056+ where
1057+ Self :: frob : needs_target_features! (" avx2" ); // π²π
1058+
1059+ trait FrobWithNoTargetFeatures = FrobWithAvx2
1060+ where
1061+ Self :: frob : needs_target_features! ("" ); // π²π
1062+ ```
You canβt perform that action at this time.
0 commit comments