@@ -35,7 +35,7 @@ extern crate std;
3535/// To construct a value of a type implementing this trait, you must have proven that each
3636/// target feature in `FEATURES` is available.
3737pub unsafe trait TargetFeatureToken : Copy {
38- /// The set of target features which are enabled for this run , if
38+ /// The set of target features which the current CPU has , if
3939 /// you have a value of this type.
4040 const FEATURES : & [ & str ] ;
4141
@@ -78,7 +78,7 @@ pub unsafe trait TargetFeatureToken: Copy {
7878/// For reference, the implementation used to implement [`vectorize`](TargetFeatureToken::vectorize) for `"sse"` is:
7979///
8080/// ```rust,ignore
81- /// trampoline!([Self = self] => "sse", <(R)> fn<(R)>(f: impl FnOnce() -> R = f) -> R { f() })
81+ /// trampoline!([Sse = self] => "sse", <(R)> fn<(R)>(f: impl FnOnce() -> R = f) -> R { f() })
8282/// ```
8383///
8484/// There is also support for where clauses after the return type.
@@ -178,12 +178,15 @@ macro_rules! trampoline {
178178 // We validate that we actually have a token of each claimed type.
179179 let _: $token_type = $token;
180180 ) +
181- const {
181+ // We use a const item rather than a const block to ensure that.
182+ // This does mean that you can no longer use tokens "generically", but it's hard to think of
183+ // cases where that would be usable anyway.
184+ const _: ( ) = {
182185 // And that the claimed types justify enabling the enabled target features.
183186 $crate:: trampoline:: is_feature_subset( $to_enable, [ $( <$token_type as $crate:: TargetFeatureToken >:: FEATURES ) ,+] )
184187 // TODO: Better failure message here (i.e. at least concatting the set of requested features)
185188 . unwrap( ) ;
186- }
189+ } ;
187190
188191 $(
189192 // Soundness: We use `arg_value` outside of the macro body to ensure it doesn't
0 commit comments