summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_hir_typeck/src/errors.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /compiler/rustc_hir_typeck/src/errors.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_hir_typeck/src/errors.rs')
-rw-r--r--compiler/rustc_hir_typeck/src/errors.rs105
1 files changed, 102 insertions, 3 deletions
diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs
index 3eee2278d..4222205c8 100644
--- a/compiler/rustc_hir_typeck/src/errors.rs
+++ b/compiler/rustc_hir_typeck/src/errors.rs
@@ -1,4 +1,6 @@
//! Errors emitted by `rustc_hir_typeck`.
+use std::borrow::Cow;
+
use crate::fluent_generated as fluent;
use rustc_errors::{AddToDiagnostic, Applicability, Diagnostic, MultiSpan, SubdiagnosticMessage};
use rustc_macros::{Diagnostic, Subdiagnostic};
@@ -47,8 +49,8 @@ pub struct StructExprNonExhaustive {
}
#[derive(Diagnostic)]
-#[diag(hir_typeck_method_call_on_unknown_type, code = "E0699")]
-pub struct MethodCallOnUnknownType {
+#[diag(hir_typeck_method_call_on_unknown_raw_pointee, code = "E0699")]
+pub struct MethodCallOnUnknownRawPointee {
#[primary_span]
pub span: Span,
}
@@ -108,7 +110,7 @@ pub enum ExpectedReturnTypeLabel<'tcx> {
#[derive(Diagnostic)]
#[diag(hir_typeck_missing_parentheses_in_range, code = "E0689")]
-pub struct MissingParentheseInRange {
+pub struct MissingParenthesesInRange {
#[primary_span]
#[label(hir_typeck_missing_parentheses_in_range)]
pub span: Span,
@@ -228,3 +230,100 @@ impl HelpUseLatestEdition {
}
}
}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_const_select_must_be_const)]
+#[help]
+pub struct ConstSelectMustBeConst {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_const_select_must_be_fn)]
+#[note]
+#[help]
+pub struct ConstSelectMustBeFn<'a> {
+ #[primary_span]
+ pub span: Span,
+ pub ty: Ty<'a>,
+}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_union_pat_multiple_fields)]
+pub struct UnionPatMultipleFields {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_union_pat_dotdot)]
+pub struct UnionPatDotDot {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_arg_mismatch_indeterminate)]
+pub struct ArgMismatchIndeterminate {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Subdiagnostic)]
+pub enum SuggestBoxing {
+ #[note(hir_typeck_suggest_boxing_note)]
+ #[multipart_suggestion(
+ hir_typeck_suggest_boxing_when_appropriate,
+ applicability = "machine-applicable"
+ )]
+ Unit {
+ #[suggestion_part(code = "Box::new(())")]
+ start: Span,
+ #[suggestion_part(code = "")]
+ end: Span,
+ },
+ #[note(hir_typeck_suggest_boxing_note)]
+ AsyncBody,
+ #[note(hir_typeck_suggest_boxing_note)]
+ #[multipart_suggestion(
+ hir_typeck_suggest_boxing_when_appropriate,
+ applicability = "machine-applicable"
+ )]
+ Other {
+ #[suggestion_part(code = "Box::new(")]
+ start: Span,
+ #[suggestion_part(code = ")")]
+ end: Span,
+ },
+}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_no_associated_item, code = "E0599")]
+pub struct NoAssociatedItem {
+ #[primary_span]
+ pub span: Span,
+ pub item_kind: &'static str,
+ pub item_name: Ident,
+ pub ty_prefix: Cow<'static, str>,
+ pub ty_str: String,
+ pub trait_missing_method: bool,
+}
+
+#[derive(Subdiagnostic)]
+#[note(hir_typeck_candidate_trait_note)]
+pub struct CandidateTraitNote {
+ #[primary_span]
+ pub span: Span,
+ pub trait_name: String,
+ pub item_name: Ident,
+ pub action_or_ty: String,
+}
+
+#[derive(Diagnostic)]
+#[diag(hir_typeck_ctor_is_private, code = "E0603")]
+pub struct CtorIsPrivate {
+ #[primary_span]
+ pub span: Span,
+ pub def: String,
+}