Skip to content

Commit 95f600d

Browse files
committed
Remove MatchCheckCtxt::create_and_enter.
It has a single call site.
1 parent cbc577f commit 95f600d

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/librustc_mir_build/hair/pattern/_match.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -580,21 +580,11 @@ crate struct MatchCheckCtxt<'a, 'tcx> {
580580
/// outside it's module and should not be matchable with an empty match
581581
/// statement.
582582
crate module: DefId,
583-
param_env: ty::ParamEnv<'tcx>,
583+
crate param_env: ty::ParamEnv<'tcx>,
584584
crate pattern_arena: &'a TypedArena<Pat<'tcx>>,
585585
}
586586

587587
impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
588-
crate fn create_and_enter<R>(
589-
tcx: TyCtxt<'tcx>,
590-
param_env: ty::ParamEnv<'tcx>,
591-
pattern_arena: &'a TypedArena<Pat<'tcx>>,
592-
module: DefId,
593-
f: impl FnOnce(MatchCheckCtxt<'a, 'tcx>) -> R,
594-
) -> R {
595-
f(MatchCheckCtxt { tcx, param_env, module, pattern_arena })
596-
}
597-
598588
fn is_uninhabited(&self, ty: Ty<'tcx>) -> bool {
599589
if self.tcx.features().exhaustive_patterns {
600590
self.tcx.is_ty_uninhabited_from(self.module, ty, self.param_env)

src/librustc_mir_build/hair/pattern/check_match.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
149149

150150
fn check_in_cx(&self, hir_id: HirId, f: impl FnOnce(MatchCheckCtxt<'_, 'tcx>)) {
151151
let module = self.tcx.parent_module(hir_id);
152-
MatchCheckCtxt::create_and_enter(
153-
self.tcx,
154-
self.param_env,
155-
&self.pattern_arena,
156-
module.to_def_id(),
157-
f,
158-
);
152+
let cx = MatchCheckCtxt {
153+
tcx: self.tcx,
154+
param_env: self.param_env,
155+
module: module.to_def_id(),
156+
pattern_arena: &self.pattern_arena,
157+
};
158+
f(cx);
159159
}
160160

161161
fn check_match(

0 commit comments

Comments
 (0)