Move trait impl modifier errors to parsing

This is a technically a breaking change for what can be parsed in
`#[cfg(false)]`.
This commit is contained in:
Cameron Steffen
2025-07-30 16:33:59 -05:00
parent 39c5d6d1ca
commit fa733909ed
10 changed files with 123 additions and 78 deletions

View File

@@ -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 {