Skip to content

Commit 7207b4d

Browse files
committed
remove FnCtxt::to_const
1 parent 503e19d commit 7207b4d

File tree

1 file changed

+7
-9
lines changed
  • compiler/rustc_typeck/src/check/fn_ctxt

1 file changed

+7
-9
lines changed

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
489489
pub fn array_length_to_const(&self, length: &hir::ArrayLen) -> ty::Const<'tcx> {
490490
match length {
491491
&hir::ArrayLen::Infer(_, span) => self.ct_infer(self.tcx.types.usize, None, span),
492-
hir::ArrayLen::Body(anon_const) => self.to_const(anon_const),
492+
hir::ArrayLen::Body(anon_const) => {
493+
let const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id);
494+
let span = self.tcx.hir().span(anon_const.hir_id);
495+
let c = ty::Const::from_anon_const(self.tcx, const_def_id);
496+
self.register_wf_obligation(c.into(), span, ObligationCauseCode::WellFormed(None));
497+
self.normalize_associated_types_in(span, c)
498+
}
493499
}
494500
}
495501

496-
pub fn to_const(&self, ast_c: &hir::AnonConst) -> ty::Const<'tcx> {
497-
let const_def_id = self.tcx.hir().local_def_id(ast_c.hir_id);
498-
let span = self.tcx.hir().span(ast_c.hir_id);
499-
let c = ty::Const::from_anon_const(self.tcx, const_def_id);
500-
self.register_wf_obligation(c.into(), span, ObligationCauseCode::WellFormed(None));
501-
self.normalize_associated_types_in(span, c)
502-
}
503-
504502
pub fn const_arg_to_const(
505503
&self,
506504
ast_c: &hir::AnonConst,

0 commit comments

Comments
 (0)