summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_parse/src/errors.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
-rw-r--r--compiler/rustc_parse/src/errors.rs85
1 files changed, 77 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs
index 96e1c0e3c..e0b1e3678 100644
--- a/compiler/rustc_parse/src/errors.rs
+++ b/compiler/rustc_parse/src/errors.rs
@@ -365,6 +365,14 @@ pub(crate) enum IfExpressionMissingThenBlockSub {
AddThenBlock(#[primary_span] Span),
}
+#[derive(Diagnostic)]
+#[diag(parse_ternary_operator)]
+#[help]
+pub struct TernaryOperator {
+ #[primary_span]
+ pub span: Span,
+}
+
#[derive(Subdiagnostic)]
#[suggestion(parse_extra_if_in_let_else, applicability = "maybe-incorrect", code = "")]
pub(crate) struct IfExpressionLetSomeSub {
@@ -1427,6 +1435,13 @@ pub(crate) struct AsyncBlockIn2015 {
}
#[derive(Diagnostic)]
+#[diag(parse_async_move_block_in_2015)]
+pub(crate) struct AsyncMoveBlockIn2015 {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Diagnostic)]
#[diag(parse_self_argument_pointer)]
pub(crate) struct SelfArgumentPointer {
#[primary_span]
@@ -1801,6 +1816,12 @@ pub struct UnknownPrefix<'a> {
}
#[derive(Subdiagnostic)]
+#[note(parse_macro_expands_to_adt_field)]
+pub struct MacroExpandsToAdtField<'a> {
+ pub adt_ty: &'a str,
+}
+
+#[derive(Subdiagnostic)]
pub enum UnknownPrefixSugg {
#[suggestion(
parse_suggestion_br,
@@ -2615,21 +2636,24 @@ pub(crate) struct MissingPlusBounds {
}
#[derive(Diagnostic)]
-#[diag(parse_incorrect_braces_trait_bounds)]
-pub(crate) struct IncorrectBracesTraitBounds {
+#[diag(parse_incorrect_parens_trait_bounds)]
+pub(crate) struct IncorrectParensTraitBounds {
#[primary_span]
pub span: Vec<Span>,
#[subdiagnostic]
- pub sugg: IncorrectBracesTraitBoundsSugg,
+ pub sugg: IncorrectParensTraitBoundsSugg,
}
#[derive(Subdiagnostic)]
-#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")]
-pub(crate) struct IncorrectBracesTraitBoundsSugg {
+#[multipart_suggestion(
+ parse_incorrect_parens_trait_bounds_sugg,
+ applicability = "machine-applicable"
+)]
+pub(crate) struct IncorrectParensTraitBoundsSugg {
#[suggestion_part(code = " ")]
- pub l: Span,
- #[suggestion_part(code = "")]
- pub r: Span,
+ pub wrong_span: Span,
+ #[suggestion_part(code = "(")]
+ pub new_span: Span,
}
#[derive(Diagnostic)]
@@ -2692,3 +2716,48 @@ pub(crate) struct ExpectedBuiltinIdent {
#[primary_span]
pub span: Span,
}
+
+#[derive(Diagnostic)]
+#[diag(parse_static_with_generics)]
+pub(crate) struct StaticWithGenerics {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(parse_where_clause_before_const_body)]
+pub(crate) struct WhereClauseBeforeConstBody {
+ #[primary_span]
+ #[label]
+ pub span: Span,
+ #[label(parse_name_label)]
+ pub name: Span,
+ #[label(parse_body_label)]
+ pub body: Span,
+ #[subdiagnostic]
+ pub sugg: Option<WhereClauseBeforeConstBodySugg>,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")]
+pub(crate) struct WhereClauseBeforeConstBodySugg {
+ #[suggestion_part(code = "= {snippet} ")]
+ pub left: Span,
+ pub snippet: String,
+ #[suggestion_part(code = "")]
+ pub right: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(parse_generic_args_in_pat_require_turbofish_syntax)]
+pub(crate) struct GenericArgsInPatRequireTurbofishSyntax {
+ #[primary_span]
+ pub span: Span,
+ #[suggestion(
+ parse_sugg_turbofish_syntax,
+ style = "verbose",
+ code = "::",
+ applicability = "maybe-incorrect"
+ )]
+ pub suggest_turbofish: Span,
+}