type_check/mod.rs: rustfmt
This commit is contained in:
parent
1371cd27d0
commit
4394c83cb7
1 changed files with 27 additions and 24 deletions
|
@ -1034,7 +1034,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
||||||
|
|
||||||
self.eq_types(self_ty, impl_self_ty, locations, category)?;
|
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`.
|
// 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
|
/// particularly necessary -- we'll do it lazilly as we process
|
||||||
/// the value anyway -- but in some specific cases it is useful to
|
/// the value anyway -- but in some specific cases it is useful to
|
||||||
/// normalize so we can suppress duplicate error messages.
|
/// normalize so we can suppress duplicate error messages.
|
||||||
fn fold_to_region_vid<T>(
|
fn fold_to_region_vid<T>(&self, value: T) -> T
|
||||||
&self,
|
where
|
||||||
value: T
|
T: TypeFoldable<'tcx>,
|
||||||
) -> T
|
|
||||||
where T: TypeFoldable<'tcx>
|
|
||||||
{
|
{
|
||||||
if let Some(borrowck_context) = &self.borrowck_context {
|
if let Some(borrowck_context) = &self.borrowck_context {
|
||||||
self.tcx().fold_regions(&value, &mut false, |r, _debruijn| {
|
self.tcx().fold_regions(&value, &mut false, |r, _debruijn| {
|
||||||
|
@ -1212,12 +1214,14 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
||||||
// though.
|
// though.
|
||||||
let category = match *place {
|
let category = match *place {
|
||||||
Place::Local(RETURN_PLACE) => if let Some(BorrowCheckContext {
|
Place::Local(RETURN_PLACE) => if let Some(BorrowCheckContext {
|
||||||
universal_regions: UniversalRegions {
|
universal_regions:
|
||||||
defining_ty: DefiningTy::Const(def_id, _),
|
UniversalRegions {
|
||||||
..
|
defining_ty: DefiningTy::Const(def_id, _),
|
||||||
},
|
..
|
||||||
|
},
|
||||||
..
|
..
|
||||||
}) = self.borrowck_context {
|
}) = self.borrowck_context
|
||||||
|
{
|
||||||
if tcx.is_static(*def_id).is_some() {
|
if tcx.is_static(*def_id).is_some() {
|
||||||
ConstraintCategory::UseAsStatic
|
ConstraintCategory::UseAsStatic
|
||||||
} else {
|
} else {
|
||||||
|
@ -1225,7 +1229,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ConstraintCategory::Return
|
ConstraintCategory::Return
|
||||||
}
|
},
|
||||||
Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => {
|
Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => {
|
||||||
ConstraintCategory::Boring
|
ConstraintCategory::Boring
|
||||||
}
|
}
|
||||||
|
@ -1512,12 +1516,14 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
||||||
let category = match *dest {
|
let category = match *dest {
|
||||||
Place::Local(RETURN_PLACE) => {
|
Place::Local(RETURN_PLACE) => {
|
||||||
if let Some(BorrowCheckContext {
|
if let Some(BorrowCheckContext {
|
||||||
universal_regions: UniversalRegions {
|
universal_regions:
|
||||||
defining_ty: DefiningTy::Const(def_id, _),
|
UniversalRegions {
|
||||||
..
|
defining_ty: DefiningTy::Const(def_id, _),
|
||||||
},
|
..
|
||||||
|
},
|
||||||
..
|
..
|
||||||
}) = self.borrowck_context {
|
}) = self.borrowck_context
|
||||||
|
{
|
||||||
if tcx.is_static(*def_id).is_some() {
|
if tcx.is_static(*def_id).is_some() {
|
||||||
ConstraintCategory::UseAsStatic
|
ConstraintCategory::UseAsStatic
|
||||||
} else {
|
} else {
|
||||||
|
@ -1526,7 +1532,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
||||||
} else {
|
} else {
|
||||||
ConstraintCategory::Return
|
ConstraintCategory::Return
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => {
|
Place::Local(l) if !mir.local_decls[l].is_user_variable.is_some() => {
|
||||||
ConstraintCategory::Boring
|
ConstraintCategory::Boring
|
||||||
}
|
}
|
||||||
|
@ -1584,12 +1590,9 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
||||||
} else {
|
} else {
|
||||||
ConstraintCategory::Boring
|
ConstraintCategory::Boring
|
||||||
};
|
};
|
||||||
if let Err(terr) = self.sub_types(
|
if let Err(terr) =
|
||||||
op_arg_ty,
|
self.sub_types(op_arg_ty, fn_arg, term_location.to_locations(), category)
|
||||||
fn_arg,
|
{
|
||||||
term_location.to_locations(),
|
|
||||||
category,
|
|
||||||
) {
|
|
||||||
span_mirbug!(
|
span_mirbug!(
|
||||||
self,
|
self,
|
||||||
term,
|
term,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue