]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_analysis/src/astconv/generics.rs
Change InferCtxtBuilder from enter to build
[rust.git] / compiler / rustc_hir_analysis / src / astconv / generics.rs
index afac75de2d96d8e831fab717695e89e896938bd7..47915b4bd4e6ce6ff6e3948d59d42e2e34709b01 100644 (file)
@@ -83,9 +83,9 @@ fn generic_arg_mismatch_err(
                 Res::Def(DefKind::TyParam, src_def_id) => {
                     if let Some(param_local_id) = param.def_id.as_local() {
                         let param_name = tcx.hir().ty_param_name(param_local_id);
-                        let param_type = tcx.infer_ctxt().enter(|infcx| {
-                            infcx.resolve_numeric_literals_with_default(tcx.type_of(param.def_id))
-                        });
+                        let infcx = tcx.infer_ctxt().build();
+                        let param_type =
+                            infcx.resolve_numeric_literals_with_default(tcx.type_of(param.def_id));
                         if param_type.is_suggestable(tcx, false) {
                             err.span_suggestion(
                                 tcx.def_span(src_def_id),
@@ -448,8 +448,8 @@ pub(crate) fn check_generic_arg_count(
         let infer_lifetimes =
             (gen_pos != GenericArgPosition::Type || infer_args) && !gen_args.has_lifetime_params();
 
-        if gen_pos != GenericArgPosition::Type && !gen_args.bindings.is_empty() {
-            Self::prohibit_assoc_ty_binding(tcx, gen_args.bindings[0].span);
+        if gen_pos != GenericArgPosition::Type && let Some(b) = gen_args.bindings.first() {
+            Self::prohibit_assoc_ty_binding(tcx, b.span);
         }
 
         let explicit_late_bound =
@@ -649,9 +649,8 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes(
                     LATE_BOUND_LIFETIME_ARGUMENTS,
                     args.args[0].hir_id(),
                     multispan,
-                    |lint| {
-                        lint.build(msg).emit();
-                    },
+                    msg,
+                    |lint| lint,
                 );
             }