Remove pattern_arena
from RustcMatchCheckCtxt
This commit is contained in:
parent
be77cf86ba
commit
f65fe3ba59
@ -291,7 +291,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
|||||||
err = err.and(check_never_pattern(cx, pat));
|
err = err.and(check_never_pattern(cx, pat));
|
||||||
});
|
});
|
||||||
err?;
|
err?;
|
||||||
Ok(cx.pattern_arena.alloc(cx.lower_pat(pat)))
|
Ok(self.pattern_arena.alloc(cx.lower_pat(pat)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +388,6 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
|||||||
typeck_results: self.typeck_results,
|
typeck_results: self.typeck_results,
|
||||||
param_env: self.param_env,
|
param_env: self.param_env,
|
||||||
module: self.tcx.parent_module(self.lint_level).to_def_id(),
|
module: self.tcx.parent_module(self.lint_level).to_def_id(),
|
||||||
pattern_arena: self.pattern_arena,
|
|
||||||
dropless_arena: self.dropless_arena,
|
dropless_arena: self.dropless_arena,
|
||||||
match_lint_level: self.lint_level,
|
match_lint_level: self.lint_level,
|
||||||
whole_match_span,
|
whole_match_span,
|
||||||
|
@ -23,7 +23,10 @@ impl<'tcx> Uncovered<'tcx> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
cx: &RustcMatchCheckCtxt<'p, 'tcx>,
|
cx: &RustcMatchCheckCtxt<'p, 'tcx>,
|
||||||
witnesses: Vec<WitnessPat<'p, 'tcx>>,
|
witnesses: Vec<WitnessPat<'p, 'tcx>>,
|
||||||
) -> Self {
|
) -> Self
|
||||||
|
where
|
||||||
|
'tcx: 'p,
|
||||||
|
{
|
||||||
let witness_1 = cx.hoist_witness_pat(witnesses.get(0).unwrap());
|
let witness_1 = cx.hoist_witness_pat(witnesses.get(0).unwrap());
|
||||||
Self {
|
Self {
|
||||||
span,
|
span,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::iter::once;
|
use std::iter::once;
|
||||||
|
|
||||||
use rustc_arena::{DroplessArena, TypedArena};
|
use rustc_arena::DroplessArena;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::HirId;
|
use rustc_hir::HirId;
|
||||||
use rustc_index::{Idx, IndexVec};
|
use rustc_index::{Idx, IndexVec};
|
||||||
@ -62,7 +62,7 @@ impl<'tcx> RevealedTy<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RustcMatchCheckCtxt<'p, 'tcx> {
|
pub struct RustcMatchCheckCtxt<'p, 'tcx: 'p> {
|
||||||
pub tcx: TyCtxt<'tcx>,
|
pub tcx: TyCtxt<'tcx>,
|
||||||
pub typeck_results: &'tcx ty::TypeckResults<'tcx>,
|
pub typeck_results: &'tcx ty::TypeckResults<'tcx>,
|
||||||
/// The module in which the match occurs. This is necessary for
|
/// The module in which the match occurs. This is necessary for
|
||||||
@ -72,8 +72,6 @@ pub struct RustcMatchCheckCtxt<'p, 'tcx> {
|
|||||||
/// outside its module and should not be matchable with an empty match statement.
|
/// outside its module and should not be matchable with an empty match statement.
|
||||||
pub module: DefId,
|
pub module: DefId,
|
||||||
pub param_env: ty::ParamEnv<'tcx>,
|
pub param_env: ty::ParamEnv<'tcx>,
|
||||||
/// To allocate lowered patterns
|
|
||||||
pub pattern_arena: &'p TypedArena<DeconstructedPat<'p, 'tcx>>,
|
|
||||||
/// To allocate the result of `self.ctor_sub_tys()`
|
/// To allocate the result of `self.ctor_sub_tys()`
|
||||||
pub dropless_arena: &'p DroplessArena,
|
pub dropless_arena: &'p DroplessArena,
|
||||||
/// Lint level at the match.
|
/// Lint level at the match.
|
||||||
@ -89,13 +87,13 @@ pub struct RustcMatchCheckCtxt<'p, 'tcx> {
|
|||||||
pub known_valid_scrutinee: bool,
|
pub known_valid_scrutinee: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'p, 'tcx> fmt::Debug for RustcMatchCheckCtxt<'p, 'tcx> {
|
impl<'p, 'tcx: 'p> fmt::Debug for RustcMatchCheckCtxt<'p, 'tcx> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("RustcMatchCheckCtxt").finish()
|
f.debug_struct("RustcMatchCheckCtxt").finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
|
impl<'p, 'tcx: 'p> RustcMatchCheckCtxt<'p, 'tcx> {
|
||||||
/// Type inference occasionally gives us opaque types in places where corresponding patterns
|
/// Type inference occasionally gives us opaque types in places where corresponding patterns
|
||||||
/// have more specific types. To avoid inconsistencies as well as detect opaque uninhabited
|
/// have more specific types. To avoid inconsistencies as well as detect opaque uninhabited
|
||||||
/// types, we use the corresponding concrete type if possible.
|
/// types, we use the corresponding concrete type if possible.
|
||||||
@ -844,7 +842,7 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'p, 'tcx> TypeCx for RustcMatchCheckCtxt<'p, 'tcx> {
|
impl<'p, 'tcx: 'p> TypeCx for RustcMatchCheckCtxt<'p, 'tcx> {
|
||||||
type Ty = RevealedTy<'tcx>;
|
type Ty = RevealedTy<'tcx>;
|
||||||
type Error = ErrorGuaranteed;
|
type Error = ErrorGuaranteed;
|
||||||
type VariantIdx = VariantIdx;
|
type VariantIdx = VariantIdx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user