diff options
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 33 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/errors.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/stability.rs | 3 |
3 files changed, 6 insertions, 39 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] diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 4d58590ca3b..ba4c300ea61 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -544,9 +544,8 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> { let is_stable = self.tcx.lookup_stability(def_id).is_some_and(|stability| stability.level.is_stable()); let missing_const_stability_attribute = self.tcx.lookup_const_stability(def_id).is_none(); - let is_reachable = self.effective_visibilities.is_reachable(def_id); - if is_const && is_stable && missing_const_stability_attribute && is_reachable { + if is_const && is_stable && missing_const_stability_attribute { let descr = self.tcx.def_descr(def_id.to_def_id()); self.tcx.dcx().emit_err(errors::MissingConstStabAttr { span, descr }); } |
