Rustfmt
This commit is contained in:
parent
3183b44a1e
commit
1fcae03369
287 changed files with 5888 additions and 4608 deletions
|
@ -100,16 +100,20 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
) {
|
||||
debug!(?sup_type, ?sub_region, ?cause);
|
||||
let origin = SubregionOrigin::from_obligation_cause(cause, || {
|
||||
infer::RelateParamBound(cause.span, sup_type, match cause.code().peel_derives() {
|
||||
ObligationCauseCode::WhereClause(_, span)
|
||||
| ObligationCauseCode::WhereClauseInExpr(_, span, ..)
|
||||
| ObligationCauseCode::OpaqueTypeBound(span, _)
|
||||
if !span.is_dummy() =>
|
||||
{
|
||||
Some(*span)
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
infer::RelateParamBound(
|
||||
cause.span,
|
||||
sup_type,
|
||||
match cause.code().peel_derives() {
|
||||
ObligationCauseCode::WhereClause(_, span)
|
||||
| ObligationCauseCode::WhereClauseInExpr(_, span, ..)
|
||||
| ObligationCauseCode::OpaqueTypeBound(span, _)
|
||||
if !span.is_dummy() =>
|
||||
{
|
||||
Some(*span)
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
self.register_region_obligation(RegionObligation { sup_type, sub_region, origin });
|
||||
|
|
|
@ -34,22 +34,22 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
|
||||
let delegate = FnMutDelegate {
|
||||
regions: &mut |br: ty::BoundRegion| {
|
||||
ty::Region::new_placeholder(self.tcx, ty::PlaceholderRegion {
|
||||
universe: next_universe,
|
||||
bound: br,
|
||||
})
|
||||
ty::Region::new_placeholder(
|
||||
self.tcx,
|
||||
ty::PlaceholderRegion { universe: next_universe, bound: br },
|
||||
)
|
||||
},
|
||||
types: &mut |bound_ty: ty::BoundTy| {
|
||||
Ty::new_placeholder(self.tcx, ty::PlaceholderType {
|
||||
universe: next_universe,
|
||||
bound: bound_ty,
|
||||
})
|
||||
Ty::new_placeholder(
|
||||
self.tcx,
|
||||
ty::PlaceholderType { universe: next_universe, bound: bound_ty },
|
||||
)
|
||||
},
|
||||
consts: &mut |bound_var: ty::BoundVar| {
|
||||
ty::Const::new_placeholder(self.tcx, ty::PlaceholderConst {
|
||||
universe: next_universe,
|
||||
bound: bound_var,
|
||||
})
|
||||
ty::Const::new_placeholder(
|
||||
self.tcx,
|
||||
ty::PlaceholderConst { universe: next_universe, bound: bound_var },
|
||||
)
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -45,12 +45,15 @@ pub trait TraitEngine<'tcx, E: 'tcx>: 'tcx {
|
|||
cause: ObligationCause<'tcx>,
|
||||
) {
|
||||
let trait_ref = ty::TraitRef::new(infcx.tcx, def_id, [ty]);
|
||||
self.register_predicate_obligation(infcx, Obligation {
|
||||
cause,
|
||||
recursion_depth: 0,
|
||||
param_env,
|
||||
predicate: trait_ref.upcast(infcx.tcx),
|
||||
});
|
||||
self.register_predicate_obligation(
|
||||
infcx,
|
||||
Obligation {
|
||||
cause,
|
||||
recursion_depth: 0,
|
||||
param_env,
|
||||
predicate: trait_ref.upcast(infcx.tcx),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
fn register_predicate_obligation(
|
||||
|
|
|
@ -193,10 +193,10 @@ impl<'tcx> ProjectionCache<'_, 'tcx> {
|
|||
if result.must_apply_considering_regions() {
|
||||
ty.obligations = PredicateObligations::new();
|
||||
}
|
||||
map.insert(key, ProjectionCacheEntry::NormalizedTerm {
|
||||
ty,
|
||||
complete: Some(result),
|
||||
});
|
||||
map.insert(
|
||||
key,
|
||||
ProjectionCacheEntry::NormalizedTerm { ty, complete: Some(result) },
|
||||
);
|
||||
}
|
||||
ref value => {
|
||||
// Type inference could "strand behind" old cache entries. Leave
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue