From fa733909edadf390cde8c36c303bce42d37f7a3b Mon Sep 17 00:00:00 2001 From: Cameron Steffen Date: Wed, 30 Jul 2025 16:33:59 -0500 Subject: Move trait impl modifier errors to parsing This is a technically a breaking change for what can be parsed in `#[cfg(false)]`. --- compiler/rustc_parse/src/errors.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'compiler/rustc_parse/src/errors.rs') diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index ddb2c545c78..2a704ee61ec 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -71,6 +71,20 @@ pub(crate) struct BadQPathStage2 { pub wrap: WrapType, } +#[derive(Diagnostic)] +#[diag(parse_trait_impl_modifier_in_inherent_impl)] +pub(crate) struct TraitImplModifierInInherentImpl<'a> { + #[primary_span] + pub span: Span, + #[label(parse_because)] + pub annotation_span: Span, + pub annotation: &'a str, + #[label(parse_type)] + pub self_ty: Span, + #[note(parse_only_trait)] + pub only_trait: bool, +} + #[derive(Subdiagnostic)] #[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")] pub(crate) struct WrapType { -- cgit 1.4.1-3-g733a5