Skip to content

Commit 48b83e8

Browse files
committed
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.
1 parent 4316d0c commit 48b83e8

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

compiler/rustc_mir_build/src/build/matches/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty};
2222
use rustc_span::symbol::Symbol;
2323
use rustc_span::{BytePos, Pos, Span};
2424
use rustc_target::abi::VariantIdx;
25-
use smallvec::{smallvec, SmallVec};
26-
2725
// helper functions, broken out by category:
2826
mod simplify;
2927
mod test;
@@ -949,7 +947,7 @@ struct Candidate<'pat, 'tcx> {
949947
has_guard: bool,
950948

951949
/// All of these must be satisfied...
952-
match_pairs: SmallVec<[MatchPair<'pat, 'tcx>; 1]>,
950+
match_pairs: Vec<MatchPair<'pat, 'tcx>>,
953951

954952
/// ...these bindings established...
955953
bindings: Vec<Binding<'tcx>>,
@@ -979,7 +977,7 @@ impl<'tcx, 'pat> Candidate<'pat, 'tcx> {
979977
Candidate {
980978
span: pattern.span,
981979
has_guard,
982-
match_pairs: smallvec![MatchPair::new(place, pattern, cx)],
980+
match_pairs: vec![MatchPair::new(place, pattern, cx)],
983981
bindings: Vec::new(),
984982
ascriptions: Vec::new(),
985983
subcandidates: Vec::new(),

compiler/rustc_mir_build/src/build/matches/util.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_middle::mir::*;
66
use rustc_middle::thir::*;
77
use rustc_middle::ty;
88
use rustc_middle::ty::TypeVisitableExt;
9-
use smallvec::SmallVec;
109

1110
impl<'a, 'tcx> Builder<'a, 'tcx> {
1211
pub(crate) fn field_match_pairs<'pat>(
@@ -26,7 +25,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2625

2726
pub(crate) fn prefix_slice_suffix<'pat>(
2827
&mut self,
29-
match_pairs: &mut SmallVec<[MatchPair<'pat, 'tcx>; 1]>,
28+
match_pairs: &mut Vec<MatchPair<'pat, 'tcx>>,
3029
place: &PlaceBuilder<'tcx>,
3130
prefix: &'pat [Box<Pat<'tcx>>],
3231
opt_slice: &'pat Option<Box<Pat<'tcx>>>,

0 commit comments

Comments
 (0)