Skip to content

Commit

Permalink
Run rustfmt --file-lines ... for changes from previous commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Jun 11, 2019
1 parent 630ec88 commit 1d720ec
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 77 deletions.
3 changes: 2 additions & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ struct HirItemLike<T> {
}

impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T>
where T: HashStable<StableHashingContext<'hir>>
where
T: HashStable<StableHashingContext<'hir>>,
{
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'hir>,
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ pub fn hash_stable_trait_impls<'a, W>(
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>,
blanket_impls: &[DefId],
non_blanket_impls: &FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>)
where W: StableHasherResult
non_blanket_impls: &FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>,
) where
W: StableHasherResult,
{
{
let mut blanket_impls: SmallVec<[_; 8]> = blanket_impls
Expand Down
21 changes: 8 additions & 13 deletions src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::BoundVar {
}

impl<'a, T> HashStable<StableHashingContext<'a>> for ty::Binder<T>
where T: HashStable<StableHashingContext<'a>>
where
T: HashStable<StableHashingContext<'a>>,
{
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
Expand Down Expand Up @@ -192,9 +193,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope {
}
}

impl<'a> HashStable<StableHashingContext<'a>>
for ty::TyVid
{
impl<'a> HashStable<StableHashingContext<'a>> for ty::TyVid {
fn hash_stable<W: StableHasherResult>(&self,
_hcx: &mut StableHashingContext<'a>,
_hasher: &mut StableHasher<W>) {
Expand All @@ -204,9 +203,7 @@ for ty::TyVid
}
}

impl<'a> HashStable<StableHashingContext<'a>>
for ty::IntVid
{
impl<'a> HashStable<StableHashingContext<'a>> for ty::IntVid {
fn hash_stable<W: StableHasherResult>(&self,
_hcx: &mut StableHashingContext<'a>,
_hasher: &mut StableHasher<W>) {
Expand All @@ -216,9 +213,7 @@ for ty::IntVid
}
}

impl<'a> HashStable<StableHashingContext<'a>>
for ty::FloatVid
{
impl<'a> HashStable<StableHashingContext<'a>> for ty::FloatVid {
fn hash_stable<W: StableHasherResult>(&self,
_hcx: &mut StableHashingContext<'a>,
_hasher: &mut StableHasher<W>) {
Expand All @@ -228,9 +223,9 @@ for ty::FloatVid
}
}

impl<'a, T> HashStable<StableHashingContext<'a>>
for ty::steal::Steal<T>
where T: HashStable<StableHashingContext<'a>>
impl<'a, T> HashStable<StableHashingContext<'a>> for ty::steal::Steal<T>
where
T: HashStable<StableHashingContext<'a>>,
{
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
Expand Down
5 changes: 1 addition & 4 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ pub enum IntercrateAmbiguityCause {
impl IntercrateAmbiguityCause {
/// Emits notes when the overlap is caused by complex intercrate ambiguities.
/// See #23980 for details.
pub fn add_intercrate_ambiguity_hint(
&self,
err: &mut errors::DiagnosticBuilder<'_>,
) {
pub fn add_intercrate_ambiguity_hint(&self, err: &mut errors::DiagnosticBuilder<'_>) {
err.note(&self.intercrate_ambiguity_hint());
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/fast_reject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ impl<D: Copy + Debug + Ord + Eq + Hash> SimplifiedTypeGen<D> {
}

impl<'a, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D>
where D: Copy + Debug + Ord + Eq + Hash +
HashStable<StableHashingContext<'a>>,
where
D: Copy + Debug + Ord + Eq + Hash + HashStable<StableHashingContext<'a>>,
{
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,10 @@ fn resolve_associated_item<'a, 'tcx>(
}
}

fn needs_fn_once_adapter_shim(actual_closure_kind: ty::ClosureKind,
trait_closure_kind: ty::ClosureKind)
-> Result<bool, ()>
{
fn needs_fn_once_adapter_shim(
actual_closure_kind: ty::ClosureKind,
trait_closure_kind: ty::ClosureKind,
) -> Result<bool, ()> {
match (actual_closure_kind, trait_closure_kind) {
(ty::ClosureKind::Fn, ty::ClosureKind::Fn) |
(ty::ClosureKind::FnMut, ty::ClosureKind::FnMut) |
Expand Down
7 changes: 4 additions & 3 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1679,9 +1679,10 @@ impl ty::query::TyCtxtAt<'a, 'tcx, '_> {
}

impl<'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
where C: LayoutOf<Ty = Ty<'tcx>> + HasTyCtxt<'tcx>,
C::TyLayout: MaybeResult<TyLayout<'tcx>>,
C: HasParamEnv<'tcx>
where
C: LayoutOf<Ty = Ty<'tcx>> + HasTyCtxt<'tcx>,
C::TyLayout: MaybeResult<TyLayout<'tcx>>,
C: HasParamEnv<'tcx>,
{
fn for_variant(this: TyLayout<'tcx>, cx: &C, variant_index: VariantIdx) -> TyLayout<'tcx> {
let details = match this.variants {
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,8 @@ pub struct Placeholder<T> {
}

impl<'a, T> HashStable<StableHashingContext<'a>> for Placeholder<T>
where T: HashStable<StableHashingContext<'a>>
where
T: HashStable<StableHashingContext<'a>>,
{
fn hash_stable<W: StableHasherResult>(
&self,
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_codegen_ssa/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
}

fn codegen_return_terminator(
&mut self,
mut bx: Bx,
) {
fn codegen_return_terminator(&mut self, mut bx: Bx) {
if self.fn_ty.c_variadic {
match self.va_list_ref {
Some(va_list) => {
Expand Down
6 changes: 1 addition & 5 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,7 @@ fn report_bin_hex_error(
// - `uX` => `uY`
//
// No suggestion for: `isize`, `usize`.
fn get_type_suggestion(
t: Ty<'_>,
val: u128,
negative: bool,
) -> Option<String> {
fn get_type_suggestion(t: Ty<'_>, val: u128, negative: bool) -> Option<String> {
use syntax::ast::IntTy::*;
use syntax::ast::UintTy::*;
macro_rules! find_fit {
Expand Down
6 changes: 1 addition & 5 deletions src/librustc_mir/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,11 +1575,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

/// Append `AscribeUserType` statements onto the end of `block`
/// for each ascription
fn ascribe_types(
&mut self,
block: BasicBlock,
ascriptions: &[Ascription<'tcx>],
) {
fn ascribe_types(&mut self, block: BasicBlock, ascriptions: &[Ascription<'tcx>]) {
for ascription in ascriptions {
let source_info = self.source_info(ascription.span);

Expand Down
49 changes: 20 additions & 29 deletions src/librustc_mir/util/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ pub fn elaborate_drop<'b, 'tcx, D>(
}

impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
where D: DropElaborator<'b, 'tcx>
where
D: DropElaborator<'b, 'tcx>,
{
fn place_ty(&self, place: &Place<'tcx>) -> Ty<'tcx> {
place.ty(self.elaborator.body(), self.tcx()).ty
Expand Down Expand Up @@ -285,12 +286,12 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
///
/// NOTE: this does not clear the master drop flag, so you need
/// to point succ/unwind on a `drop_ladder_bottom`.
fn drop_ladder(&mut self,
fields: Vec<(Place<'tcx>, Option<D::Path>)>,
succ: BasicBlock,
unwind: Unwind)
-> (BasicBlock, Unwind)
{
fn drop_ladder(
&mut self,
fields: Vec<(Place<'tcx>, Option<D::Path>)>,
succ: BasicBlock,
unwind: Unwind,
) -> (BasicBlock, Unwind) {
debug!("drop_ladder({:?}, {:?})", self, fields);

let mut fields = fields;
Expand All @@ -314,9 +315,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
(*normal_ladder.last().unwrap(), *unwind_ladder.last().unwrap())
}

fn open_drop_for_tuple(&mut self, tys: &[Ty<'tcx>])
-> BasicBlock
{
fn open_drop_for_tuple(&mut self, tys: &[Ty<'tcx>]) -> BasicBlock {
debug!("open_drop_for_tuple({:?}, {:?})", self, tys);

let fields = tys.iter().enumerate().map(|(i, &ty)| {
Expand All @@ -328,9 +327,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
self.drop_ladder(fields, succ, unwind).0
}

fn open_drop_for_box(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
-> BasicBlock
{
fn open_drop_for_box(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) -> BasicBlock {
debug!("open_drop_for_box({:?}, {:?}, {:?})", self, adt, substs);

let interior = self.place.clone().deref();
Expand All @@ -346,8 +343,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
self.drop_subpath(&interior, interior_path, succ, unwind_succ)
}

fn open_drop_for_adt(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>)
-> BasicBlock {
fn open_drop_for_adt(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) -> BasicBlock {
debug!("open_drop_for_adt({:?}, {:?}, {:?})", self, adt, substs);
if adt.variants.len() == 0 {
return self.elaborator.patch().new_block(BasicBlockData {
Expand Down Expand Up @@ -505,9 +501,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
self.drop_flag_test_block(switch_block, succ, unwind)
}

fn destructor_call_block(&mut self, (succ, unwind): (BasicBlock, Unwind))
-> BasicBlock
{
fn destructor_call_block(&mut self, (succ, unwind): (BasicBlock, Unwind)) -> BasicBlock {
debug!("destructor_call_block({:?}, {:?})", self, succ);
let tcx = self.tcx();
let drop_trait = tcx.lang_items().drop_trait().unwrap();
Expand Down Expand Up @@ -837,11 +831,12 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
/// if FLAG(self.path)
/// if let Some(mode) = mode: FLAG(self.path)[mode] = false
/// drop(self.place)
fn complete_drop(&mut self,
drop_mode: Option<DropFlagMode>,
succ: BasicBlock,
unwind: Unwind) -> BasicBlock
{
fn complete_drop(
&mut self,
drop_mode: Option<DropFlagMode>,
succ: BasicBlock,
unwind: Unwind,
) -> BasicBlock {
debug!("complete_drop({:?},{:?})", self, drop_mode);

let drop_block = self.drop_block(succ, unwind);
Expand Down Expand Up @@ -892,7 +887,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
adt: &'tcx ty::AdtDef,
substs: SubstsRef<'tcx>,
target: BasicBlock,
unwind: Unwind
unwind: Unwind,
) -> BasicBlock {
let tcx = self.tcx();
let unit_temp = Place::Base(PlaceBase::Local(self.new_temp(tcx.mk_unit())));
Expand Down Expand Up @@ -947,11 +942,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
}
}

fn new_block(&mut self,
unwind: Unwind,
k: TerminatorKind<'tcx>)
-> BasicBlock
{
fn new_block(&mut self, unwind: Unwind, k: TerminatorKind<'tcx>) -> BasicBlock {
self.elaborator.patch().new_block(BasicBlockData {
statements: vec![],
terminator: Some(Terminator {
Expand Down
9 changes: 5 additions & 4 deletions src/libsyntax_ext/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ use syntax::tokenstream;
use syntax::parse::token;
use syntax_pos::Span;

pub fn expand_cfg(cx: &mut ExtCtxt<'_>,
sp: Span,
tts: &[tokenstream::TokenTree])
-> Box<dyn base::MacResult + 'static> {
pub fn expand_cfg(
cx: &mut ExtCtxt<'_>,
sp: Span,
tts: &[tokenstream::TokenTree],
) -> Box<dyn base::MacResult + 'static> {
let sp = sp.apply_mark(cx.current_expansion.mark);

match parse_cfg(cx, sp, tts) {
Expand Down

0 comments on commit 1d720ec

Please sign in to comment.