about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorJakub Beránek <jakub.beranek@vsb.cz>2024-09-01 16:35:53 +0200
committerJakub Beránek <jakub.beranek@vsb.cz>2024-09-01 16:35:53 +0200
commit47e6b5deed5cc79c677def8d1a165658fa79d810 (patch)
treefe0d774466eaa37667d6fffbee6ab644854098cc /compiler/rustc_passes/src
parent1a1cc050d8efc906ede39f444936ade1fdc9c6cb (diff)
downloadrust-47e6b5deed5cc79c677def8d1a165658fa79d810.tar.gz
rust-47e6b5deed5cc79c677def8d1a165658fa79d810.zip
Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"
This reverts commit acb4e8b6251f1d8da36f08e7a70fa23fc581839e, reversing
changes made to 100fde5246bf56f22fb5cc85374dd841296fce0e.
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs33
-rw-r--r--compiler/rustc_passes/src/errors.rs9
2 files changed, 5 insertions, 37 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 5dbb3854c8f..21478a44b0e 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -747,35 +747,12 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
             Target::Field | Target::Arm | Target::MacroDef => {
                 self.inline_attr_str_error_with_macro_def(hir_id, attr, "target_feature");
             }
-            Target::Struct if self.tcx.features().struct_target_features => {
-                let ty = self.tcx.hir_node(hir_id).expect_item();
-                match ty.kind {
-                    ItemKind::Struct(data, _) => {
-                        if data.fields().len() != 0 {
-                            self.dcx().emit_err(errors::AttrShouldBeAppliedToFnOrUnitStruct {
-                                attr_span: attr.span,
-                                defn_span: span,
-                            });
-                        }
-                    }
-                    _ => {
-                        panic!("Target::Struct for a non-struct");
-                    }
-                }
-            }
             _ => {
-                if self.tcx.features().struct_target_features {
-                    self.dcx().emit_err(errors::AttrShouldBeAppliedToFnOrUnitStruct {
-                        attr_span: attr.span,
-                        defn_span: span,
-                    });
-                } else {
-                    self.dcx().emit_err(errors::AttrShouldBeAppliedToFn {
-                        attr_span: attr.span,
-                        defn_span: span,
-                        on_crate: hir_id == CRATE_HIR_ID,
-                    });
-                }
+                self.dcx().emit_err(errors::AttrShouldBeAppliedToFn {
+                    attr_span: attr.span,
+                    defn_span: span,
+                    on_crate: hir_id == CRATE_HIR_ID,
+                });
             }
         }
     }
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs
index 1e9ab7af9be..f5d982e1a5c 100644
--- a/compiler/rustc_passes/src/errors.rs
+++ b/compiler/rustc_passes/src/errors.rs
@@ -83,15 +83,6 @@ pub(crate) struct AttrShouldBeAppliedToFn {
 }
 
 #[derive(Diagnostic)]
-#[diag(passes_should_be_applied_to_fn_or_unit_struct)]
-pub(crate) struct AttrShouldBeAppliedToFnOrUnitStruct {
-    #[primary_span]
-    pub attr_span: Span,
-    #[label]
-    pub defn_span: Span,
-}
-
-#[derive(Diagnostic)]
 #[diag(passes_should_be_applied_to_fn, code = E0739)]
 pub(crate) struct TrackedCallerWrongLocation {
     #[primary_span]