about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/errors.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-01-10 02:11:25 +0100
committerLeón Orell Valerian Liehr <me@fmease.dev>2024-03-13 14:29:27 +0100
commit0b2fb8db6540b0548230cd335e7b2a845686f7ea (patch)
tree12466dcca436dbc9af604e384683c45e47bcff44 /compiler/rustc_hir_analysis/src/errors.rs
parentd26c5723e793c793c152fffaadc3dc7a45eac29e (diff)
downloadrust-0b2fb8db6540b0548230cd335e7b2a845686f7ea.tar.gz
rust-0b2fb8db6540b0548230cd335e7b2a845686f7ea.zip
Reject escaping bound vars in the type of assoc const bindings
Diffstat (limited to 'compiler/rustc_hir_analysis/src/errors.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/errors.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index beec345109e..dc0e1ae6d87 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -318,6 +318,21 @@ pub(crate) struct TyOfAssocConstBindingNote<'tcx> {
     pub ty: Ty<'tcx>,
 }
 
+#[derive(Diagnostic)]
+#[diag(hir_analysis_escaping_bound_var_in_ty_of_assoc_const_binding)]
+pub(crate) struct EscapingBoundVarInTyOfAssocConstBinding<'tcx> {
+    #[primary_span]
+    #[label]
+    pub span: Span,
+    pub assoc_const: Ident,
+    pub var_name: Symbol,
+    pub var_def_kind: &'static str,
+    #[label(hir_analysis_var_defined_here_label)]
+    pub var_defined_here_label: Span,
+    #[subdiagnostic]
+    pub ty_note: Option<TyOfAssocConstBindingNote<'tcx>>,
+}
+
 #[derive(Subdiagnostic)]
 #[help(hir_analysis_parenthesized_fn_trait_expansion)]
 pub struct ParenthesizedFnTraitExpansion {