1
Fork 0

type_check/mod.rs: rustfmt

This commit is contained in:
Niko Matsakis 2018-10-23 10:57:06 -04:00
parent 1371cd27d0
commit 4394c83cb7

View file

@ -1034,7 +1034,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
self.eq_types(self_ty, impl_self_ty, locations, category)?;
self.prove_predicate(ty::Predicate::WellFormed(impl_self_ty), locations, category);
self.prove_predicate(
ty::Predicate::WellFormed(impl_self_ty),
locations,
category,
);
}
// Prove the predicates coming along with `def_id`.
@ -1072,11 +1076,9 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
/// particularly necessary -- we'll do it lazilly as we process
/// the value anyway -- but in some specific cases it is useful to
/// normalize so we can suppress duplicate error messages.
fn fold_to_region_vid<T>(
&self,
value: T
) -> T
where T: TypeFoldable<'tcx>
fn fold_to_region_vid<T>(&self, value: T) -> T
where
T: TypeFoldable<'tcx>,
{
if let Some(borrowck_context) = &self.borrowck_context {
self.tcx().fold_regions(&value, &mut false, |r, _debruijn| {
@ -1212,12 +1214,14 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
// though.
let category = match *place {
Place::Local(RETURN_PLACE) => if let Some(BorrowCheckContext {
universal_regions: UniversalRegions {
defining_ty: DefiningTy::Const(def_id, _),
..
},
universal_regions:
UniversalRegions {
defining_ty: DefiningTy::Const(def_id, _),
..
},
..
}) = self.borrowck_context {
}) = self.borrowck_context
{
if tcx.is_static(*def_id).is_some() {
ConstraintCategory::UseAsStatic
} else {
@ -1225,7 +1229,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
}
} else {
ConstraintCategory::Return
}
},
Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => {
ConstraintCategory::Boring
}
@ -1512,12 +1516,14 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
let category = match *dest {
Place::Local(RETURN_PLACE) => {
if let Some(BorrowCheckContext {
universal_regions: UniversalRegions {
defining_ty: DefiningTy::Const(def_id, _),
..
},
universal_regions:
UniversalRegions {
defining_ty: DefiningTy::Const(def_id, _),
..
},
..
}) = self.borrowck_context {
}) = self.borrowck_context
{
if tcx.is_static(*def_id).is_some() {
ConstraintCategory::UseAsStatic
} else {
@ -1526,7 +1532,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
} else {
ConstraintCategory::Return
}
},
}
Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => {
ConstraintCategory::Boring
}
@ -1584,12 +1590,9 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
} else {
ConstraintCategory::Boring
};
if let Err(terr) = self.sub_types(
op_arg_ty,
fn_arg,
term_location.to_locations(),
category,
) {
if let Err(terr) =
self.sub_types(op_arg_ty, fn_arg, term_location.to_locations(), category)
{
span_mirbug!(
self,
term,