about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2025-07-30 16:33:59 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2025-08-11 16:58:21 -0500
commitfa733909edadf390cde8c36c303bce42d37f7a3b (patch)
treec1dc1c01e6526ba9a752e927b69ad15bdba1c866 /compiler/rustc_parse/src/errors.rs
parent39c5d6d1cac012095771902d4782908ae0df4789 (diff)
downloadrust-fa733909edadf390cde8c36c303bce42d37f7a3b.tar.gz
rust-fa733909edadf390cde8c36c303bce42d37f7a3b.zip
Move trait impl modifier errors to parsing
This is a technically a breaking change for what can be parsed in
`#[cfg(false)]`.
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
-rw-r--r--compiler/rustc_parse/src/errors.rs14
1 files changed, 14 insertions, 0 deletions
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 {