@@ -283,7 +283,11 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) { |
|
|
283 |
283 |
error = true; |
284 |
284 |
} |
285 |
285 |
|
286 |
|
-if !tcx.codegen_fn_attrs(main_def_id).target_features.is_empty() { |
|
286 |
+if !tcx.codegen_fn_attrs(main_def_id).target_features.is_empty() |
|
287 |
+// Calling functions with `#[target_feature]` is not unsafe on WASM, see #84988 |
|
288 |
+ && !tcx.sess.target.is_like_wasm |
|
289 |
+ && !tcx.sess.opts.actually_rustdoc |
|
290 |
+{ |
287 |
291 |
tcx.sess.emit_err(errors::TargetFeatureOnMain { main: main_span }); |
288 |
292 |
error = true; |
289 |
293 |
} |
@@ -378,7 +382,12 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) { |
|
|
378 |
382 |
}); |
379 |
383 |
error = true; |
380 |
384 |
} |
381 |
|
-if attr.has_name(sym::target_feature) { |
|
385 |
+if attr.has_name(sym::target_feature) |
|
386 |
+// Calling functions with `#[target_feature]` is |
|
387 |
+// not unsafe on WASM, see #84988 |
|
388 |
+ && !tcx.sess.target.is_like_wasm |
|
389 |
+ && !tcx.sess.opts.actually_rustdoc |
|
390 |
+{ |
382 |
391 |
tcx.sess.emit_err(errors::StartTargetFeature { |
383 |
392 |
span: attr.span, |
384 |
393 |
start: start_span, |