Skip to content

Commit 6c3e793

Browse files
committed
move AmbigousPlus outside
1 parent 35b42cb commit 6c3e793

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

compiler/rustc_parse/src/parser/diagnostics.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,16 @@ impl MultiSugg {
242242
err.multipart_suggestions(msg, suggestions.map(|s| s.patches), applicability);
243243
}
244244
}
245+
246+
#[derive(SessionDiagnostic)]
247+
#[error(slug = "parser-maybe-report-ambiguous-plus")]
248+
struct AmbiguousPlus {
249+
pub sum_with_parens: String,
250+
#[primary_span]
251+
#[suggestion(code = "({sum_with_parens})")]
252+
pub span: Span,
253+
}
254+
245255
// SnapshotParser is used to create a snapshot of the parser
246256
// without causing duplicate errors being emitted when the `Parser`
247257
// is dropped.
@@ -1171,15 +1181,6 @@ impl<'a> Parser<'a> {
11711181
impl_dyn_multi: bool,
11721182
ty: &Ty,
11731183
) {
1174-
#[derive(SessionDiagnostic)]
1175-
#[error(slug = "parser-maybe-report-ambiguous-plus")]
1176-
struct AmbiguousPlus {
1177-
pub sum_with_parens: String,
1178-
#[primary_span]
1179-
#[suggestion(code = "({sum_with_parens})")]
1180-
pub span: Span,
1181-
}
1182-
11831184
if matches!(allow_plus, AllowPlus::No) && impl_dyn_multi {
11841185
self.sess.emit_err(AmbiguousPlus {
11851186
sum_with_parens: pprust::ty_to_string(&ty),

0 commit comments

Comments
 (0)