Skip to content

Commit ece0971

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 f4cfd87 commit ece0971

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;
@@ -951,7 +949,7 @@ struct Candidate<'pat, 'tcx> {
951949
has_guard: bool,
952950

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

956954
/// ...these bindings established...
957955
bindings: Vec<Binding<'tcx>>,
@@ -981,7 +979,7 @@ impl<'tcx, 'pat> Candidate<'pat, 'tcx> {
981979
Candidate {
982980
span: pattern.span,
983981
has_guard,
984-
match_pairs: smallvec![MatchPair::new(place, pattern, cx)],
982+
match_pairs: vec![MatchPair::new(place, pattern, cx)],
985983
bindings: Vec::new(),
986984
ascriptions: Vec::new(),
987985
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)