diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir_build/hair/pattern/_match.rs | 12 | ||||
| -rw-r--r-- | src/librustc_mir_build/hair/pattern/check_match.rs | 14 |
2 files changed, 8 insertions, 18 deletions
diff --git a/src/librustc_mir_build/hair/pattern/_match.rs b/src/librustc_mir_build/hair/pattern/_match.rs index 4e8ec6152e3..cdafb63f1eb 100644 --- a/src/librustc_mir_build/hair/pattern/_match.rs +++ b/src/librustc_mir_build/hair/pattern/_match.rs @@ -580,21 +580,11 @@ crate struct MatchCheckCtxt<'a, 'tcx> { /// outside it's module and should not be matchable with an empty match /// statement. crate module: DefId, - param_env: ty::ParamEnv<'tcx>, + crate param_env: ty::ParamEnv<'tcx>, crate pattern_arena: &'a TypedArena<Pat<'tcx>>, } impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { - crate fn create_and_enter<R>( - tcx: TyCtxt<'tcx>, - param_env: ty::ParamEnv<'tcx>, - pattern_arena: &'a TypedArena<Pat<'tcx>>, - module: DefId, - f: impl FnOnce(MatchCheckCtxt<'a, 'tcx>) -> R, - ) -> R { - f(MatchCheckCtxt { tcx, param_env, module, pattern_arena }) - } - fn is_uninhabited(&self, ty: Ty<'tcx>) -> bool { if self.tcx.features().exhaustive_patterns { self.tcx.is_ty_uninhabited_from(self.module, ty, self.param_env) diff --git a/src/librustc_mir_build/hair/pattern/check_match.rs b/src/librustc_mir_build/hair/pattern/check_match.rs index eda694ee2cb..c3e853c0b2d 100644 --- a/src/librustc_mir_build/hair/pattern/check_match.rs +++ b/src/librustc_mir_build/hair/pattern/check_match.rs @@ -149,13 +149,13 @@ impl<'tcx> MatchVisitor<'_, 'tcx> { fn check_in_cx(&self, hir_id: HirId, f: impl FnOnce(MatchCheckCtxt<'_, 'tcx>)) { let module = self.tcx.parent_module(hir_id); - MatchCheckCtxt::create_and_enter( - self.tcx, - self.param_env, - &self.pattern_arena, - module.to_def_id(), - f, - ); + let cx = MatchCheckCtxt { + tcx: self.tcx, + param_env: self.param_env, + module: module.to_def_id(), + pattern_arena: &self.pattern_arena, + }; + f(cx); } fn check_match( |
