Skip to content

Commit 37418b8

Browse files
committed
stop using MatchCheckCtxt to hold the param-env for check_match
1 parent e313d8b commit 37418b8

File tree

2 files changed

+161
-135
lines changed

2 files changed

+161
-135
lines changed

src/librustc_const_eval/_match.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ impl<'a, 'tcx> FromIterator<Vec<&'a Pattern<'tcx>>> for Matrix<'a, 'tcx> {
155155
//NOTE: appears to be the only place other then InferCtxt to contain a ParamEnv
156156
pub struct MatchCheckCtxt<'a, 'tcx: 'a> {
157157
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
158-
pub param_env: ty::ParameterEnvironment<'tcx>,
159158
/// A wild pattern with an error type - it exists to avoid having to normalize
160159
/// associated types to get field types.
161160
pub wild_pattern: &'a Pattern<'tcx>,
@@ -165,7 +164,6 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> {
165164
impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
166165
pub fn create_and_enter<F, R>(
167166
tcx: TyCtxt<'a, 'tcx, 'tcx>,
168-
param_env: ty::ParameterEnvironment<'tcx>,
169167
f: F) -> R
170168
where F: for<'b> FnOnce(MatchCheckCtxt<'b, 'tcx>) -> R
171169
{
@@ -179,7 +177,6 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
179177

180178
f(MatchCheckCtxt {
181179
tcx: tcx,
182-
param_env: param_env,
183180
wild_pattern: &wild_pattern,
184181
pattern_arena: &pattern_arena,
185182
})
@@ -675,18 +672,3 @@ fn specialize<'a, 'tcx>(
675672
head
676673
})
677674
}
678-
679-
pub fn is_refutable<'a, 'tcx, A, F>(
680-
cx: &MatchCheckCtxt<'a, 'tcx>,
681-
pat: &'a Pattern<'tcx>,
682-
refutable: F)
683-
-> Option<A> where
684-
F: FnOnce(&Witness) -> A,
685-
{
686-
let pats = Matrix(vec![vec![pat]]);
687-
match is_useful(cx, &pats, &[cx.wild_pattern], ConstructWitness) {
688-
UsefulWithWitness(pats) => Some(refutable(&pats[0])),
689-
NotUseful => None,
690-
Useful => bug!()
691-
}
692-
}

0 commit comments

Comments
 (0)