@@ -268,34 +268,23 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
268268            if  !tcx. is_closure ( did. to_def_id ( ) ) 
269269                && tcx. fn_sig ( did) . skip_binder ( ) . unsafety ( )  == hir:: Unsafety :: Normal 
270270            { 
271-                 if  tcx. sess . target . is_like_wasm  || tcx. sess . opts . actually_rustdoc  { 
272-                     // The `#[target_feature]` attribute is allowed on 
273-                     // WebAssembly targets on all functions, including safe 
274-                     // ones. Other targets require that `#[target_feature]` is 
275-                     // only applied to unsafe functions (pending the 
276-                     // `target_feature_11` feature) because on most targets 
277-                     // execution of instructions that are not supported is 
278-                     // considered undefined behavior. For WebAssembly which is a 
279-                     // 100% safe target at execution time it's not possible to 
280-                     // execute undefined instructions, and even if a future 
281-                     // feature was added in some form for this it would be a 
282-                     // deterministic trap. There is no undefined behavior when 
283-                     // executing WebAssembly so `#[target_feature]` is allowed 
284-                     // on safe functions (but again, only for WebAssembly) 
285-                     // 
286-                     // Note that this is also allowed if `actually_rustdoc` so 
287-                     // if a target is documenting some wasm-specific code then 
288-                     // it's not spuriously denied. 
289-                 }  else  if  !tcx. features ( ) . target_feature_11  { 
290-                     let  mut  err = feature_err ( 
291-                         & tcx. sess . parse_sess , 
292-                         sym:: target_feature_11, 
293-                         attr. span , 
294-                         "`#[target_feature(..)]` can only be applied to `unsafe` functions" , 
295-                     ) ; 
296-                     err. span_label ( tcx. def_span ( did) ,  "not an `unsafe` function" ) ; 
297-                     err. emit ( ) ; 
298-                 }  else  { 
271+                 // The `#[target_feature]` attribute is allowed on 
272+                 // WebAssembly targets on all functions, including safe 
273+                 // ones. Other targets have conditions on the usage of 
274+                 // `#[target_feature]` because on most targets 
275+                 // execution of instructions that are not supported is 
276+                 // considered undefined behavior. For WebAssembly which is a 
277+                 // 100% safe target at execution time it's not possible to 
278+                 // execute undefined instructions, and even if a future 
279+                 // feature was added in some form for this it would be a 
280+                 // deterministic trap. There is no undefined behavior when 
281+                 // executing WebAssembly so `#[target_feature]` is allowed 
282+                 // on safe functions (but again, only for WebAssembly) 
283+                 // 
284+                 // Note that this is also allowed if `actually_rustdoc` so 
285+                 // if a target is documenting some wasm-specific code then 
286+                 // it's not spuriously denied. 
287+                 if  !( tcx. sess . target . is_like_wasm  || tcx. sess . opts . actually_rustdoc )  { 
299288                    check_target_feature_trait_unsafe ( tcx,  did,  attr. span ) ; 
300289                } 
301290            } 
@@ -533,7 +522,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
533522    } ) ; 
534523
535524    // #73631: closures inherit `#[target_feature]` annotations 
536-     if  tcx. features ( ) . target_feature_11  && tcx . is_closure ( did. to_def_id ( ) )  { 
525+     if  tcx. is_closure ( did. to_def_id ( ) )  { 
537526        let  owner_id = tcx. parent ( did. to_def_id ( ) ) ; 
538527        if  tcx. def_kind ( owner_id) . has_codegen_attrs ( )  { 
539528            codegen_fn_attrs
0 commit comments