about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/astconv/generics.rs
diff options
context:
space:
mode:
authorEzra Shaw <ezrasure@outlook.com>2023-03-09 20:42:45 +1300
committerEzra Shaw <ezrasure@outlook.com>2023-03-10 20:32:24 +1300
commita30c2c26c08642dfb6b2c56121bea5ca45465c1b (patch)
tree7982d4b5d28eedfff966d90ac435f3ef4616371a /compiler/rustc_hir_analysis/src/astconv/generics.rs
parent6a179026decb823e6ad8ba1c81729528bc5d695f (diff)
downloadrust-a30c2c26c08642dfb6b2c56121bea5ca45465c1b.tar.gz
rust-a30c2c26c08642dfb6b2c56121bea5ca45465c1b.zip
feat: implement better error for manual impl of `Fn*` traits
Diffstat (limited to 'compiler/rustc_hir_analysis/src/astconv/generics.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/generics.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs
index 7f6518ffd71..2f4963f6bc3 100644
--- a/compiler/rustc_hir_analysis/src/astconv/generics.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs
@@ -1,9 +1,8 @@
 use super::IsMethodCall;
 use crate::astconv::{
-    CreateSubstsForGenericArgsCtxt, ExplicitLateBound, GenericArgCountMismatch,
-    GenericArgCountResult, GenericArgPosition,
+    errors::prohibit_assoc_ty_binding, CreateSubstsForGenericArgsCtxt, ExplicitLateBound,
+    GenericArgCountMismatch, GenericArgCountResult, GenericArgPosition,
 };
-use crate::errors::AssocTypeBindingNotAllowed;
 use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
 use rustc_ast::ast::ParamKindOrd;
 use rustc_errors::{struct_span_err, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan};
@@ -433,7 +432,7 @@ pub(crate) fn check_generic_arg_count(
         (gen_pos != GenericArgPosition::Type || infer_args) && !gen_args.has_lifetime_params();
 
     if gen_pos != GenericArgPosition::Type && let Some(b) = gen_args.bindings.first() {
-            prohibit_assoc_ty_binding(tcx, b.span);
+             prohibit_assoc_ty_binding(tcx, b.span, None);
         }
 
     let explicit_late_bound =
@@ -589,11 +588,6 @@ pub(crate) fn check_generic_arg_count(
     }
 }
 
-/// Emits an error regarding forbidden type binding associations
-pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_>, span: Span) {
-    tcx.sess.emit_err(AssocTypeBindingNotAllowed { span });
-}
-
 /// Prohibits explicit lifetime arguments if late-bound lifetime parameters
 /// are present. This is used both for datatypes and function calls.
 pub(crate) fn prohibit_explicit_late_bound_lifetimes(