1
Fork 0

Run rustfmt --file-lines ... for changes from previous commits.

This commit is contained in:
Eduard-Mihai Burtescu 2019-06-16 12:41:24 +03:00
parent 4c4fc7512e
commit ea78c3aa33
13 changed files with 103 additions and 77 deletions

View file

@ -505,10 +505,9 @@ impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> {
// Decode something that was encoded with encode_tagged() and verify that the // Decode something that was encoded with encode_tagged() and verify that the
// tag matches and the correct amount of bytes was read. // tag matches and the correct amount of bytes was read.
fn decode_tagged<D, T, V>(decoder: &mut D, fn decode_tagged<D, T, V>(decoder: &mut D, expected_tag: T) -> Result<V, D::Error>
expected_tag: T) where
-> Result<V, D::Error> T: Decodable + Eq + ::std::fmt::Debug,
where T: Decodable + Eq + ::std::fmt::Debug,
V: Decodable, V: Decodable,
D: DecoderWithPosition, D: DecoderWithPosition,
{ {

View file

@ -20,7 +20,7 @@ struct GatherMoveInfo<'c, 'tcx> {
id: hir::ItemLocalId, id: hir::ItemLocalId,
kind: MoveKind, kind: MoveKind,
cmt: &'c mc::cmt_<'tcx>, cmt: &'c mc::cmt_<'tcx>,
span_path_opt: Option<MovePlace<'tcx>> span_path_opt: Option<MovePlace<'tcx>>,
} }
/// Represents the kind of pattern /// Represents the kind of pattern
@ -91,11 +91,13 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
gather_move(bccx, move_data, move_error_collector, move_info); gather_move(bccx, move_data, move_error_collector, move_info);
} }
pub fn gather_move_from_pat<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, pub fn gather_move_from_pat<'a, 'c, 'tcx>(
bccx: &BorrowckCtxt<'a, 'tcx>,
move_data: &MoveData<'tcx>, move_data: &MoveData<'tcx>,
move_error_collector: &mut MoveErrorCollector<'tcx>, move_error_collector: &mut MoveErrorCollector<'tcx>,
move_pat: &hir::Pat, move_pat: &hir::Pat,
cmt: &'c mc::cmt_<'tcx>) { cmt: &'c mc::cmt_<'tcx>,
) {
let source = get_pattern_source(bccx.tcx,move_pat); let source = get_pattern_source(bccx.tcx,move_pat);
let pat_span_path_opt = match move_pat.node { let pat_span_path_opt = match move_pat.node {
PatKind::Binding(_, _, ident, _) => { PatKind::Binding(_, _, ident, _) => {
@ -121,10 +123,12 @@ pub fn gather_move_from_pat<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
gather_move(bccx, move_data, move_error_collector, move_info); gather_move(bccx, move_data, move_error_collector, move_info);
} }
fn gather_move<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, fn gather_move<'a, 'c, 'tcx>(
bccx: &BorrowckCtxt<'a, 'tcx>,
move_data: &MoveData<'tcx>, move_data: &MoveData<'tcx>,
move_error_collector: &mut MoveErrorCollector<'tcx>, move_error_collector: &mut MoveErrorCollector<'tcx>,
move_info: GatherMoveInfo<'c, 'tcx>) { move_info: GatherMoveInfo<'c, 'tcx>,
) {
debug!("gather_move(move_id={:?}, cmt={:?})", debug!("gather_move(move_id={:?}, cmt={:?})",
move_info.id, move_info.cmt); move_info.id, move_info.cmt);

View file

@ -94,7 +94,7 @@ pub fn compare_simd_types<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
rhs: Bx::Value, rhs: Bx::Value,
t: Ty<'tcx>, t: Ty<'tcx>,
ret_ty: Bx::Type, ret_ty: Bx::Type,
op: hir::BinOpKind op: hir::BinOpKind,
) -> Bx::Value { ) -> Bx::Value {
let signed = match t.sty { let signed = match t.sty {
ty::Float(_) => { ty::Float(_) => {
@ -156,7 +156,7 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
src: Bx::Value, src: Bx::Value,
src_ty: Ty<'tcx>, src_ty: Ty<'tcx>,
dst_ty: Ty<'tcx> dst_ty: Ty<'tcx>,
) -> (Bx::Value, Bx::Value) { ) -> (Bx::Value, Bx::Value) {
debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty); debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty);
match (&src_ty.sty, &dst_ty.sty) { match (&src_ty.sty, &dst_ty.sty) {
@ -210,7 +210,7 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
src: PlaceRef<'tcx, Bx::Value>, src: PlaceRef<'tcx, Bx::Value>,
dst: PlaceRef<'tcx, Bx::Value> dst: PlaceRef<'tcx, Bx::Value>,
) { ) {
let src_ty = src.layout.ty; let src_ty = src.layout.ty;
let dst_ty = dst.layout.ty; let dst_ty = dst.layout.ty;
@ -270,7 +270,7 @@ pub fn cast_shift_expr_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
op: hir::BinOpKind, op: hir::BinOpKind,
lhs: Bx::Value, lhs: Bx::Value,
rhs: Bx::Value rhs: Bx::Value,
) -> Bx::Value { ) -> Bx::Value {
cast_shift_rhs(bx, op, lhs, rhs) cast_shift_rhs(bx, op, lhs, rhs)
} }
@ -318,7 +318,7 @@ pub fn wants_msvc_seh(sess: &Session) -> bool {
pub fn from_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn from_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
val: Bx::Value val: Bx::Value,
) -> Bx::Value { ) -> Bx::Value {
if bx.cx().val_ty(val) == bx.cx().type_i1() { if bx.cx().val_ty(val) == bx.cx().type_i1() {
bx.zext(val, bx.cx().type_i8()) bx.zext(val, bx.cx().type_i8())
@ -387,9 +387,7 @@ pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
/// Creates the `main` function which will initialize the rust runtime and call /// Creates the `main` function which will initialize the rust runtime and call
/// users main function. /// users main function.
pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'a Bx::CodegenCx) {
cx: &'a Bx::CodegenCx
) {
let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) { let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) {
Some((def_id, _)) => { (def_id, cx.tcx().def_span(def_id)) }, Some((def_id, _)) => { (def_id, cx.tcx().def_span(def_id)) },
None => return, None => return,

View file

@ -140,7 +140,7 @@ pub fn langcall(tcx: TyCtxt<'_>, span: Option<Span>, msg: &str, li: LangItem) ->
pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
lhs: Bx::Value, lhs: Bx::Value,
rhs: Bx::Value rhs: Bx::Value,
) -> Bx::Value { ) -> Bx::Value {
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shl, lhs, rhs); let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shl, lhs, rhs);
// #1877, #10183: Ensure that input is always valid // #1877, #10183: Ensure that input is always valid
@ -152,7 +152,7 @@ pub fn build_unchecked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
lhs_t: Ty<'tcx>, lhs_t: Ty<'tcx>,
lhs: Bx::Value, lhs: Bx::Value,
rhs: Bx::Value rhs: Bx::Value,
) -> Bx::Value { ) -> Bx::Value {
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shr, lhs, rhs); let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shr, lhs, rhs);
// #1877, #10183: Ensure that input is always valid // #1877, #10183: Ensure that input is always valid
@ -167,7 +167,7 @@ pub fn build_unchecked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
fn shift_mask_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( fn shift_mask_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
rhs: Bx::Value rhs: Bx::Value,
) -> Bx::Value { ) -> Bx::Value {
let rhs_llty = bx.val_ty(rhs); let rhs_llty = bx.val_ty(rhs);
let shift_val = shift_mask_val(bx, rhs_llty, rhs_llty, false); let shift_val = shift_mask_val(bx, rhs_llty, rhs_llty, false);
@ -178,7 +178,7 @@ pub fn shift_mask_val<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
llty: Bx::Type, llty: Bx::Type,
mask_llty: Bx::Type, mask_llty: Bx::Type,
invert: bool invert: bool,
) -> Bx::Value { ) -> Bx::Value {
let kind = bx.type_kind(llty); let kind = bx.type_kind(llty);
match kind { match kind {

View file

@ -10,7 +10,7 @@ use crate::traits::*;
pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
bx: &mut Bx, bx: &mut Bx,
t: Ty<'tcx>, t: Ty<'tcx>,
info: Option<Bx::Value> info: Option<Bx::Value>,
) -> (Bx::Value, Bx::Value) { ) -> (Bx::Value, Bx::Value) {
let layout = bx.layout_of(t); let layout = bx.layout_of(t);
debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}", debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}",

View file

@ -13,7 +13,7 @@ use super::FunctionCx;
use crate::traits::*; use crate::traits::*;
pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
fx: &FunctionCx<'a, 'tcx, Bx> fx: &FunctionCx<'a, 'tcx, Bx>,
) -> BitSet<mir::Local> { ) -> BitSet<mir::Local> {
let mir = fx.mir; let mir = fx.mir;
let mut analyzer = LocalAnalyzer::new(fx); let mut analyzer = LocalAnalyzer::new(fx);
@ -49,7 +49,7 @@ struct LocalAnalyzer<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
non_ssa_locals: BitSet<mir::Local>, non_ssa_locals: BitSet<mir::Local>,
// The location of the first visited direct assignment to each // The location of the first visited direct assignment to each
// local, or an invalid location (out of bounds `block` index). // local, or an invalid location (out of bounds `block` index).
first_assignment: IndexVec<mir::Local, Location> first_assignment: IndexVec<mir::Local, Location>,
} }
impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
@ -95,7 +95,8 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
} }
impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
for LocalAnalyzer<'mir, 'a, 'tcx, Bx> { for LocalAnalyzer<'mir, 'a, 'tcx, Bx>
{
fn visit_assign(&mut self, fn visit_assign(&mut self,
place: &mir::Place<'tcx>, place: &mir::Place<'tcx>,
rvalue: &mir::Rvalue<'tcx>, rvalue: &mir::Rvalue<'tcx>,

View file

@ -43,7 +43,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
/// don't really care about it very much. Anyway, this value /// don't really care about it very much. Anyway, this value
/// contains an alloca into which the personality is stored and /// contains an alloca into which the personality is stored and
/// then later loaded when generating the DIVERGE_BLOCK. /// then later loaded when generating the DIVERGE_BLOCK.
personality_slot: Option<PlaceRef<'tcx, Bx::Value,>>, personality_slot: Option<PlaceRef<'tcx, Bx::Value>>,
/// A `Block` for each MIR `BasicBlock` /// A `Block` for each MIR `BasicBlock`
blocks: IndexVec<mir::BasicBlock, Bx::BasicBlock>, blocks: IndexVec<mir::BasicBlock, Bx::BasicBlock>,
@ -355,10 +355,11 @@ fn create_funclets<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
mir: &'a Body<'tcx>, mir: &'a Body<'tcx>,
bx: &mut Bx, bx: &mut Bx,
cleanup_kinds: &IndexVec<mir::BasicBlock, CleanupKind>, cleanup_kinds: &IndexVec<mir::BasicBlock, CleanupKind>,
block_bxs: &IndexVec<mir::BasicBlock, Bx::BasicBlock>) block_bxs: &IndexVec<mir::BasicBlock, Bx::BasicBlock>,
-> (IndexVec<mir::BasicBlock, Option<Bx::BasicBlock>>, ) -> (
IndexVec<mir::BasicBlock, Option<Bx::Funclet>>) IndexVec<mir::BasicBlock, Option<Bx::BasicBlock>>,
{ IndexVec<mir::BasicBlock, Option<Bx::Funclet>>,
) {
block_bxs.iter_enumerated().zip(cleanup_kinds).map(|((bb, &llbb), cleanup_kind)| { block_bxs.iter_enumerated().zip(cleanup_kinds).map(|((bb, &llbb), cleanup_kind)| {
match *cleanup_kind { match *cleanup_kind {
CleanupKind::Funclet if base::wants_msvc_seh(bx.sess()) => {} CleanupKind::Funclet if base::wants_msvc_seh(bx.sess()) => {}

View file

@ -43,7 +43,7 @@ pub(crate) mod indexes {
pub(crate) struct DataflowBuilder<'a, 'tcx, BD> pub(crate) struct DataflowBuilder<'a, 'tcx, BD>
where where
BD: BitDenotation<'tcx> BD: BitDenotation<'tcx>,
{ {
def_id: DefId, def_id: DefId,
flow_state: DataflowAnalysis<'a, 'tcx, BD>, flow_state: DataflowAnalysis<'a, 'tcx, BD>,
@ -88,7 +88,7 @@ pub(crate) trait Dataflow<'tcx, BD: BitDenotation<'tcx>> {
impl<'a, 'tcx, BD> Dataflow<'tcx, BD> for DataflowBuilder<'a, 'tcx, BD> impl<'a, 'tcx, BD> Dataflow<'tcx, BD> for DataflowBuilder<'a, 'tcx, BD>
where where
BD: BitDenotation<'tcx> BD: BitDenotation<'tcx>,
{ {
fn dataflow<P>(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted { fn dataflow<P>(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted {
self.flow_state.build_sets(); self.flow_state.build_sets();
@ -179,12 +179,16 @@ where
} }
} }
struct PropagationContext<'b, 'a, 'tcx, O> where O: 'b + BitDenotation<'tcx> struct PropagationContext<'b, 'a, 'tcx, O>
where
O: 'b + BitDenotation<'tcx>,
{ {
builder: &'b mut DataflowAnalysis<'a, 'tcx, O>, builder: &'b mut DataflowAnalysis<'a, 'tcx, O>,
} }
impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD>
where
BD: BitDenotation<'tcx>,
{ {
fn propagate(&mut self) { fn propagate(&mut self) {
let mut temp = BitSet::new_empty(self.flow_state.sets.bits_per_block); let mut temp = BitSet::new_empty(self.flow_state.sets.bits_per_block);
@ -234,7 +238,9 @@ impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx>
} }
} }
impl<'b, 'a, 'tcx, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: BitDenotation<'tcx> impl<'b, 'a, 'tcx, BD> PropagationContext<'b, 'a, 'tcx, BD>
where
BD: BitDenotation<'tcx>,
{ {
fn walk_cfg(&mut self, in_out: &mut BitSet<BD::Idx>) { fn walk_cfg(&mut self, in_out: &mut BitSet<BD::Idx>) {
let mut dirty_queue: WorkQueue<mir::BasicBlock> = let mut dirty_queue: WorkQueue<mir::BasicBlock> =
@ -265,7 +271,9 @@ fn dataflow_path(context: &str, path: &str) -> PathBuf {
path path
} }
impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD>
where
BD: BitDenotation<'tcx>,
{ {
fn pre_dataflow_instrumentation<P>(&self, p: P) -> io::Result<()> fn pre_dataflow_instrumentation<P>(&self, p: P) -> io::Result<()>
where P: Fn(&BD, BD::Idx) -> DebugFormatted where P: Fn(&BD, BD::Idx) -> DebugFormatted
@ -387,14 +395,18 @@ pub fn state_for_location<'tcx, T: BitDenotation<'tcx>>(loc: Location,
gen_set.to_dense() gen_set.to_dense()
} }
pub struct DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> pub struct DataflowAnalysis<'a, 'tcx, O>
where
O: BitDenotation<'tcx>,
{ {
flow_state: DataflowState<'tcx, O>, flow_state: DataflowState<'tcx, O>,
dead_unwinds: &'a BitSet<mir::BasicBlock>, dead_unwinds: &'a BitSet<mir::BasicBlock>,
body: &'a Body<'tcx>, body: &'a Body<'tcx>,
} }
impl<'a, 'tcx, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> impl<'a, 'tcx, O> DataflowAnalysis<'a, 'tcx, O>
where
O: BitDenotation<'tcx>,
{ {
pub fn results(self) -> DataflowResults<'tcx, O> { pub fn results(self) -> DataflowResults<'tcx, O> {
DataflowResults(self.flow_state) DataflowResults(self.flow_state)
@ -734,7 +746,10 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx>
} }
} }
impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D>
where
D: BitDenotation<'tcx>,
{
/// Propagates the bits of `in_out` into all the successors of `bb`, /// Propagates the bits of `in_out` into all the successors of `bb`,
/// using bitwise operator denoted by `self.operator`. /// using bitwise operator denoted by `self.operator`.
/// ///

View file

@ -33,7 +33,8 @@ impl<'tcx> ToRef for Expr<'tcx> {
} }
impl<'tcx, T, U> ToRef for &'tcx Option<T> impl<'tcx, T, U> ToRef for &'tcx Option<T>
where &'tcx T: ToRef<Output = U> where
&'tcx T: ToRef<Output = U>,
{ {
type Output = Option<U>; type Output = Option<U>;
@ -43,7 +44,8 @@ impl<'tcx, T, U> ToRef for &'tcx Option<T>
} }
impl<'tcx, T, U> ToRef for &'tcx Vec<T> impl<'tcx, T, U> ToRef for &'tcx Vec<T>
where &'tcx T: ToRef<Output = U> where
&'tcx T: ToRef<Output = U>,
{ {
type Output = Vec<U>; type Output = Vec<U>;
@ -53,7 +55,8 @@ impl<'tcx, T, U> ToRef for &'tcx Vec<T>
} }
impl<'tcx, T, U> ToRef for &'tcx P<[T]> impl<'tcx, T, U> ToRef for &'tcx P<[T]>
where &'tcx T: ToRef<Output = U> where
&'tcx T: ToRef<Output = U>,
{ {
type Output = Vec<U>; type Output = Vec<U>;

View file

@ -632,10 +632,10 @@ impl<'tcx> Witness<'tcx> {
/// ///
/// We make sure to omit constructors that are statically impossible. E.g., for /// We make sure to omit constructors that are statically impossible. E.g., for
/// `Option<!>`, we do not include `Some(_)` in the returned list of constructors. /// `Option<!>`, we do not include `Some(_)` in the returned list of constructors.
fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, fn all_constructors<'a, 'tcx>(
pcx: PatternContext<'tcx>) cx: &mut MatchCheckCtxt<'a, 'tcx>,
-> Vec<Constructor<'tcx>> pcx: PatternContext<'tcx>,
{ ) -> Vec<Constructor<'tcx>> {
debug!("all_constructors({:?})", pcx.ty); debug!("all_constructors({:?})", pcx.ty);
let ctors = match pcx.ty.sty { let ctors = match pcx.ty.sty {
ty::Bool => { ty::Bool => {
@ -706,10 +706,9 @@ fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
ctors ctors
} }
fn max_slice_length<'p, 'a, 'tcx, I>( fn max_slice_length<'p, 'a, 'tcx, I>(cx: &mut MatchCheckCtxt<'a, 'tcx>, patterns: I) -> u64
cx: &mut MatchCheckCtxt<'a, 'tcx>, where
patterns: I) -> u64 I: Iterator<Item = &'p Pattern<'tcx>>,
where I: Iterator<Item=&'p Pattern<'tcx>>,
'tcx: 'p, 'tcx: 'p,
{ {
// The exhaustiveness-checking paper does not include any details on // The exhaustiveness-checking paper does not include any details on
@ -1056,11 +1055,12 @@ fn compute_missing_ctors<'tcx>(
/// relation to preceding patterns, it is not reachable) and exhaustiveness /// relation to preceding patterns, it is not reachable) and exhaustiveness
/// checking (if a wildcard pattern is useful in relation to a matrix, the /// checking (if a wildcard pattern is useful in relation to a matrix, the
/// matrix isn't exhaustive). /// matrix isn't exhaustive).
pub fn is_useful<'p, 'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, pub fn is_useful<'p, 'a, 'tcx>(
cx: &mut MatchCheckCtxt<'a, 'tcx>,
matrix: &Matrix<'p, 'tcx>, matrix: &Matrix<'p, 'tcx>,
v: &[&Pattern<'tcx>], v: &[&Pattern<'tcx>],
witness: WitnessPreference) witness: WitnessPreference,
-> Usefulness<'tcx> { ) -> Usefulness<'tcx> {
let &Matrix(ref rows) = matrix; let &Matrix(ref rows) = matrix;
debug!("is_useful({:#?}, {:#?})", matrix, v); debug!("is_useful({:#?}, {:#?})", matrix, v);
@ -1372,10 +1372,11 @@ fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty
/// expanded to. /// expanded to.
/// ///
/// For instance, a tuple pattern (43u32, 'a') has sub pattern types [u32, char]. /// For instance, a tuple pattern (43u32, 'a') has sub pattern types [u32, char].
fn constructor_sub_pattern_tys<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, fn constructor_sub_pattern_tys<'a, 'tcx>(
cx: &MatchCheckCtxt<'a, 'tcx>,
ctor: &Constructor<'tcx>, ctor: &Constructor<'tcx>,
ty: Ty<'tcx>) -> Vec<Ty<'tcx>> ty: Ty<'tcx>,
{ ) -> Vec<Ty<'tcx>> {
debug!("constructor_sub_pattern_tys({:#?}, {:?})", ctor, ty); debug!("constructor_sub_pattern_tys({:#?}, {:?})", ctor, ty);
match ty.sty { match ty.sty {
ty::Tuple(ref fs) => fs.into_iter().map(|t| t.expect_ty()).collect(), ty::Tuple(ref fs) => fs.into_iter().map(|t| t.expect_ty()).collect(),

View file

@ -625,7 +625,8 @@ struct StorageConflictVisitor<'body, 'tcx, 's> {
} }
impl<'body, 'tcx, 's> DataflowResultsConsumer<'body, 'tcx> impl<'body, 'tcx, 's> DataflowResultsConsumer<'body, 'tcx>
for StorageConflictVisitor<'body, 'tcx, 's> { for StorageConflictVisitor<'body, 'tcx, 's>
{
type FlowState = FlowAtLocation<'tcx, MaybeStorageLive<'body, 'tcx>>; type FlowState = FlowAtLocation<'tcx, MaybeStorageLive<'body, 'tcx>>;
fn body(&self) -> &'body Body<'tcx> { fn body(&self) -> &'body Body<'tcx> {

View file

@ -91,7 +91,8 @@ pub trait DropElaborator<'a, 'tcx>: fmt::Debug {
#[derive(Debug)] #[derive(Debug)]
struct DropCtxt<'l, 'b, 'tcx, D> struct DropCtxt<'l, 'b, 'tcx, D>
where D : DropElaborator<'b, 'tcx> + 'l where
D: DropElaborator<'b, 'tcx> + 'l,
{ {
elaborator: &'l mut D, elaborator: &'l mut D,
@ -110,8 +111,9 @@ pub fn elaborate_drop<'b, 'tcx, D>(
path: D::Path, path: D::Path,
succ: BasicBlock, succ: BasicBlock,
unwind: Unwind, unwind: Unwind,
bb: BasicBlock) bb: BasicBlock,
where D: DropElaborator<'b, 'tcx>, ) where
D: DropElaborator<'b, 'tcx>,
'tcx: 'b, 'tcx: 'b,
{ {
DropCtxt { DropCtxt {

View file

@ -339,11 +339,12 @@ pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>)
/// This method helps to extract all the type parameters referenced from a /// This method helps to extract all the type parameters referenced from a
/// type. For a type parameter `<T>`, it looks for either a `TyPath` that /// type. For a type parameter `<T>`, it looks for either a `TyPath` that
/// is not global and starts with `T`, or a `TyQPath`. /// is not global and starts with `T`, or a `TyQPath`.
fn find_type_parameters(ty: &ast::Ty, fn find_type_parameters(
ty: &ast::Ty,
ty_param_names: &[ast::Name], ty_param_names: &[ast::Name],
span: Span, span: Span,
cx: &ExtCtxt<'_>) cx: &ExtCtxt<'_>,
-> Vec<P<ast::Ty>> { ) -> Vec<P<ast::Ty>> {
use syntax::visit; use syntax::visit;
struct Visitor<'a, 'b> { struct Visitor<'a, 'b> {