1
Fork 0

Forbid the use of #[target_feature] on main

This commit is contained in:
Léo Lanteri Thauvin 2023-03-02 12:37:32 +01:00
parent 24c0b81c1f
commit db26693982
6 changed files with 33 additions and 1 deletions

View file

@ -283,6 +283,11 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
error = true;
}
if !tcx.codegen_fn_attrs(main_def_id).target_features.is_empty() {
tcx.sess.emit_err(errors::TargetFeatureOnMain { main: main_span });
error = true;
}
if error {
return;
}