Switch to Vec of MatchPairs
Because I'm about to make MatchPair recursive, which I can't do with SmallVec, and I need to share code between the two.
This commit is contained in:
parent
4316d0c625
commit
48b83e8a63
@ -22,8 +22,6 @@
|
|||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
use rustc_span::{BytePos, Pos, Span};
|
use rustc_span::{BytePos, Pos, Span};
|
||||||
use rustc_target::abi::VariantIdx;
|
use rustc_target::abi::VariantIdx;
|
||||||
use smallvec::{smallvec, SmallVec};
|
|
||||||
|
|
||||||
// helper functions, broken out by category:
|
// helper functions, broken out by category:
|
||||||
mod simplify;
|
mod simplify;
|
||||||
mod test;
|
mod test;
|
||||||
@ -949,7 +947,7 @@ struct Candidate<'pat, 'tcx> {
|
|||||||
has_guard: bool,
|
has_guard: bool,
|
||||||
|
|
||||||
/// All of these must be satisfied...
|
/// All of these must be satisfied...
|
||||||
match_pairs: SmallVec<[MatchPair<'pat, 'tcx>; 1]>,
|
match_pairs: Vec<MatchPair<'pat, 'tcx>>,
|
||||||
|
|
||||||
/// ...these bindings established...
|
/// ...these bindings established...
|
||||||
bindings: Vec<Binding<'tcx>>,
|
bindings: Vec<Binding<'tcx>>,
|
||||||
@ -979,7 +977,7 @@ fn new(
|
|||||||
Candidate {
|
Candidate {
|
||||||
span: pattern.span,
|
span: pattern.span,
|
||||||
has_guard,
|
has_guard,
|
||||||
match_pairs: smallvec![MatchPair::new(place, pattern, cx)],
|
match_pairs: vec![MatchPair::new(place, pattern, cx)],
|
||||||
bindings: Vec::new(),
|
bindings: Vec::new(),
|
||||||
ascriptions: Vec::new(),
|
ascriptions: Vec::new(),
|
||||||
subcandidates: Vec::new(),
|
subcandidates: Vec::new(),
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
use rustc_middle::thir::*;
|
use rustc_middle::thir::*;
|
||||||
use rustc_middle::ty;
|
use rustc_middle::ty;
|
||||||
use rustc_middle::ty::TypeVisitableExt;
|
use rustc_middle::ty::TypeVisitableExt;
|
||||||
use smallvec::SmallVec;
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
pub(crate) fn field_match_pairs<'pat>(
|
pub(crate) fn field_match_pairs<'pat>(
|
||||||
@ -26,7 +25,7 @@ pub(crate) fn field_match_pairs<'pat>(
|
|||||||
|
|
||||||
pub(crate) fn prefix_slice_suffix<'pat>(
|
pub(crate) fn prefix_slice_suffix<'pat>(
|
||||||
&mut self,
|
&mut self,
|
||||||
match_pairs: &mut SmallVec<[MatchPair<'pat, 'tcx>; 1]>,
|
match_pairs: &mut Vec<MatchPair<'pat, 'tcx>>,
|
||||||
place: &PlaceBuilder<'tcx>,
|
place: &PlaceBuilder<'tcx>,
|
||||||
prefix: &'pat [Box<Pat<'tcx>>],
|
prefix: &'pat [Box<Pat<'tcx>>],
|
||||||
opt_slice: &'pat Option<Box<Pat<'tcx>>>,
|
opt_slice: &'pat Option<Box<Pat<'tcx>>>,
|
||||||
|
Loading…
Reference in New Issue
Block a user