}
#[derive(SessionDiagnostic)]
-#[error(slug = "parser-maybe-report-ambiguous-plus")]
+#[error(parser::maybe_report_ambiguous_plus)]
struct AmbiguousPlus {
pub sum_ty: String,
#[primary_span]
}
#[derive(SessionDiagnostic)]
-#[error(code = "E0178", slug = "parser-maybe-recover-from-bad-type-plus")]
+#[error(parser::maybe_recover_from_bad_type_plus, code = "E0178")]
struct BadTypePlus {
pub ty: String,
#[primary_span]
#[derive(SessionSubdiagnostic)]
pub enum BadTypePlusSub {
#[suggestion(
- slug = "parser-add-paren",
+ parser::add_paren,
code = "{sum_with_parens}",
applicability = "machine-applicable"
)]
#[primary_span]
span: Span,
},
- #[label(slug = "parser-forgot-paren")]
+ #[label(parser::forgot_paren)]
ForgotParen {
#[primary_span]
span: Span,
},
- #[label(slug = "parser-expect-path")]
+ #[label(parser::expect_path)]
ExpectPath {
#[primary_span]
span: Span,
}
#[derive(SessionDiagnostic)]
-#[error(slug = "parser-maybe-recover-from-bad-qpath-stage-2")]
+#[error(parser::maybe_recover_from_bad_qpath_stage_2)]
struct BadQPathStage2 {
#[primary_span]
#[suggestion(applicability = "maybe-incorrect")]
}
#[derive(SessionDiagnostic)]
-#[error(slug = "parser-incorrect-semicolon")]
+#[error(parser::incorrect_semicolon)]
struct IncorrectSemicolon<'a> {
#[primary_span]
#[suggestion_short(applicability = "machine-applicable")]
}
#[derive(SessionDiagnostic)]
-#[error(slug = "parser-incorrect-use-of-await")]
+#[error(parser::incorrect_use_of_await)]
struct IncorrectUseOfAwait {
#[primary_span]
- #[suggestion(message = "parentheses-suggestion", applicability = "machine-applicable")]
+ #[suggestion(parser::parentheses_suggestion, applicability = "machine-applicable")]
span: Span,
}
#[derive(SessionDiagnostic)]
-#[error(slug = "parser-incorrect-use-of-await")]
+#[error(parser::incorrect_use_of_await)]
struct IncorrectAwait {
#[primary_span]
span: Span,
- #[suggestion(message = "postfix-suggestion", code = "{expr}.await{question_mark}")]
+ #[suggestion(parser::postfix_suggestion, code = "{expr}.await{question_mark}")]
sugg_span: (Span, Applicability),
expr: String,
question_mark: &'static str,
}
#[derive(SessionDiagnostic)]
-#[error(slug = "parser-in-in-typo")]
+#[error(parser::in_in_typo)]
struct InInTypo {
#[primary_span]
span: Span,
s.print_mutability(mut_ty.mutbl, false);
s.popen();
s.print_type(&mut_ty.ty);
- s.print_type_bounds(" +", &bounds);
+ if !bounds.is_empty() {
+ s.word(" + ");
+ s.print_type_bounds(&bounds);
+ }
s.pclose()
});
match pat.kind {
PatKind::Ident(_, ident, _) => (
ident,
- "self: ".to_string(),
+ "self: ",
": TypeName".to_string(),
- "_: ".to_string(),
+ "_: ",
pat.span.shrink_to_lo(),
pat.span.shrink_to_hi(),
pat.span.shrink_to_lo(),
let mutab = mutab.prefix_str();
(
ident,
- "self: ".to_string(),
+ "self: ",
format!("{ident}: &{mutab}TypeName"),
- "_: ".to_string(),
+ "_: ",
pat.span.shrink_to_lo(),
pat.span,
pat.span.shrink_to_lo(),