Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/librustc_mir/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty};
use rustc::ty::layout::VariantIdx;
use rustc_index::bit_set::BitSet;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use smallvec::{SmallVec, smallvec};
use syntax::ast::Name;
use syntax_pos::Span;

Expand Down Expand Up @@ -166,7 +167,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|(pattern, pre_binding_block)| {
Candidate {
span: pattern.span,
match_pairs: vec![
match_pairs: smallvec![
MatchPair::new(scrutinee_place.clone(), pattern),
],
bindings: vec![],
Expand Down Expand Up @@ -421,7 +422,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// create a dummy candidate
let mut candidate = Candidate {
span: irrefutable_pat.span,
match_pairs: vec![MatchPair::new(initializer.clone(), &irrefutable_pat)],
match_pairs: smallvec![MatchPair::new(initializer.clone(), &irrefutable_pat)],
bindings: vec![],
ascriptions: vec![],

Expand Down Expand Up @@ -671,7 +672,7 @@ pub struct Candidate<'pat, 'tcx> {
span: Span,

// all of these must be satisfied...
match_pairs: Vec<MatchPair<'pat, 'tcx>>,
match_pairs: SmallVec<[MatchPair<'pat, 'tcx>; 1]>,

// ...these bindings established...
bindings: Vec<Binding<'tcx>>,
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/build/matches/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::build::Builder;
use crate::build::matches::MatchPair;
use crate::hair::*;
use rustc::mir::*;
use smallvec::SmallVec;
use std::u32;
use std::convert::TryInto;

Expand All @@ -25,7 +26,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}

pub fn prefix_slice_suffix<'pat>(&mut self,
match_pairs: &mut Vec<MatchPair<'pat, 'tcx>>,
match_pairs: &mut SmallVec<[MatchPair<'pat, 'tcx>; 1]>,
place: &Place<'tcx>,
prefix: &'pat [Pat<'tcx>],
opt_slice: Option<&'pat Pat<'tcx>>,
Expand Down