about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2022-09-19 16:08:40 +0200
committerlcnr <rust@lcnr.de>2022-09-19 16:08:40 +0200
commit7207b4dc665da53f4fcb4d7d532cbaba58ce64e3 (patch)
tree7d943ac2eaddbee892b98b313b2ba866c1e5dbfb
parent503e19d01e941b88bf6d5b28e9108d046abcfa2d (diff)
downloadrust-7207b4dc665da53f4fcb4d7d532cbaba58ce64e3.tar.gz
rust-7207b4dc665da53f4fcb4d7d532cbaba58ce64e3.zip
remove `FnCtxt::to_const`
-rw-r--r--compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
index a40478db969..4af723944bc 100644
--- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
+++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
@@ -489,18 +489,16 @@ impl<'a, 'tcx> FnCtxt<'a, '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,