about summary refs log tree commit diff
path: root/compiler/rustc_parse
diff options
context:
space:
mode:
authorChristian Poveda <git@pvdrz.com>2022-04-26 11:12:48 +0200
committerChristian Poveda <git@pvdrz.com>2022-04-26 11:12:48 +0200
commit6c3e793fb3303878790a6e872e8fa8bc1e4ef4e9 (patch)
treeb172ca1fc3cb2615b5e9fda1712e894b9ec1f3cd /compiler/rustc_parse
parent35b42cb9ecc61bb36a23e53ff4913865d3ab1e80 (diff)
downloadrust-6c3e793fb3303878790a6e872e8fa8bc1e4ef4e9.tar.gz
rust-6c3e793fb3303878790a6e872e8fa8bc1e4ef4e9.zip
move `AmbigousPlus` outside
Diffstat (limited to 'compiler/rustc_parse')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index f0a053d88b5..e8dc0b3a684 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -242,6 +242,16 @@ impl MultiSugg {
         err.multipart_suggestions(msg, suggestions.map(|s| s.patches), applicability);
     }
 }
+
+#[derive(SessionDiagnostic)]
+#[error(slug = "parser-maybe-report-ambiguous-plus")]
+struct AmbiguousPlus {
+    pub sum_with_parens: String,
+    #[primary_span]
+    #[suggestion(code = "({sum_with_parens})")]
+    pub span: Span,
+}
+
 // SnapshotParser is used to create a snapshot of the parser
 // without causing duplicate errors being emitted when the `Parser`
 // is dropped.
@@ -1171,15 +1181,6 @@ impl<'a> Parser<'a> {
         impl_dyn_multi: bool,
         ty: &Ty,
     ) {
-        #[derive(SessionDiagnostic)]
-        #[error(slug = "parser-maybe-report-ambiguous-plus")]
-        struct AmbiguousPlus {
-            pub sum_with_parens: String,
-            #[primary_span]
-            #[suggestion(code = "({sum_with_parens})")]
-            pub span: Span,
-        }
-
         if matches!(allow_plus, AllowPlus::No) && impl_dyn_multi {
             self.sess.emit_err(AmbiguousPlus {
                 sum_with_parens: pprust::ty_to_string(&ty),