]> git.lizzy.rs Git - rust.git/commitdiff
remove `FnCtxt::to_const`
authorlcnr <rust@lcnr.de>
Mon, 19 Sep 2022 14:08:40 +0000 (16:08 +0200)
committerlcnr <rust@lcnr.de>
Mon, 19 Sep 2022 14:08:40 +0000 (16:08 +0200)
compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

index a40478db96901719f5392fff5481c634f393aaaa..4af723944bc8317f5f2e9c19068f7b9debc8decf 100644 (file)
@@ -489,18 +489,16 @@ pub fn to_ty_saving_user_provided_ty(&self, ast_ty: &hir::Ty<'_>) -> Ty<'tcx> {
     pub fn array_length_to_const(&self, length: &hir::ArrayLen) -> ty::Const<'tcx> {
         match length {
             &hir::ArrayLen::Infer(_, span) => self.ct_infer(self.tcx.types.usize, None, span),
-            hir::ArrayLen::Body(anon_const) => self.to_const(anon_const),
+            hir::ArrayLen::Body(anon_const) => {
+                let const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id);
+                let span = self.tcx.hir().span(anon_const.hir_id);
+                let c = ty::Const::from_anon_const(self.tcx, const_def_id);
+                self.register_wf_obligation(c.into(), span, ObligationCauseCode::WellFormed(None));
+                self.normalize_associated_types_in(span, c)
+            }
         }
     }
 
-    pub fn to_const(&self, ast_c: &hir::AnonConst) -> ty::Const<'tcx> {
-        let const_def_id = self.tcx.hir().local_def_id(ast_c.hir_id);
-        let span = self.tcx.hir().span(ast_c.hir_id);
-        let c = ty::Const::from_anon_const(self.tcx, const_def_id);
-        self.register_wf_obligation(c.into(), span, ObligationCauseCode::WellFormed(None));
-        self.normalize_associated_types_in(span, c)
-    }
-
     pub fn const_arg_to_const(
         &self,
         ast_c: &hir::AnonConst,