diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 5349b7dbda5..982886f0f15 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -505,12 +505,11 @@ impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> { // Decode something that was encoded with encode_tagged() and verify that the // tag matches and the correct amount of bytes was read. -fn decode_tagged(decoder: &mut D, - expected_tag: T) - -> Result - where T: Decodable + Eq + ::std::fmt::Debug, - V: Decodable, - D: DecoderWithPosition, +fn decode_tagged(decoder: &mut D, expected_tag: T) -> Result +where + T: Decodable + Eq + ::std::fmt::Debug, + V: Decodable, + D: DecoderWithPosition, { let start_pos = decoder.position(); diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index cc1f7232e04..05c0a22900a 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -20,7 +20,7 @@ struct GatherMoveInfo<'c, 'tcx> { id: hir::ItemLocalId, kind: MoveKind, cmt: &'c mc::cmt_<'tcx>, - span_path_opt: Option> + span_path_opt: Option>, } /// 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); } -pub fn gather_move_from_pat<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - move_data: &MoveData<'tcx>, - move_error_collector: &mut MoveErrorCollector<'tcx>, - move_pat: &hir::Pat, - cmt: &'c mc::cmt_<'tcx>) { +pub fn gather_move_from_pat<'a, 'c, 'tcx>( + bccx: &BorrowckCtxt<'a, 'tcx>, + move_data: &MoveData<'tcx>, + move_error_collector: &mut MoveErrorCollector<'tcx>, + move_pat: &hir::Pat, + cmt: &'c mc::cmt_<'tcx>, +) { let source = get_pattern_source(bccx.tcx,move_pat); let pat_span_path_opt = match move_pat.node { 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); } -fn gather_move<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - move_data: &MoveData<'tcx>, - move_error_collector: &mut MoveErrorCollector<'tcx>, - move_info: GatherMoveInfo<'c, 'tcx>) { +fn gather_move<'a, 'c, 'tcx>( + bccx: &BorrowckCtxt<'a, 'tcx>, + move_data: &MoveData<'tcx>, + move_error_collector: &mut MoveErrorCollector<'tcx>, + move_info: GatherMoveInfo<'c, 'tcx>, +) { debug!("gather_move(move_id={:?}, cmt={:?})", move_info.id, move_info.cmt); diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index ba96865d23b..47b383fddbc 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -94,7 +94,7 @@ pub fn compare_simd_types<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( rhs: Bx::Value, t: Ty<'tcx>, ret_ty: Bx::Type, - op: hir::BinOpKind + op: hir::BinOpKind, ) -> Bx::Value { let signed = match t.sty { ty::Float(_) => { @@ -156,7 +156,7 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, src: Bx::Value, src_ty: Ty<'tcx>, - dst_ty: Ty<'tcx> + dst_ty: Ty<'tcx>, ) -> (Bx::Value, Bx::Value) { debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty); match (&src_ty.sty, &dst_ty.sty) { @@ -210,8 +210,8 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, src: PlaceRef<'tcx, Bx::Value>, - dst: PlaceRef<'tcx, Bx::Value> -) { + dst: PlaceRef<'tcx, Bx::Value>, +) { let src_ty = src.layout.ty; let dst_ty = dst.layout.ty; let mut coerce_ptr = || { @@ -270,7 +270,7 @@ pub fn cast_shift_expr_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, op: hir::BinOpKind, lhs: Bx::Value, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { 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>>( bx: &mut Bx, - val: Bx::Value + val: Bx::Value, ) -> Bx::Value { if bx.cx().val_ty(val) == bx.cx().type_i1() { 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 /// users main function. -pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( - cx: &'a Bx::CodegenCx -) { +pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'a Bx::CodegenCx) { let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) { Some((def_id, _)) => { (def_id, cx.tcx().def_span(def_id)) }, None => return, diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index d17edf2ec0a..6376512ca40 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -140,7 +140,7 @@ pub fn langcall(tcx: TyCtxt<'_>, span: Option, msg: &str, li: LangItem) -> pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, lhs: Bx::Value, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shl, lhs, rhs); // #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, lhs_t: Ty<'tcx>, lhs: Bx::Value, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shr, lhs, rhs); // #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>>( bx: &mut Bx, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { let rhs_llty = bx.val_ty(rhs); 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, llty: Bx::Type, mask_llty: Bx::Type, - invert: bool + invert: bool, ) -> Bx::Value { let kind = bx.type_kind(llty); match kind { diff --git a/src/librustc_codegen_ssa/glue.rs b/src/librustc_codegen_ssa/glue.rs index 294e2e021d2..7fd9f67e2f4 100644 --- a/src/librustc_codegen_ssa/glue.rs +++ b/src/librustc_codegen_ssa/glue.rs @@ -10,7 +10,7 @@ use crate::traits::*; pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, - info: Option + info: Option, ) -> (Bx::Value, Bx::Value) { let layout = bx.layout_of(t); debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}", diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index 3d41eddb803..0289150a5e4 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -13,7 +13,7 @@ use super::FunctionCx; use crate::traits::*; pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( - fx: &FunctionCx<'a, 'tcx, Bx> + fx: &FunctionCx<'a, 'tcx, Bx>, ) -> BitSet { let mir = fx.mir; let mut analyzer = LocalAnalyzer::new(fx); @@ -49,7 +49,7 @@ struct LocalAnalyzer<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { non_ssa_locals: BitSet, // The location of the first visited direct assignment to each // local, or an invalid location (out of bounds `block` index). - first_assignment: IndexVec + first_assignment: IndexVec, } impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { @@ -95,7 +95,8 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { } 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, place: &mir::Place<'tcx>, rvalue: &mir::Rvalue<'tcx>, diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 78af71b5a49..c20be56ba0c 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -43,7 +43,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { /// don't really care about it very much. Anyway, this value /// contains an alloca into which the personality is stored and /// then later loaded when generating the DIVERGE_BLOCK. - personality_slot: Option>, + personality_slot: Option>, /// A `Block` for each MIR `BasicBlock` blocks: IndexVec, @@ -355,10 +355,11 @@ fn create_funclets<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( mir: &'a Body<'tcx>, bx: &mut Bx, cleanup_kinds: &IndexVec, - block_bxs: &IndexVec) - -> (IndexVec>, - IndexVec>) -{ + block_bxs: &IndexVec, +) -> ( + IndexVec>, + IndexVec>, +) { block_bxs.iter_enumerated().zip(cleanup_kinds).map(|((bb, &llbb), cleanup_kind)| { match *cleanup_kind { CleanupKind::Funclet if base::wants_msvc_seh(bx.sess()) => {} diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 8f91ba23e23..0728d5b21bb 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -43,7 +43,7 @@ pub(crate) mod indexes { pub(crate) struct DataflowBuilder<'a, 'tcx, BD> where - BD: BitDenotation<'tcx> + BD: BitDenotation<'tcx>, { def_id: DefId, 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> where - BD: BitDenotation<'tcx> + BD: BitDenotation<'tcx>, { fn dataflow

(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted { 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>, } -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) { 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) { let mut dirty_queue: WorkQueue = @@ -265,7 +271,9 @@ fn dataflow_path(context: &str, path: &str) -> PathBuf { 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

(&self, p: P) -> io::Result<()> 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() } -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>, dead_unwinds: &'a BitSet, 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> { 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`, /// using bitwise operator denoted by `self.operator`. /// diff --git a/src/librustc_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs index 2daa8e3cb70..946d66fc91d 100644 --- a/src/librustc_mir/hair/cx/to_ref.rs +++ b/src/librustc_mir/hair/cx/to_ref.rs @@ -33,7 +33,8 @@ impl<'tcx> ToRef for Expr<'tcx> { } impl<'tcx, T, U> ToRef for &'tcx Option - where &'tcx T: ToRef +where + &'tcx T: ToRef, { type Output = Option; @@ -43,7 +44,8 @@ impl<'tcx, T, U> ToRef for &'tcx Option } impl<'tcx, T, U> ToRef for &'tcx Vec - where &'tcx T: ToRef +where + &'tcx T: ToRef, { type Output = Vec; @@ -53,7 +55,8 @@ impl<'tcx, T, U> ToRef for &'tcx Vec } impl<'tcx, T, U> ToRef for &'tcx P<[T]> - where &'tcx T: ToRef +where + &'tcx T: ToRef, { type Output = Vec; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index f5817694c50..1fcdf713372 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -632,10 +632,10 @@ impl<'tcx> Witness<'tcx> { /// /// 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. -fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - pcx: PatternContext<'tcx>) - -> Vec> -{ +fn all_constructors<'a, 'tcx>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + pcx: PatternContext<'tcx>, +) -> Vec> { debug!("all_constructors({:?})", pcx.ty); let ctors = match pcx.ty.sty { ty::Bool => { @@ -706,11 +706,10 @@ fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, ctors } -fn max_slice_length<'p, 'a, 'tcx, I>( - cx: &mut MatchCheckCtxt<'a, 'tcx>, - patterns: I) -> u64 - where I: Iterator>, - 'tcx: 'p, +fn max_slice_length<'p, 'a, 'tcx, I>(cx: &mut MatchCheckCtxt<'a, 'tcx>, patterns: I) -> u64 +where + I: Iterator>, + 'tcx: 'p, { // The exhaustiveness-checking paper does not include any details on // checking variable-length slice patterns. However, they are matched @@ -1056,11 +1055,12 @@ fn compute_missing_ctors<'tcx>( /// relation to preceding patterns, it is not reachable) and exhaustiveness /// checking (if a wildcard pattern is useful in relation to a matrix, the /// matrix isn't exhaustive). -pub fn is_useful<'p, 'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - matrix: &Matrix<'p, 'tcx>, - v: &[&Pattern<'tcx>], - witness: WitnessPreference) - -> Usefulness<'tcx> { +pub fn is_useful<'p, 'a, 'tcx>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + matrix: &Matrix<'p, 'tcx>, + v: &[&Pattern<'tcx>], + witness: WitnessPreference, +) -> Usefulness<'tcx> { let &Matrix(ref rows) = matrix; debug!("is_useful({:#?}, {:#?})", matrix, v); @@ -1372,10 +1372,11 @@ fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty /// expanded to. /// /// For instance, a tuple pattern (43u32, 'a') has sub pattern types [u32, char]. -fn constructor_sub_pattern_tys<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, - ctor: &Constructor<'tcx>, - ty: Ty<'tcx>) -> Vec> -{ +fn constructor_sub_pattern_tys<'a, 'tcx>( + cx: &MatchCheckCtxt<'a, 'tcx>, + ctor: &Constructor<'tcx>, + ty: Ty<'tcx>, +) -> Vec> { debug!("constructor_sub_pattern_tys({:#?}, {:?})", ctor, ty); match ty.sty { ty::Tuple(ref fs) => fs.into_iter().map(|t| t.expect_ty()).collect(), diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 6be54aa629d..ba8c47c665e 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -625,7 +625,8 @@ struct StorageConflictVisitor<'body, 'tcx, 's> { } impl<'body, 'tcx, 's> DataflowResultsConsumer<'body, 'tcx> -for StorageConflictVisitor<'body, 'tcx, 's> { + for StorageConflictVisitor<'body, 'tcx, 's> +{ type FlowState = FlowAtLocation<'tcx, MaybeStorageLive<'body, 'tcx>>; fn body(&self) -> &'body Body<'tcx> { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 002ff4b0b08..815d210d36e 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -91,7 +91,8 @@ pub trait DropElaborator<'a, 'tcx>: fmt::Debug { #[derive(Debug)] struct DropCtxt<'l, 'b, 'tcx, D> - where D : DropElaborator<'b, 'tcx> + 'l +where + D: DropElaborator<'b, 'tcx> + 'l, { elaborator: &'l mut D, @@ -110,8 +111,9 @@ pub fn elaborate_drop<'b, 'tcx, D>( path: D::Path, succ: BasicBlock, unwind: Unwind, - bb: BasicBlock) - where D: DropElaborator<'b, 'tcx>, + bb: BasicBlock, +) where + D: DropElaborator<'b, 'tcx>, 'tcx: 'b, { DropCtxt { diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 3edf7726ec6..444cf1263ce 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -339,11 +339,12 @@ pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>) /// This method helps to extract all the type parameters referenced from a /// type. For a type parameter ``, it looks for either a `TyPath` that /// is not global and starts with `T`, or a `TyQPath`. -fn find_type_parameters(ty: &ast::Ty, - ty_param_names: &[ast::Name], - span: Span, - cx: &ExtCtxt<'_>) - -> Vec> { +fn find_type_parameters( + ty: &ast::Ty, + ty_param_names: &[ast::Name], + span: Span, + cx: &ExtCtxt<'_>, +) -> Vec> { use syntax::visit; struct Visitor<'a, 'b> {