diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-05-08 07:42:49 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-05-08 07:42:49 +1000 |
| commit | 95f600d6b9aa892000c8d525a5f5cee9f89b6d1d (patch) | |
| tree | 40ae3bcda1b274e8601fb4cb31b2c5679bf80627 /src | |
| parent | cbc577fc719e00f60004c8b22db0256f4c9da4b2 (diff) | |
| download | rust-95f600d6b9aa892000c8d525a5f5cee9f89b6d1d.tar.gz rust-95f600d6b9aa892000c8d525a5f5cee9f89b6d1d.zip | |
Remove `MatchCheckCtxt::create_and_enter`.
It has a single call site.
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( |
